浏览代码

Merge pull request #6804 from Calinou/canvasitem-shaders-sdf

Document the generation source used for SDF in CanvasItem shaders
Max Hilbrunner 2 年之前
父节点
当前提交
d8dd399304
共有 2 个文件被更改,包括 11 次插入3 次删除
  1. 2 0
      tutorials/2d/2d_lights_and_shadows.rst
  2. 9 3
      tutorials/shaders/shader_reference/canvas_item_shader.rst

+ 2 - 0
tutorials/2d/2d_lights_and_shadows.rst

@@ -170,6 +170,8 @@ of the Light2D base class:
   depending on the other nodes' enabled visual layers **Occluder Light Mask**.
   depending on the other nodes' enabled visual layers **Occluder Light Mask**.
   This can be used to prevent certain objects from receiving light.
   This can be used to prevent certain objects from receiving light.
 
 
+.. _doc_2d_lights_and_shadows_setting_up_shadows:
+
 Setting up shadows
 Setting up shadows
 ------------------
 ------------------
 
 

+ 9 - 3
tutorials/shaders/shader_reference/canvas_item_shader.rst

@@ -200,7 +200,7 @@ Light built-ins
 
 
 Light processor functions work differently in Godot 4.x than they did in Godot
 Light processor functions work differently in Godot 4.x than they did in Godot
 3.x. In Godot 4.x all lighting is done during the regular draw pass. In other
 3.x. In Godot 4.x all lighting is done during the regular draw pass. In other
-words, Godot no longer draws the object again for each light. 
+words, Godot no longer draws the object again for each light.
 
 
 Use render_mode ``unshaded`` if you do not want the light processor function to
 Use render_mode ``unshaded`` if you do not want the light processor function to
 run. Use render_mode ``light_only`` if you only want to see the impact of
 run. Use render_mode ``light_only`` if you only want to see the impact of
@@ -264,8 +264,14 @@ Below is an example of a light shader that takes a CanvasItem's normal map into
 SDF functions
 SDF functions
 ^^^^^^^^^^^^^
 ^^^^^^^^^^^^^
 
 
-There are a few additional functions implemented to support an SDF (Signed Distance Field) feature.
-They are available for Fragment and Light functions of CanvasItem shader.
+There are a few additional functions implemented to sample an automatically
+generated Signed Distance Field texture. These functions available for Fragment
+and Light functions of CanvasItem shaders.
+
+The signed distance field is generated from :ref:`class_LightOccluder2D` nodes
+present in the scene with the **SDF Collision** property enabled (which is the
+default). See the :ref:`2D lights and shadows <doc_2d_lights_and_shadows_setting_up_shadows>`
+documentation for more information.
 
 
 +-----------------------------------------------+----------------------------------------+
 +-----------------------------------------------+----------------------------------------+
 | Function                                      | Description                            |
 | Function                                      | Description                            |