@@ -6,8 +6,8 @@ CanvasItem shaders
66CanvasItem shaders are used to draw all 2D elements in Godot. These include
77all nodes that inherit from CanvasItems, and all GUI elements.
88
9- CanvasItem shaders contain fewer built-in variables and functionality than
10- :ref: `Spatial shaders<doc_spatial_shader> `, but they maintain the same basic structure
9+ CanvasItem shaders contain fewer built-in variables and functionality than
10+ :ref: `Spatial shaders<doc_spatial_shader> `, but they maintain the same basic structure
1111with vertex, fragment, and light processor functions.
1212
1313Render modes
@@ -223,6 +223,10 @@ it to the ``NORMAL_MAP`` property. Godot will handle converting it for use in 2D
223223+---------------------------------------------+---------------------------------------------------------------+
224224| in vec2 **SCREEN_PIXEL_SIZE ** | Size of individual pixels. Equal to inverse of resolution. |
225225+---------------------------------------------+---------------------------------------------------------------+
226+ | in vec4 **REGION_RECT ** | Visible area of the sprite region in format |
227+ | | ``(x, y, width, height) ``. Varies according to |
228+ | | Sprite2D's ``region_enabled `` property. |
229+ +---------------------------------------------+---------------------------------------------------------------+
226230| in vec2 **POINT_COORD ** | Coordinate for drawing points. |
227231+---------------------------------------------+---------------------------------------------------------------+
228232| sampler2D **TEXTURE ** | Default 2D texture. |
@@ -238,6 +242,9 @@ it to the ``NORMAL_MAP`` property. Godot will handle converting it for use in 2D
238242| in vec4 **SPECULAR_SHININESS ** | Specular shininess color, as sampled from the texture. |
239243+---------------------------------------------+---------------------------------------------------------------+
240244| in vec2 **UV ** | UV from the ``vertex() `` function. |
245+ | | For Sprite2D with region enabled, this will sample the entire |
246+ | | texture. Use ``REGION_RECT `` instead to sample only the |
247+ | | region defined in the Sprite2D's properties. |
241248+---------------------------------------------+---------------------------------------------------------------+
242249| in vec2 **SCREEN_UV ** | Screen UV coordinate for current pixel. |
243250+---------------------------------------------+---------------------------------------------------------------+
0 commit comments