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.

import pyvista as pv
from pyvista import examples

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()
point_cloud
HeaderData Arrays
PolyDataInformation
N Cells3392091
N Points3392091
N Strips0
X Bounds4.809e+05, 4.811e+05
Y Bounds4.400e+06, 4.400e+06
Z Bounds1.754e+03, 1.787e+03
N Arrays1
NameFieldTypeN CompMinMax
ElevationPointsfloat6411.754e+031.787e+03


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="tan", point_size=5)
p.show()
c edl

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

Try plotting that point cloud with Eye-Dome-Lighting yourself below:

p = pv.Plotter()
p.add_mesh(point_cloud, color="tan", point_size=5)
p.enable_eye_dome_lighting()  # Turn on eye dome lighting here
p.show()
c edl

The eye dome lighting mode can also handle plotting scalar arrays. Try the above block but by specifying a scalars array instead of color in the add_mesh call.

p = pv.Plotter()
p.add_mesh(point_cloud, scalars="Elevation", point_size=5)
p.enable_eye_dome_lighting()  # Turn on eye dome lighting here
p.show()
c edl
Open In Colab

Total running time of the script: (0 minutes 33.458 seconds)

Gallery generated by Sphinx-Gallery