How to tune Shadow Visibility in python?

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.

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.

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.

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

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

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