I am using vtkPolyData for visualization of surfaces in my application. By default I derive a backface color for the object as a ‘darker’ version of the frontface color so that users can easily tell apart inside and outside.
When I use scalar values to colorize the object (either point or cell data) via a lookup table I cannot achieve the same effect. Example in attached image: left a uniformly colored object with two colors for frontface and backface; right: colors obtained from scalar values processed through a lookup table. The right part has no visible distinction between frontface and backface.
The behavior is understandable because there is only one lookup table assigned to the mapper (as in contrast to the actor’s frontface or backface property).
Question: does anyone have a suggestion how I could ‘darken’ the backside of my objects? Or is a modification of vtkPolyDataMapper the only way that would currently work?
Since an actor has the ability to colour the front and back faces differently, I suppose it would be useful to have the option to display the lookup table colours only on the front or back face (or both).
@maleike There is no option in VTK for this. I was simply suggesting that it might be a good feature and possibly not difficult to implement. Filing a feature request would be appropriate or you could attempt to tackle the C++ code yourself.
Sorry, Todd for the misunderstanding. I got you correctly. My answer was directed towards David… It is just that Discourse indicates that in a very discrete way (upper right)…
A rather ugly solution would be to have a separate actor, mapper, and lookup table for the backface. For the front faces, render with backface culling, and for the back face, render with frontface culling.
Since VTK’s default rendering is a diffuse lighting model (this is true even when lookup tables are being used), it seems very odd that the Diffuse parameter is ignored. Perhaps someone who is familiar with shader programming in VTK knows why and can offer a solution.
Perhaps this
/**
* This method renders the property as a backface property. TwoSidedLighting
* must be turned off to see any backface properties. Note that only
* colors and opacity are used for backface properties. Other properties
* such as Representation, Culling are specified by the Property. /
virtual void BackfaceRender(vtkActor, vtkRenderer*) {}