.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "tutorial/03_figures/solutions/c_edl.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code or to run this example in your browser via Binder .. rst-class:: sphx-glr-example-title .. _sphx_glr_tutorial_03_figures_solutions_c_edl.py: .. _ref_edl: 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`_. .. _this blog post: https://blog.kitware.com/eye-dome-lighting-a-non-photorealistic-shading-technique/ .. GENERATED FROM PYTHON SOURCE LINES 16-20 .. code-block:: Python import pyvista as pv from pyvista import examples .. GENERATED FROM PYTHON SOURCE LINES 22-27 Point Cloud +++++++++++ When plotting a simple point cloud, it can be difficult to perceive depth. Take this Lidar point cloud for example: .. GENERATED FROM PYTHON SOURCE LINES 27-31 .. code-block:: Python point_cloud = examples.download_lidar() point_cloud .. raw:: html
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


.. GENERATED FROM PYTHON SOURCE LINES 32-33 And now plot this point cloud as-is: .. GENERATED FROM PYTHON SOURCE LINES 33-40 .. code-block:: Python # Plot a typical point cloud with no EDL p = pv.Plotter() p.add_mesh(point_cloud, color="tan", point_size=5) p.show() .. image-sg:: /tutorial/03_figures/solutions/images/sphx_glr_c_edl_001.png :alt: c edl :srcset: /tutorial/03_figures/solutions/images/sphx_glr_c_edl_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 41-45 We can improve the depth mapping by enabling eye dome lighting on the renderer with :func:`pyvista.Renderer.enable_eye_dome_lighting`. Try plotting that point cloud with Eye-Dome-Lighting yourself below: .. GENERATED FROM PYTHON SOURCE LINES 45-52 .. code-block:: Python 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() .. image-sg:: /tutorial/03_figures/solutions/images/sphx_glr_c_edl_002.png :alt: c edl :srcset: /tutorial/03_figures/solutions/images/sphx_glr_c_edl_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 53-56 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. .. GENERATED FROM PYTHON SOURCE LINES 56-62 .. code-block:: Python 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() .. image-sg:: /tutorial/03_figures/solutions/images/sphx_glr_c_edl_003.png :alt: c edl :srcset: /tutorial/03_figures/solutions/images/sphx_glr_c_edl_003.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 63-70 .. raw:: html
Open In Colab
.. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 33.365 seconds) .. _sphx_glr_download_tutorial_03_figures_solutions_c_edl.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: binder-badge .. image:: images/binder_badge_logo.svg :target: https://mybinder.org/v2/gh/pyvista/pyvista-tutorial/gh-pages?urlpath=lab/tree/notebooks/tutorial/03_figures/solutions/c_edl.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: c_edl.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: c_edl.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_