lighting.rst 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. .. _doc_lighting:
  2. Lighting
  3. ========
  4. Introduction
  5. ------------
  6. Lights emit light that mix with the materials and produces a visible
  7. result. Light can come from several types of sources in a scene:
  8. - From the Material itself, in the form of the emission color (though
  9. it does not affect nearby objects unless baked).
  10. - Light Nodes: Directional, Omni and Spot.
  11. - Ambient Light in the
  12. :ref:`Environment <class_Environment>`.
  13. - Baked Light (read :ref:`doc_light_baking`).
  14. The emission color is a material property, as seen in the previous
  15. tutorials about materials (go read them if you didn't at this point!).
  16. Light Nodes
  17. -----------
  18. As mentioned before, there are three types of light nodes: Directional,
  19. Ambient and Spot. Each has different uses and will be described in
  20. detail below, but firs let's take a look at the common parameters for
  21. lights:
  22. .. image:: /img/light_params.png
  23. Each one has a specific function:
  24. - **Enabled**: Lights can be disabled at any time.
  25. - **Bake Mode**: When using the light baker, the role of this light can
  26. be defined in this enumerator. The role will be followed even if the
  27. light is disabled, which allows to configure a light and then disable
  28. it for baking.
  29. - **Energy**: This value is a multiplier for the light, it's specially
  30. useful for :ref:`doc_high_dynamic_range` and for Spot and Omni lights, because it can
  31. create very bright spots near the emissor.
  32. - **Diffuse and Specular**: These light values get multiplied by the
  33. material light and diffuse colors, so a white value does not mean
  34. that light will be white, but that the original color will be kept.
  35. - **Operator**: It is possible to make some lights negative for a
  36. darkening effect.
  37. - **Projector**: Lights can project a texture for the diffuse light
  38. (currently only supported in Spot light).
  39. Directional Light
  40. ~~~~~~~~~~~~~~~~~
  41. This is the most common type of light and represents the sun. It is also
  42. the cheapest light to compute and should be used whenever possible
  43. (although it's not the cheapest shadow-map to compute, but more on that
  44. later). Directional light nodes are represented by a big arrow, which
  45. represent the direction of the light, however the position of the node
  46. does not affect the lighting at all, and can be anywhere.
  47. .. image:: /img/light_directional.png
  48. Basically what faces the light is lit, what doesn't is dark. Most lights
  49. have specific parameters but directional lights are pretty simple in
  50. nature so they don't.
  51. Omni Light
  52. ~~~~~~~~~~
  53. Omni light is a point that throws light all around it up to a given
  54. radius (distance) that can be controlled by the user. The light
  55. attenuates with the distance and reaches 0 at the edge. It represents
  56. lamps or any other light source that comes from a point.
  57. .. image:: /img/light_omni.png
  58. The attenuation curve for these kind of lights in nature is computed
  59. with an inverse-quadratic function that never reaches zero and has
  60. almost infinitely large values near the emissor.
  61. This makes them considerably inconvenient to tweak for artists, so
  62. Godot simulates them with an artist-controlled exponential curve
  63. instead.
  64. .. image:: /img/light_attenuation.png
  65. Spot Light
  66. ~~~~~~~~~~
  67. Spot lights are similar to Omni lights, except they only operate between
  68. a given angle (or "cutoff"). They are useful to simulate flashlights,
  69. car lights, etc. This kind of light is also attenuated towards the
  70. opposite direction it points to.
  71. .. image:: /img/light_spot.png
  72. Ambient Light
  73. -------------
  74. Ambient light can be found in the properties of a WorldEnvironment
  75. (remember only one of such can be instanced per scene). Ambient light
  76. consists of a uniform light and energy. This light is applied the same
  77. to every single pixel of the rendered scene, except to objects that used
  78. baked light.
  79. Baked Light
  80. -----------
  81. Baked Light stands for pre-computed ambient light. It can serve multiple
  82. purposes, such as baking light emissors that are not going to be used in
  83. real-time, and baking light bounces from real-time lights to add more
  84. realism to a scene (see Baked Light]] tutorial for more information).