Skip to content

Commit c3550c9

Browse files
authored
Merge pull request godotengine#8285 from Calinou/environment-glow-2d
Document glow in 2D in Environment and post-processing
2 parents d1e013b + 02ee80a commit c3550c9

File tree

4 files changed

+78
-11
lines changed

4 files changed

+78
-11
lines changed

about/list_of_features.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ Rendering
142142
- GPU-based :ref:`particles <doc_particle_systems_2d>` with support for
143143
:ref:`custom particle shaders <doc_particle_shader>`.
144144
- CPU-based particles.
145+
- Optional :ref:`2D HDR rendering <doc_environment_and_post_processing_using_glow_in_2d>`
146+
for better glow capabilities.
145147

146148
2D tools
147149
--------
@@ -340,6 +342,7 @@ Rendering
340342
- Glow/bloom with optional bicubic upscaling and several blend modes available:
341343
Screen, Soft Light, Add, Replace, Mix.
342344
- Glow can have a colored dirt map texture, acting as a lens dirt effect.
345+
- Glow can be :ref:`used as a screen-space blur effect <doc_environment_and_post_processing_using_glow_to_blur_the_screen>`.
343346
- Color correction using a one-dimensional ramp or a 3D LUT texture.
344347
- Roughness limiter to reduce the impact of specular aliasing.
345348
- Brightness, contrast and saturation adjustments.

tutorials/3d/environment_and_post_processing.rst

Lines changed: 75 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ Camera attributes
8888
adjusting those properties independently of other Environment settings more
8989
easily.
9090

91-
The :ref:`class_CameraAttributes` resource stores exposure and depth of field information. It
92-
also allows enabling automatic exposure adjustments depending on scene
93-
brightness.
91+
The :ref:`class_CameraAttributes` resource stores exposure and depth of field
92+
information. It also allows enabling automatic exposure adjustments depending on
93+
scene brightness.
9494

9595
There are two kinds of CameraAttribute resources available:
9696

