Skip to content

Commit 9f12dd2

Browse files
authored
Merge pull request godotengine#8373 from Calinou/hdr-2d-shader-source-color
Document `source_color` shader hint being relevant for 2D HDR
2 parents 26516c1 + 2b3c3c3 commit 9f12dd2

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

tutorials/3d/environment_and_post_processing.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,18 @@ There are 2 ways to use glow in 2D:
660660
bullet have their **Modulate** property increased to overbright values using the
661661
RAW mode in the color picker.
662662

663+
.. warning::
664+
665+
The 2D renderer renders in linear color space if the
666+
**Rendering > Viewport > HDR 2D** project setting is enabled, so
667+
``source_color`` must also be used for uniform samplers that are
668+
used as color input in ``canvas_item`` shaders. If this is not done,
669+
the texture will appear washed out.
670+
671+
If 2D HDR is disabled, ``source_color`` will keep working correctly in
672+
``canvas_item`` shaders, so it's recommend to use it when relevant either
673+
way.
674+
663675
.. _doc_environment_and_post_processing_using_glow_to_blur_the_screen:
664676

665677
Using glow to blur the screen

tutorials/shaders/shader_reference/shading_language.rst

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -760,9 +760,18 @@ used, and how the editor should allow users to modify it.
760760
uniform vec4 other_color : source_color = vec4(1.0); // Default values go after the hint.
761761
uniform sampler2D image : source_color;
762762
763-
It's important to understand that textures that are supplied as color require
764-
hints for proper sRGB->linear conversion (i.e. ``source_color``), as Godot's 3D
765-
engine renders in linear color space.
763+
It's important to understand that textures *that are supplied as color* require
764+
hints for proper sRGB -> linear conversion (i.e. ``source_color``), as Godot's
765+
3D engine renders in linear color space. If this is not done, the texture will
766+
appear washed out.
767+
768+
.. note::
769+
770+
The 2D renderer also renders in linear color space if the
771+
**Rendering > Viewport > HDR 2D** project setting is enabled, so
772+
``source_color`` must also be used in ``canvas_item`` shaders. If 2D HDR is
773+
disabled, ``source_color`` will keep working correctly in ``canvas_item``
774+
shaders, so it's recommend to use it either way.
766775

767776
Full list of hints below:
768777

0 commit comments

Comments
 (0)