Light direction in volume rendering

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.

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

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

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

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

1 Like

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 a écrit :

1 Like