# New module to customize lighting in 3D view

**URL:** <https://discourse.slicer.org/t/new-module-to-customize-lighting-in-3d-view/8804>\
**Category:** Support\
**Tags:** feature\
**Created:** [October 16, 2019, 8:24pm UTC](https://discourse.slicer.org/t/new-module-to-customize-lighting-in-3d-view/8804 "2019-10-16T20:24:54Z")\
**Posts on this page:** 20\
**Page:** 1

<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:24pm UTC](https://discourse.slicer.org/t/new-module-to-customize-lighting-in-3d-view/8804/1 "2019-10-16T20:24:55Z")

</div>

A new experimental module, “Lights”, was added to “Sandbox” extension that allows you to change lightkit parameters with a simple GUI. See a short demo video here:

If we get the feedback that this module is useful then we’ll consider adding it to the Slicer core.

---

<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:22pm UTC](https://discourse.slicer.org/t/new-module-to-customize-lighting-in-3d-view/8804/2 "2019-10-16T23:22:22Z")

</div>

Really beautifull. Thank you for the share.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [October 16, 2019, 11:32pm UTC](https://discourse.slicer.org/t/new-module-to-customize-lighting-in-3d-view/8804/3 "2019-10-16T23:32:13Z")

</div>

This looks really cool. Thanks Andras.

---

<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 17, 2019, 1:09am UTC](https://discourse.slicer.org/t/new-module-to-customize-lighting-in-3d-view/8804/4 "2019-10-17T01:09:39Z")

</div>

If there is interest for more photorealistic rendering then we could consider exposing additional rendering backends that VTK supports. You can already try VTK’s NVidia Optix and OSPray rendering backends in Paraview. They are very nice for rendering surface meshes with shadows and reflections. I did not have much luck with producing nice volume renderings with them.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [October 17, 2019, 3:07am UTC](https://discourse.slicer.org/t/new-module-to-customize-lighting-in-3d-view/8804/5 "2019-10-17T03:07:27Z")

</div>

FYI Sandbox does not show up in the extension search, while it is listed under examples.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [October 17, 2019, 4:03am UTC](https://discourse.slicer.org/t/new-module-to-customize-lighting-in-3d-view/8804/6 "2019-10-17T04:03:48Z")

</div>

I think it looks good enough to be used as is.

Couple things I would suggest when you have a chance (in terms of priority):

1. Button to revert back to defaults (or a way to unset them).
2. Option to save and load light settings (like volume properties).
3. Can warmth be a color palette?
4. I am not sure how to make use of create View functionality. I know it is something to do with Slice Controllers module, but it is not clear to me how to control different views with a single 3D render window.

But I think it is looking great, would rather see it part of core sooner than later. Thanks again.  
M

---

<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 17, 2019, 1:10pm UTC](https://discourse.slicer.org/t/new-module-to-customize-lighting-in-3d-view/8804/7 "2019-10-17T13:10:10Z")

</div>

These are good suggestions, you can [submit them as issues](https://github.com/PerkLab/SlicerSandbox/issues) to keep track of them.

> [@muratmaga](#):
>
> I am not sure how to make use of create View functionality. I know it is something to do with Slice Controllers module, but it is not clear to me how to control different views with a single 3D render window.

I’m not sure what you mean. Could you please clarify?

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [October 18, 2019, 1:09am UTC](https://discourse.slicer.org/t/new-module-to-customize-lighting-in-3d-view/8804/8 "2019-10-18T01:09:11Z")

</div>

Here are my steps:  
Download MRHEad.nrrd, go to volume rendering set MR preset, switch to lights, create a new view, and set the lights such that effect should clear (e.g., very high intensity), click setup lightkit. Go back to volume rendering, expand the inputs tab, and select the newly created view as view (as oppose to view1 explicitly or all options, which is default). In my case I am getting a blank scene.

If I switch to view controllers, then I can see the new view doesn’t layout number like view1 does. Whether that matters or not I don’t know.

---

<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 18, 2019, 3:10am UTC](https://discourse.slicer.org/t/new-module-to-customize-lighting-in-3d-view/8804/9 "2019-10-18T03:10:42Z")

</div>

> Download MRHEad.nrrd, go to volume rendering set MR preset

Do you enable show volume rendering?

> switch to lights

Do you create lightkit, too?

> create a new view

by switching to a different layout?

> and set the lights such that effect should clear (e.g., very high intensity)

Do you mean just set up some lighting that looks different? With the current version of the module I cannot make the rendering look burnt in.

> click setup lightkit. Go back to volume rendering, expand the inputs tab, and select the newly created view as view (as oppose to view1 explicitly or all options, which is default). In my case I am getting a blank scene.

What do you mean? The volume rendering should appear in each view that is checked in the View list.

Maybe a few screenshots should help me to understand what you do and what your question is.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [October 18, 2019, 3:33am UTC](https://discourse.slicer.org/t/new-module-to-customize-lighting-in-3d-view/8804/10 "2019-10-18T03:33:55Z")

</div>

This is what threw me off:  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/8/4/843afdceccb4817f7d09d7f3c3e523fbd16e01c0.png)

I thought I can create a new view, and then choose it in the Volume Rendering options, so that I can have control over when to use the lights settings (View1 for default, the newly create view for lights on rendering etc). But as far as I can tell the view created in the Lights module has no usability in volume rendering.

![image](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/7/d/7df48bf276af4e2fba3b48fc9060cc5a6ca1262f.png)

---

<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 18, 2019, 2:23pm UTC](https://discourse.slicer.org/t/new-module-to-customize-lighting-in-3d-view/8804/11 "2019-10-18T14:23:28Z")

</div>

I see, the “Create new View” is just a bug, I’ve forgot to disable the “Create new” option in the node selector. Creating a new view involves much more than just creating a new view node. I’ll disable the option.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [October 18, 2019, 4:31pm UTC](https://discourse.slicer.org/t/new-module-to-customize-lighting-in-3d-view/8804/12 "2019-10-18T16:31:37Z")

</div>

Thanks Andras. This is great

---

<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:** [November 25, 2019, 12:55pm UTC](https://discourse.slicer.org/t/new-module-to-customize-lighting-in-3d-view/8804/13 "2019-11-25T12:55:24Z")

</div>

Good afternoon,

I try to use it and although I found the Sandbow extension in the exemples of the extensions and installed it; closed and restarted 3DSlicer; I still do not find the Lights module.

Did I miss a step?

---

<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:** [November 25, 2019, 1:22pm UTC](https://discourse.slicer.org/t/new-module-to-customize-lighting-in-3d-view/8804/14 "2019-11-25T13:22:52Z")

</div>

Are there any clues in the error log?

---

<div class="post-metadata">

**Author:** ![Fishguy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/fishguy/32/7337_2.png) [@Fishguy](https://discourse.slicer.org/u/Fishguy)\
**Post date:** [July 2, 2020, 8:55pm UTC](https://discourse.slicer.org/t/new-module-to-customize-lighting-in-3d-view/8804/15 "2020-07-02T20:55:53Z")

</div>

This is fabulous. We would use this a lot.

---

<div class="post-metadata">

**Author:** ![Ugi\_Mikla](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ugi_mikla/32/7603_2.png) [@Ugi\_Mikla](https://discourse.slicer.org/u/Ugi_Mikla)\
**Post date:** [October 22, 2020, 5:37pm UTC](https://discourse.slicer.org/t/new-module-to-customize-lighting-in-3d-view/8804/16 "2020-10-22T17:37:52Z")

</div>

did u manage? i have the same problem.

---

<div class="post-metadata">

**Author:** ![Ugi\_Mikla](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/ugi_mikla/32/7603_2.png) [@Ugi\_Mikla](https://discourse.slicer.org/u/Ugi_Mikla)\
**Post date:** [October 22, 2020, 5:39pm UTC](https://discourse.slicer.org/t/new-module-to-customize-lighting-in-3d-view/8804/17 "2020-10-22T17:39:47Z")

</div>

I think ist’s Slicers version

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [October 22, 2020, 6:27pm UTC](https://discourse.slicer.org/t/new-module-to-customize-lighting-in-3d-view/8804/18 "2020-10-22T18:27:04Z")

</div>

> [@Ugi\_Mikla](#):
>
> did u manage? i have the same problem.

You mean Lights module is not available to you after installing the Sandbox extension? If so, try with the latest stable.

---

<div class="post-metadata">

**Author:** ![manjula](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/manjula/32/80981_2.png) [@manjula](https://discourse.slicer.org/u/manjula)\
**Post date:** [October 22, 2020, 7:35pm UTC](https://discourse.slicer.org/t/new-module-to-customize-lighting-in-3d-view/8804/19 "2020-10-22T19:35:06Z")

</div>

This is great and many thanks for this great tool this will save lot of time when its come to taking nice photos for publication 😀. … reset/undo button as suggested earlier would be fabulous too.

Thank you again.

---

<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 22, 2020, 8:59pm UTC](https://discourse.slicer.org/t/new-module-to-customize-lighting-in-3d-view/8804/20 "2020-10-22T20:59:32Z")

</div>

I’ve added presets to Lights button (default, ceiling, side, sunset, opera). The “default” preset can be used to reset to default. It’ll be available in the stable and preview releases tomorrow.

Feel free to suggest changes to these presets or define new ones.

Slicer Preview Release now uses [VTK9, which has lots of new photorealistic rendering features](https://blog.kitware.com/vtk-pbr/). If someone has time to play with these options and come up with code snippets that set up interesting visualizations then we can integrate those into the Lights module.

[Next page](https://discourse.slicer.org/t/new-module-to-customize-lighting-in-3d-view/8804.md?page=2)
