Note
Click here to download the full example code
Disabling Mesh Lighting¶
While plotters have a default set of lights and there are many options for
customizing lighting conditions in general, meshes have the option to opt out
of lighting altogether. Pass lighting=False
to add_mesh
to disable
lighting for the given mesh:
# sphinx_gallery_thumbnail_number = 1
import pyvista as pv
from pyvista import examples
horse = examples.download_horse().decimate(0.9)
horse.rotate_z(-120)
horse.points = (horse.points - horse.center) * 100
shifted = horse.copy()
shifted.translate((0, 10, 0))
plotter = pv.Plotter()
plotter.add_mesh(horse, color='brown')
plotter.add_mesh(shifted, color='brown', show_edges=True, lighting=False)
plotter.show()

Out:
[(34.230892235130916, 39.230892235130916, 34.230892235130916),
(0.0, 5.0, 0.0),
(0.0, 0.0, 1.0)]
Due to the obvious lack of depth detail this mostly makes sense for meshes with non-trivial colors or textures. If it weren’t for the edges being drawn, the second mesh would be practically impossible to understand even with the option to interactively explore the surface:
shifted.plot(color='brown', lighting=False)

Out:
[(28.366973395932785, 38.36697339593279, 28.366973395932785),
(0.0, 10.0, 0.0),
(0.0, 0.0, 1.0)]
For further examples about fine-tuning mesh properties that affect light rendering, see the Lighting Properties example.
Total running time of the script: ( 0 minutes 1.548 seconds)