{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# Eye Dome Lighting\n\nEye-Dome Lighting (EDL) is a non-photorealistic, image-based shading\ntechnique designed to improve depth perception in scientific\nvisualization images. To learn more, please see [this blog\npost](https://blog.kitware.com/eye-dome-lighting-a-non-photorealistic-shading-technique/).\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import pyvista as pv\nfrom pyvista import examples"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# Point Cloud\n\nWhen plotting a simple point cloud, it can be difficult to perceive\ndepth. Take this Lidar point cloud for example:\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "point_cloud = examples.download_lidar()\npoint_cloud"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "And now plot this point cloud as-is:\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "# Plot a typical point cloud with no EDL\npl = pv.Plotter()\npl.add_mesh(point_cloud, color=\"tan\", point_size=5)\npl.show()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "We can improve the depth mapping by enabling eye dome lighting on the\nrenderer with\n`pyvista.Renderer.enable_eye_dome_lighting`{.interpreted-text\nrole=\"func\"}.\n\nTry plotting that point cloud with Eye-Dome-Lighting yourself below:\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "pl = pv.Plotter()\npl.add_mesh(point_cloud, color=\"tan\", point_size=5)\n# Turn on eye dome lighting here\npl.show()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "The eye dome lighting mode can also handle plotting scalar arrays. Try\nthe above block but by specifying a `scalars` array instead of `color`\nin the `add_mesh` call.\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "```{=html}\n<center>\n  <a target=\"_blank\" href=\"https://colab.research.google.com/github/pyvista/pyvista-tutorial/blob/gh-pages/notebooks/tutorial/03_figures/exercises/c_edl.ipynb\">\n    <img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/ width=\"150px\">\n  </a>\n</center>\n```\n"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.12.11"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}