@@ -152,7 +152,9 @@ There are several background modes available:
152152
- **Sky** lets you define a background sky material (see below). By default,
153153
objects in the scene will reflect this sky material and absorb ambient light
154154
from it.
155-
- **Canvas** displays the 2D scene as a background to the 3D scene.
155+
- **Canvas** displays the 2D scene as a background to the 3D scene. This can be used
156+
to make environment effects visible on 2D rendering, such as
157+
:ref:`glow in 2D <doc_environment_and_post_processing_using_glow_in_2d>`.
156158
- **Keep** does not draw any sky, keeping what was present on previous frames
157159
instead. This improves performance in purely indoor scenes, but creates a
158160
"hall of mirrors" visual glitch if the sky is visible at any time.
@@ -544,6 +546,9 @@ illumination for off-screen elements (unlike :abbr:`SSIL (Screen-Space Indirect
544546
Glow
545547
^^^^
546548

549+
*This feature is only available when using the Forward+ and Mobile backends, not
550+
Compatibility.*
551+
547552
In photography and film, when light amount exceeds the maximum *luminance*
548553
(brightness) supported by the media, it generally bleeds outwards to darker
549554
regions of the image. This is simulated in Godot with the **Glow** effect.
@@ -586,8 +591,9 @@ The **Blend Mode** of the effect can also be changed:
586591
an all around.
587592
- **Softlight** is the default and weakest one, producing only a subtle color
588593
disturbance around the objects. This mode works best on dark scenes.
589-
- **Replace** can be used to blur the whole screen or debug the effect. It only
590-
shows the glow effect without the image below.
594+
- **Replace** can be used to
595+
:ref:`blur the whole screen <doc_environment_and_post_processing_using_glow_to_blur_the_screen>`
596+
or debug the effect. It only shows the glow effect without the image below.
591597
- **Mix** mixes the glow effect with the main image. This can be used for
592598
greater artistic control. The mix factor is controlled by the **Mix** property
593599
which appears above the blend mode (only when the blend mode is set to Mix).
@@ -619,11 +625,68 @@ There are 2 main use cases for a glow map texture:
619625

620626
.. image:: img/environment_glow_map.webp
621627

622-
.. note::
628+
.. _doc_environment_and_post_processing_using_glow_in_2d:
629+
630+
Using glow in 2D
631+
^^^^^^^^^^^^^^^^
632+
633+
There are 2 ways to use glow in 2D:
634+
635+
- Since Godot 4.2, you can enable HDR for 2D rendering when using the Forward+
636+
and Mobile rendering methods. This has a performance cost, but it allows for a
637+
greater dynamic range. This also allows you to control which objects glow
638+
using their individual **Modulate** or **Self Modulate** properties (use the
639+
RAW mode in the color picker). Enabling HDR can also reduce banding in the 2D
640+
rendering output.
641+
642+
- To enable HDR in 2D, open the Project Settings, enable
643+
**Rendering > Viewport > HDR 2D** then restart the editor.
644+
645+
- If you want to maximize performance, you can leave HDR disabled for 2D
646+
rendering. However, you will have less control on which objects glow.
647+
648+
- Enable glow, set the environment background mode to **Canvas** then decrease
649+
**Glow HDR Threshold** so that pixels that are not overbright will still
650+
glow. To prevent UI elements from glowing, make them children of a
651+
:ref:`class_CanvasLayer` node. You can control which layers are affected by
652+
glow using the **Background > Canvas Max Layer** property of the Environment
653+
resource.
654+
655+
.. figure:: img/environment_and_post_processing_glow_in_2d.webp
656+
:align: center
657+
:alt: Example of using glow in a 2D scene
623658

624-
Glow can be used in 2D as well. To do so, set the environment background
625-
mode to **Canvas** then enable glow as usual. You may have to decrease
626-
**Glow HDR Threshold** to see a difference.
659+
Example of using glow in a 2D scene. HDR 2D is enabled, while coins and the
660+
bullet have their **Modulate** property increased to overbright values using the
661+
RAW mode in the color picker.
662+
663+
.. _doc_environment_and_post_processing_using_glow_to_blur_the_screen:
664+
665+
Using glow to blur the screen
666+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
667+
668+
Glow can be used to blur the whole viewport, which is useful for background blur
669+
when a menu is open. Only 3D rendering will be affected unless the environment's
670+
background mode is set to **Canvas**. To prevent UI elements from being blurred
671+
when using the Canvas background mode, make them children of a :ref:`class_CanvasLayer`
672+
node. You can control which layers are affected by this blurring effect using the
673+
**Background > Canvas Max Layer** property of the Environment resource.
674+
675+
To use glow as a blurring solution:
676+
677+
- Enable **Normalized** and adjust levels according to preference. Increasing
678+
higher level indices will result in a more blurred image. It's recommended to
679+
leave a single glow level at ``1.0`` and leave all other glow levels at
680+
``0.0``, but this is not required. Note that the final appearance will vary
681+
depending on viewport resolution.
682+
- Set **Intensity** to ``1.0`` and **Bloom** to ``1.0``.
683+
- Set the blend mode to **Replace** and **HDR Luminance Cap** to ``1.0``.
684+
685+
.. figure:: img/environment_and_post_processing_glow_blur.webp
686+
:align: center
687+
:alt: Example of using glow to blur the 2D rendering in the menu's background
688+
689+
Example of using glow to blur the 2D rendering in the menu's background
627690

628691
Adjustments
629692
^^^^^^^^^^^
@@ -717,7 +780,8 @@ a given range. It has an initial **Distance** with a **Transition** region
717780
.. image:: img/environment_dof_far.webp
718781

719782
The **Amount** parameter controls the amount of blur. For larger blurs, tweaking
720-
the **Quality** may be needed in order to avoid artifacts.
783+
the depth of field quality in the advanced project settings may be needed to
784+
avoid artifacts.
721785

722786
Depth of Field / Near Blur
723787
^^^^^^^^^^^^^^^^^^^^^^^^^^
49.7 KB
Loading
54.5 KB
Loading

0 commit comments

Comments
 (0)