Prevent Mesh/Ocean/Water (Single Water Layer) From Receiving Shadows

AssemblerJohn
Thu, 18 Sep 2025 09:43:53 +0000
Rendering

TL;DR;

#define DISABLE_FORWARD_DIRECTIONAL_LIGHT_SHADOW 1

Place this define in ‘BasePassPixelShader.usf’ at line 176 (outside the quality define)

Hello!

I would require to prevent an arbitrary object from RECEIVING a shadow. The object in cause is the SingleWaterLayer ocean, however that is not relevant. UE V5.5.4.

These will NOT be considered valid solutions:

1. Using VSMs (virtual shadow maps)

2. Using any form of raycasting

3. Modifying the engine r.Water.SingleLayer.DepthPrepass/ShadersSupportVSMFiltering/VSMFiltering=1 did NOT work

4. Using ‘Unlit’ color mode, let’s be serious

5. Disabling the main scene directional light is out of the question, it is required

I have tried:

1. Using Phase G (Anisotropy) to 1, does not work since the shadow is applied where roughness is larger than 0 too

2. Switching from SingleWaterLayer to Translucent, but the water looks bad, there is no specularity on it

I would like to implement a production-ready, rather than hobby/experimental solution.

My initial thought was to replicate the ‘Receive Decal’ option already present in the engine.

1. Have the custom depth-stencil pass enabled

2. Write a stencil value of 255 and enabling the depth pass

3. In the shadow combination UE shader disable the shadow addition if the stencil value is 255

4. Integrate the shader changes (copy-paste) without requiring an engine recompile

Notes:

float4 Radiance = GetDynamicLighting() inside ‘DeferredLightPixelShaders.usf’ does NOT handle water lighting/shadows

As per the example image, there is a very blocky/bad looking shadow on the water.

7 posts - 2 participants