Note
Go to the end to download the full example code. or to run this example in your browser via Binder
Lighting Properties#
Control aspects of the rendered mesh’s lighting such as Ambient, Diffuse,
and Specular. These options only work if the lighting
argument to
add_mesh
is True
(it’s True
by default).
You can turn off all lighting for the given mesh by passing lighting=False
to add_mesh
.
See the add_mesh
docs for lighting options:
https://docs.pyvista.org/api/plotting/_autosummary/pyvista.Plotter.add_mesh.html
First, lets take a look at the mesh with default lighting conditions
What about with no lighting?
Demonstration of the specular property
Feel free to adjust the specular value in the s
variable.
p = pv.Plotter(shape=(1, 2), window_size=[1500, 500])
p.subplot(0, 0)
p.add_mesh(mesh, show_scalar_bar=False)
p.add_text("No Specular")
p.subplot(0, 1)
specular = 1.0
p.add_mesh(mesh, specular=specular, show_scalar_bar=False)
p.add_text(f"Specular of {specular}")
p.link_views()
p.view_isometric()
p.show(cpos=cpos)
Specular power (feel free to adjust)
Demonstration of all diffuse, specular, and ambient in use together (feel free to adjust)
For detailed control over lighting conditions in general see the lighting examples
Total running time of the script: (0 minutes 8.611 seconds)