# Darker version of lookup table for backfaces of vtkPolyData?

**URL:** https://discourse.vtk.org/t/darker-version-of-lookup-table-for-backfaces-of-vtkpolydata/2108
**Category:** Support
**Created:** [November 19, 2019, 1:05pm UTC](https://discourse.vtk.org/t/darker-version-of-lookup-table-for-backfaces-of-vtkpolydata/2108 "2019-11-19T13:05:45Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![maleike](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/278dde/32.png) [@maleike](https://discourse.vtk.org/u/maleike)
#### Post date: [November 19, 2019, 1:05pm UTC](https://discourse.vtk.org/t/darker-version-of-lookup-table-for-backfaces-of-vtkpolydata/2108/1 "2019-11-19T13:05:45Z")

</div>

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](https://discourse.vtk.org/uploads/default/original/2X/d/d4de44c2fdb6b7ff24a28d7b764e9501a7a1e427.png)

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!

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [November 19, 2019, 2:33pm UTC](https://discourse.vtk.org/t/darker-version-of-lookup-table-for-backfaces-of-vtkpolydata/2108/2 "2019-11-19T14:33:55Z")

</div>

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

---

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [November 19, 2019, 10:43pm UTC](https://discourse.vtk.org/t/darker-version-of-lookup-table-for-backfaces-of-vtkpolydata/2108/3 "2019-11-19T22:43:37Z")

</div>

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

---

<div class="post-metadata">

### Author: ![maleike](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/278dde/32.png) [@maleike](https://discourse.vtk.org/u/maleike)
#### Post date: [November 20, 2019, 11:15am UTC](https://discourse.vtk.org/t/darker-version-of-lookup-table-for-backfaces-of-vtkpolydata/2108/4 "2019-11-20T11:15:25Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [November 21, 2019, 1:10am UTC](https://discourse.vtk.org/t/darker-version-of-lookup-table-for-backfaces-of-vtkpolydata/2108/5 "2019-11-21T01:10:49Z")

</div>

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

---

<div class="post-metadata">

### Author: ![maleike](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/m/278dde/32.png) [@maleike](https://discourse.vtk.org/u/maleike)
#### Post date: [November 21, 2019, 8:50am UTC](https://discourse.vtk.org/t/darker-version-of-lookup-table-for-backfaces-of-vtkpolydata/2108/6 "2019-11-21T08:50:20Z")

</div>

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

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [November 21, 2019, 2:09pm UTC](https://discourse.vtk.org/t/darker-version-of-lookup-table-for-backfaces-of-vtkpolydata/2108/7 "2019-11-21T14:09:01Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![toddy](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/t/edb3f5/32.png) [@toddy](https://discourse.vtk.org/u/toddy)
#### Post date: [November 21, 2019, 8:55pm UTC](https://discourse.vtk.org/t/darker-version-of-lookup-table-for-backfaces-of-vtkpolydata/2108/8 "2019-11-21T20:55:59Z")

</div>

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

---

<div class="post-metadata">

### Author: ![raungst](https://discourse.vtk.org/user_avatar/discourse.vtk.org/raungst/32/1965_2.png) [@raungst](https://discourse.vtk.org/u/raungst)
#### Post date: [May 6, 2021, 6:24pm UTC](https://discourse.vtk.org/t/darker-version-of-lookup-table-for-backfaces-of-vtkpolydata/2108/9 "2021-05-06T18:24:20Z")

</div>

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](https://gitlab.kitware.com/vtk/vtk/-/issues/13259)

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