← Back to Blogs
HN Story

Implementing Colored Shadow Penumbra in Unreal Engine 5

May 9, 2026

Implementing Colored Shadow Penumbra in Unreal Engine 5

In high-end real-time rendering, the transition between light and shadow—the penumbra—is often a simple linear gradient. While physically plausible in many scenarios, this can sometimes feel sterile or lack the artistic "punch" found in stylized cinematography or specific natural phenomena. The "Colored Shadow Penumbra" (or Colored Shadow Terminator) effect addresses this by adding saturation to the transition region, creating a more vibrant and visually interesting edge where light meets shadow.

This technique, inspired by the work of Romain Durand and documented in theory by Shahriar Shahrabi, focuses on manipulating the surface color specifically within the penumbra to simulate a more saturated glow or light bleed.

Technical Implementation in UE5

Rather than implementing this as a post-processing effect—which often requires guessing light/shadow values and can be problematic with dynamic systems like Lumen or day/night cycles—this approach involves editing the Engine Shaders directly. This ensures the effect works across all light types and remains computationally cheap.

Implementation for Substrate

For users utilizing the Substrate framework, the modification occurs in Engine\Shaders\Private\Substrate\SubstrateDeferredLighting.ush.

Locate the line (approximately line 190 in UE 5.7) containing: float3 SpecularLuminance = BSDFEvaluate.IntegratedSpecularValue * LightData.SpecularScale;

Immediately following this, insert the following code block:

// Colored shadow penumbra - Start
const float PenumbraSaturation = 4.0f; // Configure this to your liking (1.0 means no change)

float3 LuminanceFactors = float3(0.3f, 0.59f, 0.11f); // Luminance factor for desaturation
float3 PenumbraColor = dot(DiffuseLuminance, LuminanceFactors); // Desaturate
PenumbraColor = lerp(PenumbraColor, DiffuseLuminance, PenumbraSaturation); // Apply saturation
DiffuseLuminance = lerp(DiffuseLuminance, PenumbraColor, 1.0f - BSDFShadowTerms.SurfaceShadow); // Blend
// Colored shadow penumbra - End

Implementation for Standard Deferred Lighting

For those not using Substrate, the edit is made in Engine\Shaders\Private\DeferredLightPixelShaders.usf.

Find the line (approximately line 397 in UE 5.7) containing: OutColor += Radiance;

Insert the following snippet immediately after:

// Colored shadow penumbra - Start
const float PenumbraSaturation = 4.0f; // configure this to your liking (1.0 means no change)

float3 LuminanceFactors = float3(0.3f, 0.59f, 0.11f); // Luminance factor for desaturation
float3 PenumbraColor = dot(OutColor.xyz, LuminanceFactors); // Desaturate
PenumbraColor = lerp(PenumbraColor, OutColor.xyz, PenumbraSaturation); // Apply saturation
OutColor.xyz = lerp(OutColor.xyz, PenumbraColor, 1.0f - SurfaceShadow); // Blend
// Colored shadow penumbra - End

After saving the files, restart the shader compilation in Unreal Engine using Ctrl + Shift + ..

Analysis and Trade-offs

This implementation offers several advantages andH disadvantages that developers should consider:

Pros

  • Consistency: Works with all light types and avoids the "guessing game" associated with post-process solutions.
  • Performance: The implementation is extremely lightweight and adds negligible overhead to the pixel shader.
  • Compatibility: Can be used with the Launcher version of the engine without needing to modify the engine source code itself.

Cons

  • Global Configuration: Saturation is configured globally across the board; it cannot be adjusted per light or per scene.
  • Requirement for Soft Shadows: The effect is only visible when wide penumbras are present.
  • Dynamic Only: This specific implementation only applies to dynamic lights, not baked lighting.
  • Material Dependency: Because the effect relies on increasing saturation, it will have no visible impact on grayscale or already fully-saturated surfaces.

Theoretical Context and Discussion

While the implementation is a practical "hack," the physical basis of the effect is a point of discussion among technical artists. Some suggest it mimics the way certain materials "glow" under intense illumination, where the light bleeding from the illuminated part of the surface into the shadowed part is more saturated than the reflected light itself.

As noted by community members in the discussion of this technique:

"Some things will ‘glow’ when strongly illuminated, and the glow is more colored than the reflected light, so if the illumination has a hard edge then the penumbra can end up saturated by the more strongly illuminated part’s glow."

This suggests that while the effect may be more of a stylistic choice than a strict physical simulation, it serves as a powerful tool for adding visual depth and "bloom" to shadow transitions, provided the PenumbraSaturation value is tuned carefully to avoid an overly artificial look.

References

HN Stories