# How to tune Shadow Visibility in python?

**URL:** https://discourse.slicer.org/t/how-to-tune-shadow-visibility-in-python/33756
**Category:** Support
**Created:** [January 13, 2024, 10:45am UTC](https://discourse.slicer.org/t/how-to-tune-shadow-visibility-in-python/33756 "2024-01-13T10:45:22Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)
#### Post date: [January 13, 2024, 10:45am UTC](https://discourse.slicer.org/t/how-to-tune-shadow-visibility-in-python/33756/1 "2024-01-13T10:45:22Z")

</div>

Hi,

The 3D viewers now default to ‘Shadows visibility’ enabled at 25%. The picture below shows the effect on the right. The left image, with this setting off, is brighter and more comfortable to look at. It’s not just comfort, distinction between structures is more obvious.

 ![bright_dim](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/2/3/2352206b6b34bd322bfcd57198289a56ee0059f0.jpeg)

I didn’t find a tunable in ‘Application settings / Volume rendering’ to either disable ‘Shadows visibility’ or set it at 100%. There is probably a few lines we could drop in slicerrc.py to enable this. Could you hint at the code that can do that?

Thank you.

---

<div class="post-metadata">

### Author: ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)
#### Post date: [January 13, 2024, 3:18pm UTC](https://discourse.slicer.org/t/how-to-tune-shadow-visibility-in-python/33756/2 "2024-01-13T15:18:13Z")

</div>

Ok, using this in slicerrc.py, in case it might be of interest to anyone. The 3D views get updated, but not the controlling widget.

```auto
def noShadows():
    nb = slicer.app.layoutManager().threeDViewCount
    for x in range(0, nb):
        view = slicer.app.layoutManager().threeDWidget(x).threeDView()
        renderWindow = view.renderWindow()
        view.setShadowsVisibility(False)
        renderWindow.Render()

```

---

<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: [January 14, 2024, 2:45am UTC](https://discourse.slicer.org/t/how-to-tune-shadow-visibility-in-python/33756/3 "2024-01-14T02:45:17Z")

</div>

Shadows are applied to both surface and volume rendering, therefore defaults are specified in Views section of application settings.

You can conveniently configure these settings along with additional light controls in Lights module (in Sandbox extension).

---

<div class="post-metadata">

### Author: ![chir.set](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/chir.set/32/66982_2.png) [@chir.set](https://discourse.slicer.org/u/chir.set)
#### Post date: [January 14, 2024, 7:51am UTC](https://discourse.slicer.org/t/how-to-tune-shadow-visibility-in-python/33756/4 "2024-01-14T07:51:35Z")

</div>

> [@lassoan](#):
>
> Views section of application settings

Great, that’s the right way to set global settings, than you very much.
