Course contentsShow
← Unreal Engine Game Development
Lesson 525 of 8807. Visual Fidelity and RenderingFree lesson

Crafting Volumetric and Particle Shaders

Design unique shaders for volumetric fog and particle systems to achieve consistent visual styling across translucent and additive rendering passes.

In this lesson, you will learn how to unify the visual language of your game by synchronizing volumetric fog materials and particle shaders to ensure consistent light interaction across translucent rendering passes.

Bridging the Gap Between Fog and Particles

When working with translucent effects, a common pitfall is the visual "disconnect" between your world-space Volumetric Fog and local-space Particle Systems. To achieve a cohesive style, both must react to the scene’s lighting environment using the same mathematical principles—specifically regarding how they handle light absorption and scattering.

The Unified Lighting Approach

Whether you are crafting a cloud bank in the Volumetric Fog or a dust mote in a Cascade or Niagara system, the goal is to define how the material density interacts with the SceneColor and LightVector.

In your Material Graph for particles, avoid using simple Unlit additive materials. Instead, utilize the Particle Color node multiplied by a light-dependent calculation to ensure your particles respect the same Ambient Occlusion and Sky Light logic you implemented in your Lumen setup. For Volumetric materials, ensure your Extinction parameter is mapped to the same density noise patterns used in your particle emitters.

Practical Implementation: Distance-Based Fade

To make particles feel like they truly "belong" to the volumetric fog, use a CameraDepthFade combined with a SceneDepth check. This ensures that as a particle approaches a dense volumetric fog volume, its opacity blends seamlessly rather than creating a hard cut-off.

// Example: Basic density scaling for consistent volumetric look
float3 LightingDensity = (LightColor * Attenuation) * DensityNoise;
float FinalOpacity = saturate(ParticleAlpha * SceneDepthFade);
return LightingDensity * FinalOpacity;

By passing a common "Global Density" scalar parameter via a Dynamic Material Instance, you can dynamically shift the thickness of both your fog and your particles simultaneously during weather transitions. This creates a synchronized visual fidelity where light scatters through your particles with the same intensity and color tint as the surrounding volumetric atmosphere.

Key Takeaway: Achieve visual consistency by driving the density and light-scattering logic of your particles and volumetric fog through shared material parameters, ensuring they react identically to the scene’s lighting environment.