• Shader

Translucent shader

By: SKY ENGINE AI
scroll down ↓to find out moretranslucent-shader_2_resourcesTutorial

TranslucentShader

In this tutorial, you’ll get familiar with TranslucentShader, a specialized shader for semi-opaque
surfaces that allows parts of light rays to pass through an object’s volume in a scattered direction. This
phenomenon is common in materials like frosted glass, thin fabrics, foliage or even jelly.

Agenda:

  • Translucent shading model
  • TranslucentShader basic usage

Scene setup

Let's use a custom scene composer to set up the scene.

    from skyrenderer.cases.utils import TranslucentGummySceneComposer
    scene_composer = TranslucentGummySceneComposer(antialiasing_level=512)
    scene_composer.setup_scene()
    scene_composer.visualize()
translucent-shader_1_resourcesTutorial
2025-12-11 15:39:40,182 | skyrenderer.scene.renderer_context |  INFO: Root paths:
- root path: /dli/skyenvironment/content-marketing/skyrenderer/skyrenderer
- assets path: /dli/mount/assets
- config path: /dli/skyenvironment/content-marketing/skyrenderer/skyrenderer/config
- gpu sources path: /dli/skyenvironment/content-marketing/skyrenderer/skyrenderer/optix_sources/sources
- cache path: /dli/mount/cache
- ptx cache path: compiled_ptx/ptx
- ocio path: ocio_configs

2025-12-11 15:39:40,402 | skyrenderer.basic_types.provider.unit_providers.substance_texture_provider |  WARNING: Unable to map purpose diffuse. Map will be parsed with legacy system.
	Purpose not present in ['ambientocclusion', 'basecolor', 'coatweight', 'coatroughness', 'emissive', 'height', 'metallic', 'normal', 'opacity', 'refractioncolor', 'roughness', 'specular', 'scattering', 'scatteringcolor', 'visibility', 'texturesemanticmap', 'any', 'mask', 'spectralid']
	See: Texture and substance convention for more details. Remember, purpose mapping is case insensitive. 
	Parsed purpose : diffuse_map

2025-12-11 15:39:40,403 | skyrenderer.basic_types.provider.unit_providers.substance_texture_provider |  WARNING: Unable to map purpose glossiness. Map will be parsed with legacy system.
	Purpose not present in ['ambientocclusion', 'basecolor', 'coatweight', 'coatroughness', 'emissive', 'height', 'metallic', 'normal', 'opacity', 'refractioncolor', 'roughness', 'specular', 'scattering', 'scatteringcolor', 'visibility', 'texturesemanticmap', 'any', 'mask', 'spectralid']
	See: Texture and substance convention for more details. Remember, purpose mapping is case insensitive. 
	Parsed purpose : glossiness_map

2025-12-11 15:39:40,406 | skyrenderer.scene.renderer_context |  WARNING: Light with light_id=point_LIGHT_NUL already exists in the scene and will be replace with a new one.There can only be a single light for a single node.

2025-12-11 15:39:40,495 | skyrenderer.utils.time_measurement |  INFO: Setup time: 87 ms

2025-12-11 15:39:43,661 | skyrenderer.utils.time_measurement |  INFO: Context update time: 3.17 seconds

2025-12-11 15:40:37,436 | skyrenderer.utils.time_measurement |  INFO: Key points calculation time: 0 ms

2025-12-11 15:40:37,438 | skyrenderer.utils.time_measurement |  INFO: Render time: 53.78 seconds

Translucent shading model

Translucency is the effect of partially transmitting light through an object’s volume. Typically, it refers to the
model where light scatters as it passes though, creating soft shadows and color bleeding effects on the surface.

Our TranslucentShader is designed similarly to SkinShader as it also uses Subsurface Scattering (SSS) Random Walk
implementation to further enhance the effect of scattering the light upon entering the object's volume.
Additionally, part of the rays can be transmitted through the object, in order to add glass-like semi-transparent
appearance to the object. That way, unlike SkinShader, it is possible to simulate jelly objects, clear irregular
coating etc.
TranslucentShader is based on Physically Based Rendering with Subsurface Scattering and ray
transmission capabilities, hence it is suitable for thick translucent objects, like milk glass block, jelly or
teeth.

TranslucentShader basic usage

Let's create a Material Definition using TranslucentShader and assign this material to the gummy bear geometry.
To assign the material, we will use RendererContext's set_material_definition() method.
In order to check how different parameters affects TranslucentShader appearance, see
SHADER_TranslucentShaderParameters tutorial.

    from skyrenderer.basic_types.procedure.shader.basic_shaders import TranslucentShader
    from skyrenderer.scene.scene_layout.layout_elements_definitions import MaterialDefinition
    translucent_shader = TranslucentShader(scene_composer.renderer_context)
    translucent_parameter_provider = TranslucentShader.create_parameter_provider(
        scene_composer.renderer_context,
        base_color=(0, 0.9, 0.1),
        ss_base_color=(0.4, 1.0, 0),
        ss_radius=0.1,
        ss_gain=0.5,
        translucency=0.1,
        specular_gain=0.5,
    )
    translucent_material_definition = MaterialDefinition(
        shader=translucent_shader, parameter_set=translucent_parameter_provider
    )
    scene_composer.renderer_context.set_material_definition(
        node_name="gummy_bear_GEO", material_definition=translucent_material_definition
    )
    scene_composer.visualize()
translucent-shader_2_resourcesTutorial
2025-12-11 15:40:37,939 | skyrenderer.utils.time_measurement |  INFO: Setup time: 190 ms

2025-12-11 15:40:40,936 | skyrenderer.utils.time_measurement |  INFO: Context update time: 2.99 seconds

2025-12-11 15:41:57,100 | skyrenderer.utils.time_measurement |  INFO: Key points calculation time: 0 ms

2025-12-11 15:41:57,102 | skyrenderer.utils.time_measurement |  INFO: Render time: 76.16 seconds

Notice how rays coming from the light source located behind the gummy bear are now affecting surroundings,
creating color bleeding effect on nearby objects.
Light rays are passing through the gummy bear and carry the green color of the jelly onto the ground and cube.

Summary

In this section you have learnt:

  • Translucent shading model is used for semi-opaque thick objects, like milk glass, jelly.
  • TranslucentShader is defined in the same way as any other procedure.