Selaa lähdekoodia

Document new denoisers and properties in Using Lightmap global illumination

This also updates List of features to be up-to-date with Godot 4.2's
3D rendering features.
Hugo Locurcio 1 vuosi sitten
vanhempi
commit
9d313cfb8d

+ 25 - 14
about/list_of_features.rst

@@ -8,7 +8,7 @@ This page aims to list **all** features currently supported by Godot.
 .. note::
 
     This page lists features supported by the current stable version of
-    Godot (4.0). Some of these features may not be available in the
+    Godot. Some of these features may not be available in the
     `LTS release series (3.x) <https://docs.godotengine.org/en/3.5/about/list_of_features.html>`__.
 
 Platforms
@@ -203,7 +203,7 @@ Rendering
 - Directional lights (sun/moon). Up to 4 per scene.
 - Omnidirectional lights.
 - Spot lights with adjustable cone angle and attenuation.
-- Specular energy can be adjusted on a per-light basis.
+- Specular, indirect light, and volumetric fog energy can be adjusted on a per-light basis.
 - Adjustable light "size" for fake area lights (will also make shadows blurrier).
 - Optional distance fade system to fade distant lights and their shadows, improving performance.
 - When using the Forward+ backend (default on desktop), lights are
@@ -222,13 +222,13 @@ Rendering
 - *SpotLight:* Single texture. Supports colored projector textures.
 - Shadow normal offset bias and shadow pancaking to decrease the amount of
   visible shadow acne and peter-panning.
-- PCSS-like shadow blur based on the light size and distance from the surface
-  the shadow is cast on.
+- :abbr:`PCSS (Percentage Closer Soft Shadows)`-like shadow blur based on the
+  light size and distance from the surface the shadow is cast on.
 - Adjustable shadow blur on a per-light basis.
 
 **Global illumination with indirect lighting:**
 
