# Light direction in volume rendering

**URL:** <https://discourse.slicer.org/t/light-direction-in-volume-rendering/6392>\
**Category:** Support\
**Tags:** rendering\
**Created:** [April 4, 2019, 11:03am UTC](https://discourse.slicer.org/t/light-direction-in-volume-rendering/6392 "2019-04-04T11:03:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Melodicpinpon](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/melodicpinpon/32/3254_2.png) [@Melodicpinpon](https://discourse.slicer.org/u/Melodicpinpon)\
**Post date:** [April 4, 2019, 11:03am UTC](https://discourse.slicer.org/t/light-direction-in-volume-rendering/6392/1 "2019-04-04T11:03:47Z")

</div>

Hello,

Is there a way to change the direction of the light source within 3D slicer. I found the material properties options, but in order to create illustration with the same lightning, it may me helpfull for me to be able to define the direction of the light.

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [April 4, 2019, 12:16pm UTC](https://discourse.slicer.org/t/light-direction-in-volume-rendering/6392/2 "2019-04-04T12:16:31Z")

</div>

Yes, you can access the renderer and set up the lights however you want via the python interface as shown below.

[https://vtk.org/doc/nightly/html/classvtkLight.html](https://vtk.org/doc/nightly/html/classvtkLight.html)

```auto
>>> v = slicer.app.layoutManager().threeDWidget(0).threeDView()
>>> v.renderWindow()
(vtkRenderingOpenGL2Python.vtkGenericOpenGLRenderWindow)0x12ea318d8
>>> v.renderWindow().GetRenderers().GetItemAsObject(0)
(vtkRenderingOpenGL2Python.vtkOpenGLRenderer)0x12ea358d8
>>> v.renderWindow().GetRenderers().GetItemAsObject(0)
(vtkRenderingOpenGL2Python.vtkOpenGLRenderer)0x12ea358d8
>>> v.renderWindow().GetRenderers().GetItemAsObject(0).GetLights()
(vtkRenderingCorePython.vtkLightCollection)0x12ea359a8
>>> v.renderWindow().GetRenderers().GetItemAsObject(0).GetLights().GetItemAsObject(0).SetColor([1,0,0])

```

---

<div class="post-metadata">

**Author:** ![Melodicpinpon](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/melodicpinpon/32/3254_2.png) [@Melodicpinpon](https://discourse.slicer.org/u/Melodicpinpon)\
**Post date:** [October 10, 2019, 11:54am UTC](https://discourse.slicer.org/t/light-direction-in-volume-rendering/6392/3 "2019-10-10T11:54:17Z")

</div>

Thank you for your answer.  
As a non coder; I wont invest the time to use it.  
But thank you.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 16, 2019, 8:25pm UTC](https://discourse.slicer.org/t/light-direction-in-volume-rendering/6392/4 "2019-10-16T20:25:31Z")

</div>

I’ve added a module that you can use to customize lighting without Python scripting. See details here: [New module to customize lighting in 3D view](https://discourse.slicer.org/t/new-module-to-customize-lighting-in-3d-view/8804)

---

<div class="post-metadata">

**Author:** ![Melodicpinpon](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/melodicpinpon/32/3254_2.png) [@Melodicpinpon](https://discourse.slicer.org/u/Melodicpinpon)\
**Post date:** [October 16, 2019, 11:35pm UTC](https://discourse.slicer.org/t/light-direction-in-volume-rendering/6392/5 "2019-10-16T23:35:57Z")

</div>

Good evening Mr Lasso;

Thank you for your answer anf for this new development.

This is simply great. I did not think that I would ever see this in 3D slicer.  
You make me want to learn more about the program every time.

Kind regards,

Gauthier

Le mer. 16 oct. 2019 à 22:35, Andras Lasso via 3D Slicer Community [slicer@discoursemail.com](mailto:slicer@discoursemail.com) a écrit :
