# BackfaceProperty of vtkActor is not functioning correctly.

**URL:** https://discourse.vtk.org/t/backfaceproperty-of-vtkactor-is-not-functioning-correctly/11814
**Category:** Support
**Created:** [June 25, 2023, 9:27am UTC](https://discourse.vtk.org/t/backfaceproperty-of-vtkactor-is-not-functioning-correctly/11814 "2023-06-25T09:27:36Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![claude](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/c/0ea827/32.png) [@claude](https://discourse.vtk.org/u/claude)
#### Post date: [June 25, 2023, 9:27am UTC](https://discourse.vtk.org/t/backfaceproperty-of-vtkactor-is-not-functioning-correctly/11814/1 "2023-06-25T09:27:36Z")

</div>

Hi，  
I’m facing the following issue:in the case of vtkPolyDataMapper::ScalarVisibilityOn , setting the color value for BackfaceProperty of vtkActor does not work as expected. How can this be resolved?

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [June 26, 2023, 2:48pm UTC](https://discourse.vtk.org/t/backfaceproperty-of-vtkactor-is-not-functioning-correctly/11814/2 "2023-06-26T14:48:58Z")

</div>

Hello,

Please, post:

1. The code you’re using;
2. Post a picture of what you’re getting and describe in details or illustrate what you need to achieve.

This way you increase the likelyhood of getting an answer.

best,

PC

---

<div class="post-metadata">

### Author: ![claude](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/c/0ea827/32.png) [@claude](https://discourse.vtk.org/u/claude)
#### Post date: [July 3, 2023, 2:00am UTC](https://discourse.vtk.org/t/backfaceproperty-of-vtkactor-is-not-functioning-correctly/11814/3 "2023-07-03T02:00:29Z")

</div>

Hi Paulo,  
Thank you for your suggestion.  
This is an example code:

> vtkNew plyReader;  
> plyReader-\>SetFileName(“file/to/model.ply”);  
> plyReader-\>Update();

```
vtkNew<vtkPolyDataMapper> mapper;
mapper->SetInputData(plyReader->GetOutput());

vtkNew<vtkActor> actor;
actor->SetMapper(mapper);

vtkNew<vtkProperty> backFace;
backFace->SetColor(.5,.6,.7);

actor->SetBackfaceProperty(backFace);

vtkNew<vtkRenderer> render;
vtkNew<vtkRenderWindow> renderWindow;
renderWindow->AddRenderer(render);

vtkNew<vtkRenderWindowInteractor> interactor;
interactor->SetRenderWindow(renderWindow);
vtkNew<vtkInteractorStyleTrackballCamera> style;
interactor->SetInteractorStyle(style);

render->AddActor(actor);
render->SetBackground(.8,.8,.8);

interactor->Start();

```

In the example above, the backface property of the actor is set, but it did not take effect. The model’s backside is still rendered according to the color in the PLY file. See the image below for the result：

 ![bd2da2ba975d22a6d3aa1eabaca3308](https://discourse.vtk.org/uploads/default/original/2X/3/37d044eb409b443d8cb0370d3d1547882589ace5.jpeg)

 ![3060bb09466b29a4b1053cfc29cb1d9](https://discourse.vtk.org/uploads/default/original/2X/5/57f90e3e371548ae0ecda2a68d3555108fe26053.jpeg)

Is this a problem with VTK or did I miss any crucial points in my code?

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [July 12, 2023, 2:04pm UTC](https://discourse.vtk.org/t/backfaceproperty-of-vtkactor-is-not-functioning-correctly/11814/4 "2023-07-12T14:04:41Z")

</div>

G’day,

Try calling `TwoSidedLightingOff()` on the renderer before rendering.

regards,

PC

---

<div class="post-metadata">

### Author: ![claude](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/c/0ea827/32.png) [@claude](https://discourse.vtk.org/u/claude)
#### Post date: [July 24, 2023, 8:19am UTC](https://discourse.vtk.org/t/backfaceproperty-of-vtkactor-is-not-functioning-correctly/11814/5 "2023-07-24T08:19:17Z")

</div>

Hi Paulo,  
Thank you for providing the solution approach, but the explanation of the method TwoSidedLightingOff() is as follows:“If two-sided lighting is off, then only the side of the surface facing the light(s) will be lit, and the other side dark. If two-sided lighting on, both sides of the surface will be lit.”  
When the model rotates to the back, it is actually still facing the light, so the back side remains in the same situation as shown in the illustration above.
