Denoiser
In this case we will present you the Denoiser postprocess step. Denoiser is the most essential postprocess in
SkyRenderer. It eliminates the noise that is intrinsic to the path tracing algorithm.
Agenda:
- Add a Denoiser step
Scene setup
Let's use custom scene composer to set up the scene.
Scene consists of:
- sphere - location: (0, 0, 0)
- camera - location: (5, 0, 0)
- sphere light - location: (2, 2, 2)
We create a render chain with a single light render step and without any postprocess steps. To emphasize the major
difference we will also greatly reduce the antialiasing parameter to just 5 samples per pixel.
from skyrenderer.cases.utils import DenoiserSceneComposer
from skyrenderer.render_chain import RenderChain
scene_composer = DenoiserSceneComposer(antialiasing_level=64)
scene_composer.setup_scene()
scene_composer.renderer_context.define_render_chain(
RenderChain(
render_steps=[scene_composer.visible_light_render_step],
width=1600,
height=1000,
),
)
scene_composer.visualize()
2025-02-14 12:49:00,560 | skyrenderer.scene.renderer_context | INFO: Root paths: - root path: /home/skyengine/anaconda/lib/python3.6/site-packages/skyrenderer - assets path: /dli/mount/assets - config path: /home/skyengine/anaconda/lib/python3.6/site-packages/skyrenderer/config - gpu sources path: /home/skyengine/anaconda/lib/python3.6/site-packages/skyrenderer/optix_sources/sources - cache path: /dli/mount/cache - ptx cache path: compiled_ptx/ptx - ocio path: ocio_configs/aces_1.2/config.ocio 2025-02-14 12:49:06,367 | skyrenderer.utils.time_measurement | INFO: Setup time: 5.77 seconds 2025-02-14 12:49:09,106 | skyrenderer.utils.time_measurement | INFO: Context update time: 2.74 seconds 2025-02-14 12:49:10,606 | skyrenderer.utils.time_measurement | INFO: Key points calculation time: 0 ms 2025-02-14 12:49:10,607 | skyrenderer.utils.time_measurement | INFO: Render time: 1.50 seconds
Add a Denoiser step
We define a new render chain with two steps:
- predefined scene composer's visible light render step
- Denoiser postprocess step
Denoiser has a single parameter called blend. The result of this denoise step is a linear interpolation
between denoised image and raw image:
$final image = blend \times raw image + (1 - blend) \times denoised image$
from skyrenderer.render_chain import Denoiser
denoiser_step = Denoiser(
scene_composer.renderer_context,
parameter_provider=Denoiser.create_parameter_provider(scene_composer.renderer_context, blend=0),
)
scene_composer.renderer_context.define_render_chain(
RenderChain(
render_steps=[scene_composer.visible_light_render_step, denoiser_step],
width=1600,
height=1000,
),
)
scene_composer.visualize()
2025-02-14 12:49:11,271 | skyrenderer.utils.time_measurement | INFO: Setup time: 70 ms 2025-02-14 12:49:14,374 | skyrenderer.utils.time_measurement | INFO: Context update time: 3.10 seconds 2025-02-14 12:49:16,193 | skyrenderer.utils.time_measurement | INFO: Key points calculation time: 0 ms 2025-02-14 12:49:16,194 | skyrenderer.utils.time_measurement | INFO: Render time: 1.82 seconds
Summary
In this section you have learnt:
- Denoiser postprocess step must be added after visible light render step.
- Denoiser greatly reduces the path tracing noise.
- The blend parameter act as a weight between denoised and raw image (0 - fully denoised image, 1 - raw image).