class_directionallight.rst 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the DirectionalLight.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_DirectionalLight:
  5. DirectionalLight
  6. ================
  7. **Inherits:** :ref:`Light<class_Light>` **<** :ref:`VisualInstance<class_VisualInstance>` **<** :ref:`Spatial<class_Spatial>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Directional light from a distance, as from the Sun.
  12. Properties
  13. ----------
  14. +-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  15. | :ref:`float<class_float>` | :ref:`directional_shadow_bias_split_scale<class_DirectionalLight_property_directional_shadow_bias_split_scale>` |
  16. +-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  17. | :ref:`bool<class_bool>` | :ref:`directional_shadow_blend_splits<class_DirectionalLight_property_directional_shadow_blend_splits>` |
  18. +-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  19. | :ref:`ShadowDepthRange<enum_DirectionalLight_ShadowDepthRange>` | :ref:`directional_shadow_depth_range<class_DirectionalLight_property_directional_shadow_depth_range>` |
  20. +-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  21. | :ref:`float<class_float>` | :ref:`directional_shadow_max_distance<class_DirectionalLight_property_directional_shadow_max_distance>` |
  22. +-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  23. | :ref:`ShadowMode<enum_DirectionalLight_ShadowMode>` | :ref:`directional_shadow_mode<class_DirectionalLight_property_directional_shadow_mode>` |
  24. +-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  25. | :ref:`float<class_float>` | :ref:`directional_shadow_normal_bias<class_DirectionalLight_property_directional_shadow_normal_bias>` |
  26. +-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  27. | :ref:`float<class_float>` | :ref:`directional_shadow_split_1<class_DirectionalLight_property_directional_shadow_split_1>` |
  28. +-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  29. | :ref:`float<class_float>` | :ref:`directional_shadow_split_2<class_DirectionalLight_property_directional_shadow_split_2>` |
  30. +-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  31. | :ref:`float<class_float>` | :ref:`directional_shadow_split_3<class_DirectionalLight_property_directional_shadow_split_3>` |
  32. +-----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------+
  33. Enumerations
  34. ------------
  35. .. _enum_DirectionalLight_ShadowMode:
  36. .. _class_DirectionalLight_constant_SHADOW_ORTHOGONAL:
  37. .. _class_DirectionalLight_constant_SHADOW_PARALLEL_2_SPLITS:
  38. .. _class_DirectionalLight_constant_SHADOW_PARALLEL_4_SPLITS:
  39. enum **ShadowMode**:
  40. - **SHADOW_ORTHOGONAL** = **0** --- Renders the entire scene's shadow map from an orthogonal point of view. May result in blockier shadows on close objects.
  41. - **SHADOW_PARALLEL_2_SPLITS** = **1** --- Splits the view frustum in 2 areas, each with its own shadow map.
  42. - **SHADOW_PARALLEL_4_SPLITS** = **2** --- Splits the view frustum in 4 areas, each with its own shadow map.
  43. .. _enum_DirectionalLight_ShadowDepthRange:
  44. .. _class_DirectionalLight_constant_SHADOW_DEPTH_RANGE_STABLE:
  45. .. _class_DirectionalLight_constant_SHADOW_DEPTH_RANGE_OPTIMIZED:
  46. enum **ShadowDepthRange**:
  47. - **SHADOW_DEPTH_RANGE_STABLE** = **0** --- Keeps the shadow stable when the camera moves, at the cost of lower effective shadow resolution. Default value.
  48. - **SHADOW_DEPTH_RANGE_OPTIMIZED** = **1** --- Tries to achieve maximum shadow resolution. May result in saw effect on shadow edges.
  49. Description
  50. -----------
  51. A directional light is a type of :ref:`Light<class_Light>` node that models an infinite number of parallel rays covering the entire scene. It is used for lights with strong intensity that are located far away from the scene to model sunlight or moonlight. The worldspace location of the DirectionalLight transform (origin) is ignored. Only the basis is used to determine light direction.
  52. Tutorials
  53. ---------
  54. - :doc:`../tutorials/3d/lights_and_shadows`
  55. Property Descriptions
  56. ---------------------
  57. .. _class_DirectionalLight_property_directional_shadow_bias_split_scale:
  58. - :ref:`float<class_float>` **directional_shadow_bias_split_scale**
  59. +----------+------------------+
  60. | *Setter* | set_param(value) |
  61. +----------+------------------+
  62. | *Getter* | get_param() |
  63. +----------+------------------+
  64. Amount of extra bias for shadow splits that are far away. If self-shadowing occurs only on the splits far away, increasing this value can fix them.
  65. .. _class_DirectionalLight_property_directional_shadow_blend_splits:
  66. - :ref:`bool<class_bool>` **directional_shadow_blend_splits**
  67. +----------+---------------------------+
  68. | *Setter* | set_blend_splits(value) |
  69. +----------+---------------------------+
  70. | *Getter* | is_blend_splits_enabled() |
  71. +----------+---------------------------+
  72. If ``true``, shadow detail is sacrificed in exchange for smoother transitions between splits. Default value: ``false``.
  73. .. _class_DirectionalLight_property_directional_shadow_depth_range:
  74. - :ref:`ShadowDepthRange<enum_DirectionalLight_ShadowDepthRange>` **directional_shadow_depth_range**
  75. +----------+-------------------------------+
  76. | *Setter* | set_shadow_depth_range(value) |
  77. +----------+-------------------------------+
  78. | *Getter* | get_shadow_depth_range() |
  79. +----------+-------------------------------+
  80. Optimizes shadow rendering for detail versus movement. See :ref:`ShadowDepthRange<enum_DirectionalLight_ShadowDepthRange>`.
  81. .. _class_DirectionalLight_property_directional_shadow_max_distance:
  82. - :ref:`float<class_float>` **directional_shadow_max_distance**
  83. +----------+------------------+
  84. | *Setter* | set_param(value) |
  85. +----------+------------------+
  86. | *Getter* | get_param() |
  87. +----------+------------------+
  88. The maximum distance for shadow splits.
  89. .. _class_DirectionalLight_property_directional_shadow_mode:
  90. - :ref:`ShadowMode<enum_DirectionalLight_ShadowMode>` **directional_shadow_mode**
  91. +----------+------------------------+
  92. | *Setter* | set_shadow_mode(value) |
  93. +----------+------------------------+
  94. | *Getter* | get_shadow_mode() |
  95. +----------+------------------------+
  96. The light's shadow rendering algorithm. See :ref:`ShadowMode<enum_DirectionalLight_ShadowMode>`.
  97. .. _class_DirectionalLight_property_directional_shadow_normal_bias:
  98. - :ref:`float<class_float>` **directional_shadow_normal_bias**
  99. +----------+------------------+
  100. | *Setter* | set_param(value) |
  101. +----------+------------------+
  102. | *Getter* | get_param() |
  103. +----------+------------------+
  104. Can be used to fix special cases of self shadowing when objects are perpendicular to the light.
  105. .. _class_DirectionalLight_property_directional_shadow_split_1:
  106. - :ref:`float<class_float>` **directional_shadow_split_1**
  107. +----------+------------------+
  108. | *Setter* | set_param(value) |
  109. +----------+------------------+
  110. | *Getter* | get_param() |
  111. +----------+------------------+
  112. The distance from camera to shadow split 1. Relative to :ref:`directional_shadow_max_distance<class_DirectionalLight_property_directional_shadow_max_distance>`. Only used when :ref:`directional_shadow_mode<class_DirectionalLight_property_directional_shadow_mode>` is ``SHADOW_PARALLEL_2_SPLITS`` or ``SHADOW_PARALLEL_4_SPLITS``.
  113. .. _class_DirectionalLight_property_directional_shadow_split_2:
  114. - :ref:`float<class_float>` **directional_shadow_split_2**
  115. +----------+------------------+
  116. | *Setter* | set_param(value) |
  117. +----------+------------------+
  118. | *Getter* | get_param() |
  119. +----------+------------------+
  120. The distance from shadow split 1 to split 2. Relative to :ref:`directional_shadow_max_distance<class_DirectionalLight_property_directional_shadow_max_distance>`. Only used when :ref:`directional_shadow_mode<class_DirectionalLight_property_directional_shadow_mode>` is ``SHADOW_PARALLEL_2_SPLITS`` or ``SHADOW_PARALLEL_4_SPLITS``.
  121. .. _class_DirectionalLight_property_directional_shadow_split_3:
  122. - :ref:`float<class_float>` **directional_shadow_split_3**
  123. +----------+------------------+
  124. | *Setter* | set_param(value) |
  125. +----------+------------------+
  126. | *Getter* | get_param() |
  127. +----------+------------------+
  128. The distance from shadow split 2 to split 3. Relative to :ref:`directional_shadow_max_distance<class_DirectionalLight_property_directional_shadow_max_distance>`. Only used when :ref:`directional_shadow_mode<class_DirectionalLight_property_directional_shadow_mode>` is ``SHADOW_PARALLEL_4_SPLITS``.