
.. 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 <sphx_glr_download_tutorial_03_figures_solutions_c_edl.py>`
        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

    <div class="output_subarea output_html rendered_html output_result">
    <table style='width: 100%;'><tr><th>Header</th><th>Data Arrays</th></tr><tr><td>
    <table style='width: 100%;'>
    <tr><th>PolyData</th><th>Information</th></tr>
    <tr><td>N Cells</td><td>3392091</td></tr>
    <tr><td>N Points</td><td>3392091</td></tr>
    <tr><td>N Strips</td><td>0</td></tr>
    <tr><td>X Bounds</td><td>4.809e+05, 4.811e+05</td></tr>
    <tr><td>Y Bounds</td><td>4.400e+06, 4.400e+06</td></tr>
    <tr><td>Z Bounds</td><td>1.754e+03, 1.787e+03</td></tr>
    <tr><td>N Arrays</td><td>1</td></tr>
    </table>

    </td><td>
    <table style='width: 100%;'>
    <tr><th>Name</th><th>Field</th><th>Type</th><th>N Comp</th><th>Min</th><th>Max</th></tr>
    <tr><td><b>Elevation</b></td><td>Points</td><td>float64</td><td>1</td><td>1.754e+03</td><td>1.787e+03</td></tr>
    </table>

    </td></tr> </table>
    </div>
    <br />
    <br />

.. 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
    pl = pv.Plotter()
    pl.add_mesh(point_cloud, color="tan", point_size=5)
    pl.show()









.. tab-set::



   .. tab-item:: Static Scene



            
     .. 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
     


   .. tab-item:: Interactive Scene



       .. offlineviewer:: /home/runner/work/pyvista-tutorial/pyvista-tutorial/doc/source/tutorial/03_figures/solutions/images/sphx_glr_c_edl_001.vtksz






.. 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


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









.. tab-set::



   .. tab-item:: Static Scene



            
     .. 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
     


   .. tab-item:: Interactive Scene



       .. offlineviewer:: /home/runner/work/pyvista-tutorial/pyvista-tutorial/doc/source/tutorial/03_figures/solutions/images/sphx_glr_c_edl_002.vtksz






.. 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


    pl = pv.Plotter()
    pl.add_mesh(point_cloud, scalars="Elevation", point_size=5)
    pl.enable_eye_dome_lighting()  # Turn on eye dome lighting here
    pl.show()








.. tab-set::



   .. tab-item:: Static Scene



            
     .. 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
     


   .. tab-item:: Interactive Scene



       .. offlineviewer:: /home/runner/work/pyvista-tutorial/pyvista-tutorial/doc/source/tutorial/03_figures/solutions/images/sphx_glr_c_edl_003.vtksz






.. GENERATED FROM PYTHON SOURCE LINES 63-70

.. raw:: html

    <center>
      <a target="_blank" href="https://colab.research.google.com/github/pyvista/pyvista-tutorial/blob/gh-pages/notebooks/tutorial/03_figures/solutions/c_edl.ipynb">
        <img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/ width="150px">
      </a>
    </center>


.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (0 minutes 35.687 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 <c_edl.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: c_edl.py <c_edl.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: c_edl.zip <c_edl.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
