Eye Dome Lighting

Contents

Eye Dome Lighting#

Eye-Dome Lighting (EDL) is a non-photorealistic, image-based shading technique designed to improve depth perception in scientific visualization images. To learn more, please see this blog post.

from __future__ import annotations

import pyvista as pv
from pyvista import examples

Statue#

Eye-Dome Lighting can dramatically improve depth perception when plotting incredibly sophisticated meshes like the creative commons Queen Nefertiti statue:

nefertiti = examples.download_nefertiti()
nefertiti.plot(eye_dome_lighting=True, cpos=[-1, -1, 0.2], color=True)
edl

Here we will compare a EDL shading side by side with normal shading

p = pv.Plotter(shape=(1, 2), border=False)

# With eye-dome lighting
p.subplot(0, 0)
p.add_mesh(nefertiti, color=True)
p.enable_eye_dome_lighting()
p.add_text('Eye-Dome Lighting', font_size=24)
p.camera_position = [-1, -1, 0.2]

# No eye-dome lighting
p.subplot(0, 1)
p.add_mesh(nefertiti, color=True)
p.add_text('No Eye-Dome Lighting', font_size=24)
p.camera_position = [-1, -1, 0.2]

p.show()
edl

Point Cloud#

When plotting a simple point cloud, it can be difficult to perceive depth. Take this Lidar point cloud for example:

point_cloud = examples.download_lidar()

And now plot this point cloud as-is:

# Plot a typical point cloud with no EDL
p = pv.Plotter()
p.add_mesh(point_cloud, color='lightblue', point_size=5)
p.show()
edl

We can improve the depth mapping by enabling eye dome lighting on the renderer with pyvista.Renderer.enable_eye_dome_lighting().

# Plot with EDL
p = pv.Plotter()
p.add_mesh(point_cloud, color='lightblue', point_size=5)
p.enable_eye_dome_lighting()
p.show()
edl

The eye dome lighting mode can also handle plotting scalar arrays:

# Plot with EDL and scalar data
p = pv.Plotter()
p.add_mesh(point_cloud, scalars='Elevation', point_size=5)
p.enable_eye_dome_lighting()
p.show()
edl

Tags: plot

Total running time of the script: (1 minutes 11.341 seconds)

Gallery generated by Sphinx-Gallery