# Applying lighting to texture

**URL:** https://discourse.vtk.org/t/applying-lighting-to-texture/694
**Category:** Support
**Created:** [April 6, 2019, 2:08am UTC](https://discourse.vtk.org/t/applying-lighting-to-texture/694 "2019-04-06T02:08:30Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![graphicsmonkey](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/g/3e96dc/32.png) [@graphicsmonkey](https://discourse.vtk.org/u/graphicsmonkey)
#### Post date: [April 6, 2019, 2:08am UTC](https://discourse.vtk.org/t/applying-lighting-to-texture/694/1 "2019-04-06T02:08:30Z")

</div>

In a previous project we used a OpenGL fragment shader to apply lighting effect to an input texture. E.g. the final color of the fragment was the source texture multiplied by the lighting value calculated in the fragment shader.

Is there a way to do something similar to this with Vtk or would we have to use a custom fragment shader? Currently when we apply a texture to a surface it looks like the lighting does not affect the texel coloring.

---

<div class="post-metadata">

### Author: ![graphicsmonkey](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/g/3e96dc/32.png) [@graphicsmonkey](https://discourse.vtk.org/u/graphicsmonkey)
#### Post date: [April 15, 2019, 9:14pm UTC](https://discourse.vtk.org/t/applying-lighting-to-texture/694/2 "2019-04-15T21:14:18Z")

</div>

In case it helps anyone else had some success by calling vtkMapper::InterpolateScalarsBeforeMappingOn

---

<div class="post-metadata">

### Author: ![pettaa123](https://discourse.vtk.org/user_avatar/discourse.vtk.org/pettaa123/32/218_2.png) [@pettaa123](https://discourse.vtk.org/u/pettaa123)
#### Post date: [April 18, 2019, 8:09pm UTC](https://discourse.vtk.org/t/applying-lighting-to-texture/694/3 "2019-04-18T20:09:46Z")

</div>

`actor->GetProperty->SetInterpolationToPhong` or Goraud for example. Play with ambient, diffuse and specular and texture blendmode.

---

<div class="post-metadata">

### Author: ![graphicsmonkey](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/g/3e96dc/32.png) [@graphicsmonkey](https://discourse.vtk.org/u/graphicsmonkey)
#### Post date: [May 15, 2019, 2:16am UTC](https://discourse.vtk.org/t/applying-lighting-to-texture/694/4 "2019-05-15T02:16:59Z")

</div>

Thanks Peter
