Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions tutorials/shaders/shader_reference/spatial_shader.rst
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,9 @@ the ``unshaded`` render mode. If no light function is written, Godot will use th
written to in the ``fragment()`` function to calculate the lighting for you (subject to the render mode).

The ``light()`` function is called for every light in every pixel. It is called within a loop for each light type.
Keep in mind the ``light()`` function only runs for pixels that are affected by at least one light source, and is
completely skipped for pixels that are not hit by any light and shadow. You can use this to create different behavior for
lit and unlit pixels in your shader.
Comment on lines +550 to +552

@Arecher Arecher Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Keep in mind the ``light()`` function only runs for pixels that are affected by at least one light source, and is
completely skipped for pixels that are not hit by any light and shadow. You can use this to create different behavior for
lit and unlit pixels in your shader.
The ``light()`` function is only guaranteed to run for pixels that are affected by at least one light source, and
*might* be completely skipped by the renderer for pixels that are not hit by any light or shadow at all.

Not sure if this addition (even with changes to make it more accurate) is worthwhile of being added to the docs anymore though, since it's a little vague and not directly applicable.


Below is an example of a custom ``light()`` function using a Lambertian lighting model:

Expand Down
Loading