@@ -324,23 +324,33 @@ Tweaks
324324- **Bounces: ** The number of bounces to use for indirect lighting. The default
325325 value (``3 ``) is a good compromise between bake times and quality. Higher
326326 values will make light bounce around more times before it stops, which makes
327- indirect lighting look smoother (but also brighter). During the initial
328- lighting iteration work, it is recommended to decrease the number of bounces
329- to ``1 `` to speed up baking. Remember that your scene will be darker when
330- decreasing the number of bounces.
327+ indirect lighting look smoother (but also possibly brighter depending on
328+ materials and geometry).
329+ - **Bounce Indirect Energy: ** The global multiplier to use when baking lights'
330+ indirect energy. This multiplies each light's own **Indirect Energy ** value.
331+ Values different from ``1.0 `` are not physically accurate, but can be used for
332+ artistic effect.
331333- **Directional: ** If enabled, stores directional information for lightmaps.
332334 This improves normal mapped materials' appearance for baked surfaces,
333335 especially with fully baked lights (since they also have direct light baked).
334336 The downside is that directional lightmaps are slightly more expensive to render.
335337 They also require more time to bake and result in larger file sizes.
336338- **Interior: ** If enabled, environment lighting will not be sourced. Use this
337339 for purely indoor scenes to avoid light leaks.
338- - **Use Denoiser: ** If enabled, uses `OpenImageDenoise <https://www.openimagedenoise.org/ >`__
339- to make the lightmap significantly less noisy. This increases bake times and can
340- occasionally introduce artifacts, but the result is often worth it.
341- **All ** bake mode on a light, this will turn colored lighting into grayscale
342- lighting. This can be disabled together with HDR to get the smallest possible
343- lightmap file at a given resolution.
340+ - **Use Texture for Bounces: ** If enabled, a texture with the lighting
341+ information will be generated to speed up the generation of indirect lighting
342+ at the cost of some accuracy. The geometry might exhibit extra light leak
343+ artifacts when using low resolution lightmaps or UVs that stretch the lightmap
344+ significantly across surfaces. Leave this enabled if unsure.
345+ - **Use Denoiser: ** If enabled, uses a denoising algorithm to make the lightmap
346+ significantly less noisy. This increases bake times and can occasionally
347+ introduce artifacts, but the result is often worth it. See
348+ :ref: `doc_using_lightmap_gi_denoising ` for more information.
349+ - **Denoiser Strength: ** The strength of denoising step applied to the generated
350+ lightmaps. Higher values are more effective at removing noise, but can reduce
351+ shadow detail for static shadows. Only effective if denoising is enabled and
352+ the denoising method is :abbr: `JNLM ( Non-Local Means with Joint Filtering ) `
353+ (:abbr: `OIDN ( Open Image Denoise ) ` does not have a denoiser strength setting).
344354- **Bias: ** The offset value to use for shadows in 3D units. You generally don't
345355 need to change this value, except if you run into issues with light bleeding or
346356 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
371381require you to reimport all lightmapped 3D scenes before you can bake lightmaps
372382again.
373383
384+
385+ .. _doc_using_lightmap_gi_denoising :
386+
387+ Denoising
388+ ---------
389+
390+ Since baking lightmaps relies on raytracing, there will always be visible noise
391+ in the "raw" baked lightmap. Noise is especially visible in areas that are
392+ difficult to reach by bounced light, such as indoor areas with small openings
393+ where the sunlight can enter. Noise can be reduced by increasing bake quality,
394+ but doing so will increase bake times significantly.
395+
396+ .. figure :: img/lightmap_gi_denoiser_comparison.webp
397+ :align: center
398+ :alt: Comparison between denoising disabled and enabled
399+
400+ Comparison between denoising disabled and enabled (with the default JNLM denoiser).
401+
402+ To combat noise without increasing bake times too much, a denoiser can be used.
403+ A denoiser is an algorithm that runs on the final baked lightmap, detects patterns of
404+ noise and softens them while attempting to best preseve detail.
405+ Godot offers two denoising algorithms:
406+
407+ JNLM (Non-Local Means with Joint Filtering)
408+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
409+
410+ JNLM is the default denoising method and is included in Godot. It uses a simple
411+ but efficient denoising algorithm known as *non-local means *. JNLM runs on the
412+ GPU using a compute shader, and is compatible with any GPU that can run Godot
413+ 4's Vulkan-based rendering methods. No additional setup is required.
414+
415+ JNLM's denoising can be adjusted using the **Denoiser Strength ** property that
416+ is visible when **Use Denoiser ** enabled. Higher values can be more effective at
417+ removing noise, at the cost of suppressing shadow detail for static shadows.
418+
419+ .. figure :: img/lightmap_gi_denoiser_jnlm_strength.webp
420+ :align: center
421+ :alt: Comparison between JNLM denoiser strength values
422+
423+ Comparison between JNLM denoiser strength values. Higher values can reduce detail.
424+
425+ OIDN (Open Image Denoise)
426+ ^^^^^^^^^^^^^^^^^^^^^^^^^
427+
428+ Unlike JNLM, OIDN uses a machine learning approach to denoising lightmaps. It
429+ features a model specifically trained to remove noise from lightmaps while
430+ preserving more shadow detail in most scenes compared to JNLM.
431+
432+ OIDN can run on the GPU if hardware acceleration is configured. With a modern
433+ high-end GPU, this can provide a speedup of over 50× over CPU-based denoising:
434+
435+ - On AMD GPUs, HIP must be installed and configured.
436+ - On NVIDIA GPUs, CUDA must be installed and configured. This may automatically
437+ be done by the NVIDIA installer, but on Linux, CUDA libraries may not be
438+ installed by default. Double-check that the CUDA packages from your Linux
439+ distribution are installed.
440+ - On Intel GPUs, SYCL must be installed and configured.
441+
442+ If hardware acceleration is not available, OIDN will fall back to multithreaded
443+ CPU-based denoising. To confirm whether GPU-based denoising is working, use a
444+ GPU utilization monitor while baking lightmaps and look at the GPU utilization
445+ percentage and VRAM utilization while the denoising step is shown in the Godot
446+ editor. The ``nvidia-smi `` command line tool can be useful for this.
447+
448+ OIDN is not included with Godot due to its relatively large download size. You
449+ can download precompiled OIDN binary packages from its
450+ `website <https://www.openimagedenoise.org/downloads.html >`__.
451+ Extract the package to a location on your PC, then specify the path to the
452+ ``oidnDenoise `` executable in the Editor Settings (**FileSystem > Tools > OIDN >
453+ OIDN Denoise Path **). This executable is located within the ``bin `` folder of
454+ the binary package you extracted.
455+
456+ After specifying the path to the OIDN denoising executable, change the denoising
457+ method in the project settings by setting **Rendering > Lightmapping >
458+ Denoiser ** to **OIDN **. This will affect all lightmap bakes on this project
459+ after the setting is changed.
460+
461+ .. note ::
462+
463+ The denoising method is configured in the project settings instead of the
464+ editor settings. This is done so that different team members working on the
465+ same project are assured to be using the same denoising method for
466+ consistent results.
467+
468+ .. figure :: img/lightmap_gi_denoiser_jnlm_vs_oidn.webp
469+ :align: center
470+ :alt: Comparison between JNLM and OIDN denoisers
471+
472+ Comparison between JNLM and OIDN denoisers.
473+ Notice how OIDN better preserves detail and reduces seams across different objects.
474+
374475.. _doc_using_lightmap_gi_dynamic_objects :
375476
376477Dynamic objects
0 commit comments