• Postprocess

Light glow

By: SKY ENGINE AI
scroll down ↓to find out morelight-glow_3_resourcesTutorial

Light Glow

In this case we will present you Light Glow postprocess step.

Agenda:

  • Light Glow theory
  • Light Glow step usage

Scene setup

Let's use custom scene composer to set up the scene.
Scene consists of:

  • shaderball with stand - location: (0, 0, 2)
  • shaderball without stand - location: (0, 0, 0)
  • plane - location: (0, 0, 0)
  • camera - location: (4, 4, 4)
  • direction light - direction: (-1, -1, 0)
from skyrenderer.cases.utils import LightGlowSceneComposer from skyrenderer.render_chain import RenderChain scene_composer = LightGlowSceneComposer() scene_composer.setup_scene() scene_composer.renderer_context.define_render_chain( RenderChain( render_steps=[scene_composer.visible_light_render_step], width=1280, height=800, ), ) scene_composer.visualize()
light-glow_1_resourcesTutorial
2025-02-03 14:57:12,818 | skyrenderer.scene.renderer_context | INFO: Root paths: - root path: /dli/skyenvironment/skyrenderer/skyrenderer - assets path: /dli/mount/assets - config path: /dli/skyenvironment/skyrenderer/skyrenderer/config - gpu sources path: /dli/skyenvironment/skyrenderer/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-03 14:57:13,171 | skyalembic.archive_manager | WARNING: Loading not adapted alembic file 2025-02-03 14:57:13,258 | skyrenderer.utils.time_measurement | INFO: Setup time: 79 ms 2025-02-03 14:57:16,082 | skyrenderer.utils.time_measurement | INFO: Context update time: 2.82 seconds 2025-02-03 14:57:19,123 | skyrenderer.utils.time_measurement | INFO: Key points calculation time: 0 ms 2025-02-03 14:57:19,123 | skyrenderer.utils.time_measurement | INFO: Render time: 3.04 seconds

Light Glow theory

Light Glow is a visual effect that simulates the soft, ambient glow surrounding a light source. This effect is used to
represent both the direct light emission from a source, and the diffuse scattering of light through the atmosphere or other media.

Light Glow step usage

Before we add a Light Glow postprocess step, we need to specify material definition for our geometry.
We create an Emissive Shader parameter provider passing a renderer context and leaving other parameters as default.
Then we pass parameter provider to material definition and assign it to the geometry we choose.

Let's set red base color for the red sphere.

HINT: For more information about material definition, see: INTRO_Materials tutorial.
HINT: For more information about geometry definition, see: INTRO_Geometries tutorial.

from skyrenderer.scene.scene_layout.layout_elements_definitions import MaterialDefinition from skyrenderer.basic_types.procedure import EmissiveShader scene_composer.renderer_context.set_material_definition( "shaderball_GEO", MaterialDefinition( shader=EmissiveShader(scene_composer.renderer_context), parameter_set=EmissiveShader.create_parameter_provider( scene_composer.renderer_context, base_color=(1, 0, 0) ), ), )

We define a new render chain with two steps:

  • predefined scene composer's visible light render step
  • LightGlow postprocess step
from skyrenderer.render_chain import LightsGlowPostprocess light_glow = LightsGlowPostprocess(scene_composer.renderer_context) scene_composer.renderer_context.define_render_chain( RenderChain( render_steps=[scene_composer.visible_light_render_step, light_glow], width=1280, height=800, ), ) scene_composer.visualize()
light-glow_2_resourcesTutorial
2025-02-03 14:57:19,615 | skyrenderer.utils.time_measurement | INFO: Setup time: 65 ms 2025-02-03 14:57:22,607 | skyrenderer.utils.time_measurement | INFO: Context update time: 2.99 seconds 2025-02-03 14:57:23,691 | skyrenderer.utils.time_measurement | INFO: Key points calculation time: 0 ms 2025-02-03 14:57:23,692 | skyrenderer.utils.time_measurement | INFO: Render time: 1.08 seconds

We can add LightsGlowPostprocess step multiple times to strengthen the effect.

scene_composer.renderer_context.define_render_chain( RenderChain( render_steps=[scene_composer.visible_light_render_step, light_glow, light_glow, light_glow, light_glow], width=1280, height=800, ), ) scene_composer.visualize()
light-glow_3_resourcesTutorial
2025-02-03 14:57:24,182 | skyrenderer.utils.time_measurement | INFO: Setup time: 84 ms 2025-02-03 14:57:27,298 | skyrenderer.utils.time_measurement | INFO: Context update time: 3.12 seconds 2025-02-03 14:57:29,217 | skyrenderer.utils.time_measurement | INFO: Key points calculation time: 0 ms 2025-02-03 14:57:29,218 | skyrenderer.utils.time_measurement | INFO: Render time: 1.92 seconds

Summary

In this section you have learnt:

  • You need to cover a geometry with EmissiveShader material definition prior to setting the LightGlow render step.
  • LightGlow postprocess step must be added after visible right render step.
  • LightGlow simulates the soft, ambient glow surrounding a light source.