Darker version of lookup table for backfaces of vtkPolyData?

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.

donuts

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?

Thanks in advance for any ideas!

Can’t you use ‘SetDiffuse(0.5)’ on the backface property to reduce the lighting?

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).

Thanks for this idea, I did not see that option. It should be the way to do what I want with the current API!

Unfortunately I found out that (for VTK 8.1.0) those coefficients seem ignored when a lookup table is present.

I’ll try to generate a minimal example, run that on VTK latest, and possibly file a bug report.

@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*) {}

Did setting the diffuse value on the backface property end up working when you use scalar data on the cells to color them?

It works great for me if you color the actor with the property, but as soon as I assign scalars it no longer renders the backface property.

There’s some really old commentary on this here. It’s not quite the same, but does point to the scalar data messing up the backface property: https://gitlab.kitware.com/vtk/vtk/-/issues/13259

Am I doing it wrong? Or does it not work with scalars?