| 1 |
""" |
| 2 |
.. _mesh_lighting_example: |
| 3 |
|
| 4 |
Disabling Mesh Lighting |
| 5 |
~~~~~~~~~~~~~~~~~~~~~~~ |
| 6 |
|
| 7 |
Disable mesh lighting. |
| 8 |
|
| 9 |
While plotters have a default set of lights and there are many options |
| 10 |
for customizing lighting conditions in general, meshes have the option |
| 11 |
to opt out of lighting altogether. Pass ``lighting=False`` to |
| 12 |
:func:`pyvista.Plotter.add_mesh` to disable lighting for the given |
| 13 |
mesh: |
| 14 |
|
| 15 |
""" |
| 16 |
|
| 17 |
# sphinx_gallery_thumbnail_number = 1 |
| 18 |
import pyvista as pv |
| 19 |
from pyvista import examples |
| 20 |
|
| 21 |
horse = examples.download_horse().decimate(0.9) |
| 22 |
horse.rotate_z(-120, inplace=True) |
| 23 |
horse.points = (horse.points - horse.center) * 100 |
| 24 |
shifted = horse.translate((0, 10, 0), inplace=False) |
| 25 |
|
| 26 |
pl = pv.Plotter() |
| 27 |
pl.add_mesh(horse, color='brown') |
| 28 |
pl.add_mesh(shifted, color='brown', show_edges=True, lighting=False) |
| 29 |
pl.show() |
| 30 |
|
| 31 |
|
| 32 |
# %% |
| 33 |
# Due to the obvious lack of depth detail this mostly makes sense for meshes |
| 34 |
# with non-trivial colors or textures. If it weren't for the edges being drawn, |
| 35 |
# the second mesh would be practically impossible to understand even with the |
| 36 |
# option to interactively explore the surface: |
| 37 |
|
| 38 |
shifted.plot(color='brown', lighting=False) |
| 39 |
|
| 40 |
# %% |
| 41 |
# For further examples about fine-tuning mesh properties that affect |
| 42 |
# light rendering, see the :ref:`lighting_mesh_example` example. |
| 43 |
# |
| 44 |
# .. tags:: lights |