pyvista.Plotter.enable_shadows#

Plotter.enable_shadows()[source]#

Enable shadows.

Examples

First, plot without shadows enabled (default)

>>> import pyvista
>>> mesh = pyvista.Sphere()
>>> pl = pyvista.Plotter(lighting='none', window_size=(1000, 1000))
>>> light = pyvista.Light()
>>> light.set_direction_angle(20, -20)
>>> pl.add_light(light)
>>> _ = pl.add_mesh(mesh, color='white', smooth_shading=True)
>>> _ = pl.add_mesh(pyvista.Box((-1.2, -1, -1, 1, -1, 1)))
>>> pl.show()
https://d33wubrfki0l68.cloudfront.net/322d343480e632209eb051e6ab4ff6be9b72118b/c220d/_images/pyvista-plotter-enable_shadows-1_00_00.png

Now, enable shadows.

>>> import pyvista
>>> mesh = pyvista.Sphere()
>>> pl = pyvista.Plotter(lighting='none', window_size=(1000, 1000))
>>> light = pyvista.Light()
>>> light.set_direction_angle(20, -20)
>>> pl.add_light(light)
>>> _ = pl.add_mesh(mesh, color='white', smooth_shading=True)
>>> _ = pl.add_mesh(pyvista.Box((-1.2, -1, -1, 1, -1, 1)))
>>> pl.enable_shadows()
>>> pl.show()
https://d33wubrfki0l68.cloudfront.net/c5db061db5115e8572d1099302af2b7661e45136/b6fcb/_images/pyvista-plotter-enable_shadows-1_01_00.png