-- Baked lightmaps (fast, but can't be updated at run-time).
+- :ref:`Baked lightmaps <doc_using_lightmap_gi>` (fast, but can't be updated at run-time).
 
    - Supports baking indirect light only or baking both direct and indirect lighting.
      The bake mode can be adjusted on a per-light basis to allow for hybrid light
@@ -239,22 +239,28 @@ Rendering
    - Lightmaps are baked on the GPU using compute shaders (much faster compared
      to CPU lightmapping). Baking can only be performed from the editor,
      not in exported projects.
-
-- Voxel-based GI probes. Supports dynamic lights *and* dynamic occluders, while
-  also supporting reflections. Requires a fast baking step which can be
-  performed in the editor or at run-time (including from an exported project).
-- Signed-distance field GI designed for large open worlds.
+   - Supports GPU-based :ref:`denoising <doc_using_lightmap_gi_denoising>`
+     with JNLM, or CPU/GPU-based denoising with OIDN.
+
+- :ref:`Voxel-based GI probes <doc_using_voxel_gi>`. Supports
+  dynamic lights *and* dynamic occluders, while also supporting reflections.
+  Requires a fast baking step which can be performed in the editor or at
+  run-time (including from an exported project).
+- :ref:`Signed-distance field GI <doc_using_sdfgi>` designed for large open worlds.
   Supports dynamic lights, but not dynamic occluders. Supports reflections.
   No baking required.
-- Screen-space indirect lighting (SSIL) at half or full resolution.
-  Fully real-time and supports any kind of emissive light source (including decals).
+- :ref:`Screen-space indirect lighting (SSIL) <doc_environment_and_post_processing_ssil>`
+  at half or full resolution. Fully real-time and supports any kind of emissive
+  light source (including decals).
 - VoxelGI and SDFGI use a deferred pass to allow for rendering GI at half
   resolution to improve performance (while still having functional MSAA support).
 
 **Reflections:**
 
 - Voxel-based reflections (when using GI probes) and SDF-based reflections
-  (when using signed distance field GI).
+  (when using signed distance field GI). Voxel-based reflections are visible
+  on transparent surfaces, while rough SDF-based reflections are visible
+  on transparent surfaces.
 - Fast baked reflections or slow real-time reflections using ReflectionProbe.
   Parallax box correction can optionally be enabled.
 - Screen-space reflections with support for material roughness.
@@ -267,7 +273,8 @@ Rendering
 
 **Decals:**
 
-- Supports albedo, emissive, :abbr:`ORM (Occlusion Roughness Metallic)` and normal mapping.
+- :ref:`Supports albedo <doc_using_decals>`, emissive, :abbr:`ORM (Occlusion Roughness Metallic)`,
+  and normal mapping.
 - Texture channels are smoothly overlaid on top of the underlying material,
   with support for normal/ORM-only decals.
 - Support for normal fade to fade the decal depending on its incidence angle.
@@ -295,12 +302,16 @@ Rendering
 - Exponential height fog.
 - Support for automatic fog color depending on the sky color (aerial perspective).
 - Support for sun scattering in the fog.
+- Support for controlling how much fog rendering should affect the sky, with
+  separate controls for traditional and volumetric fog.
+- Support for making specific materials ignore fog.
 
 **Volumetric fog:**
 
 - Global :ref:`volumetric fog <doc_volumetric_fog>` that reacts to lights and shadows.
 - Volumetric fog can take indirect light into account when using VoxelGI or SDFGI.
 - Fog volume nodes that can be placed to add fog to specific areas (or remove fog from specific areas).
+  Supported shapes include box, ellipse, cone, cylinder, and 3D texture-based density maps.
 - Each fog volume can have its own custom shader.
 - Can be used together with traditional fog.
 

+ 2 - 0
tutorials/3d/environment_and_post_processing.rst

@@ -474,6 +474,8 @@ parameters:
   direct light. Values above ``0.0`` are not physically accurate, but some
   artists prefer this effect.
 
+.. _doc_environment_and_post_processing_ssil:
+
 Screen-Space Indirect Lighting (SSIL)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 

BIN
tutorials/3d/global_illumination/img/lightmap_gi_denoiser_comparison.webp


BIN
tutorials/3d/global_illumination/img/lightmap_gi_denoiser_jnlm_strength.webp


BIN
tutorials/3d/global_illumination/img/lightmap_gi_denoiser_jnlm_vs_oidn.webp


+ 111 - 10
tutorials/3d/global_illumination/using_lightmap_gi.rst

@@ -324,10 +324,12 @@ Tweaks
 - **Bounces:** The number of bounces to use for indirect lighting. The default
   value (``3``) is a good compromise between bake times and quality. Higher
   values will make light bounce around more times before it stops, which makes
-  indirect lighting look smoother (but also brighter). During the initial
-  lighting iteration work, it is recommended to decrease the number of bounces
-  to ``1`` to speed up baking. Remember that your scene will be darker when
-  decreasing the number of bounces.
+  indirect lighting look smoother (but also possibly brighter depending on
+  materials and geometry).
+- **Bounce Indirect Energy:** The global multiplier to use when baking lights'
+  indirect energy. This multiplies each light's own **Indirect Energy** value.
+  Values different from ``1.0`` are not physically accurate, but can be used for
+  artistic effect.
 - **Directional:** If enabled, stores directional information for lightmaps.
   This improves normal mapped materials' appearance for baked surfaces,
   especially with fully baked lights (since they also have direct light baked).
@@ -335,12 +337,20 @@ Tweaks
   They also require more time to bake and result in larger file sizes.
 - **Interior:** If enabled, environment lighting will not be sourced. Use this
   for purely indoor scenes to avoid light leaks.
-- **Use Denoiser:** If enabled, uses `OpenImageDenoise <https://www.openimagedenoise.org/>`__
-  to make the lightmap significantly less noisy. This increases bake times and can
-  occasionally introduce artifacts, but the result is often worth it.
-  **All** bake mode on a light, this will turn colored lighting into grayscale
-  lighting. This can be disabled together with HDR to get the smallest possible
-  lightmap file at a given resolution.
+- **Use Texture for Bounces:** If enabled, a texture with the lighting
+  information will be generated to speed up the generation of indirect lighting
+  at the cost of some accuracy. The geometry might exhibit extra light leak
+  artifacts when using low resolution lightmaps or UVs that stretch the lightmap
+  significantly across surfaces. Leave this enabled if unsure.
+- **Use Denoiser:** If enabled, uses a denoising algorithm to make the lightmap
+  significantly less noisy. This increases bake times and can occasionally
+  introduce artifacts, but the result is often worth it. See
+  :ref:`doc_using_lightmap_gi_denoising` for more information.
+- **Denoiser Strength:** The strength of denoising step applied to the generated
+  lightmaps. Higher values are more effective at removing noise, but can reduce
+  shadow detail for static shadows. Only effective if denoising is enabled and
+  the denoising method is :abbr:`JNLM (Non-Local Means with Joint Filtering)`
+  (:abbr:`OIDN (Open Image Denoise)` does not have a denoiser strength setting).
 - **Bias:** The offset value to use for shadows in 3D units. You generally don't
   need to change this value, except if you run into issues with light bleeding or
   dark spots in your lightmap after baking. This setting does not affect real-time
@@ -371,6 +381,97 @@ imported 3D scenes will also speed up baking significantly. However, this will
 require you to reimport all lightmapped 3D scenes before you can bake lightmaps
 again.
 
+
+.. _doc_using_lightmap_gi_denoising:
+
+Denoising
+---------
+
+Since baking lightmaps relies on raytracing, there will always be visible noise
+in the "raw" baked lightmap. Noise is especially visible in areas that are
+difficult to reach by bounced light, such as indoor areas with small openings
+where the sunlight can enter. Noise can be reduced by increasing bake quality,
+but doing so will increase bake times significantly.
+
+.. figure:: img/lightmap_gi_denoiser_comparison.webp
+   :align: center
+   :alt: Comparison between denoising disabled and enabled
+
+   Comparison between denoising disabled and enabled (with the default JNLM denoiser).
+
+To combat noise without increasing bake times too much, a denoiser can be used.
+A denoiser is an algorithm that runs on the final baked lightmap, detects patterns of
+noise and softens them while attempting to best preseve detail.
+Godot offers two denoising algorithms:
+
+JNLM (Non-Local Means with Joint Filtering)
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+JNLM is the default denoising method and is included in Godot. It uses a simple
+but efficient denoising algorithm known as *non-local means*. JNLM runs on the
+GPU using a compute shader, and is compatible with any GPU that can run Godot
+4's Vulkan-based rendering methods. No additional setup is required.
+
+JNLM's denoising can be adjusted using the **Denoiser Strength** property that
+is visible when **Use Denoiser** enabled. Higher values can be more effective at
+removing noise, at the cost of suppressing shadow detail for static shadows.
+
+.. figure:: img/lightmap_gi_denoiser_jnlm_strength.webp
+   :align: center
+   :alt: Comparison between JNLM denoiser strength values
+
+   Comparison between JNLM denoiser strength values. Higher values can reduce detail.
+
+OIDN (Open Image Denoise)
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Unlike JNLM, OIDN uses a machine learning approach to denoising lightmaps. It
+features a model specifically trained to remove noise from lightmaps while
+preserving more shadow detail in most scenes compared to JNLM.
+
+OIDN can run on the GPU if hardware acceleration is configured. With a modern
+high-end GPU, this can provide a speedup of over 50× over CPU-based denoising:
+
+- On AMD GPUs, HIP must be installed and configured.
+- On NVIDIA GPUs, CUDA must be installed and configured. This may automatically
+  be done by the NVIDIA installer, but on Linux, CUDA libraries may not be
+  installed by default. Double-check that the CUDA packages from your Linux
+  distribution are installed.
+- On Intel GPUs, SYCL must be installed and configured.
+
+If hardware acceleration is not available, OIDN will fall back to multithreaded
+CPU-based denoising. To confirm whether GPU-based denoising is working, use a
+GPU utilization monitor while baking lightmaps and look at the GPU utilization
+percentage and VRAM utilization while the denoising step is shown in the Godot
+editor. The ``nvidia-smi`` command line tool can be useful for this.
+
+OIDN is not included with Godot due to its relatively large download size. You
+can download precompiled OIDN binary packages from its
+`website <https://www.openimagedenoise.org/downloads.html>`__.
+Extract the package to a location on your PC, then specify the path to the
+``oidnDenoise`` executable in the Editor Settings (**FileSystem > Tools > OIDN >
+OIDN Denoise Path**). This executable is located within the ``bin`` folder of
+the binary package you extracted.
+
+After specifying the path to the OIDN denoising executable, change the denoising
+method in the project settings by setting **Rendering > Lightmapping >
+Denoiser** to **OIDN**. This will affect all lightmap bakes on this project
+after the setting is changed.
+
+.. note::
+
+    The denoising method is configured in the project settings instead of the
+    editor settings. This is done so that different team members working on the
+    same project are assured to be using the same denoising method for
+    consistent results.
+
+.. figure:: img/lightmap_gi_denoiser_jnlm_vs_oidn.webp
+   :align: center
+   :alt: Comparison between JNLM and OIDN denoisers
+
+   Comparison between JNLM and OIDN denoisers.
+   Notice how OIDN better preserves detail and reduces seams across different objects.
+
 .. _doc_using_lightmap_gi_dynamic_objects:
 
 Dynamic objects