Using "absolute world position" as (part of the) input for the opacity on a translucent material causes the translucency shadow cast from particles and meshes with that material to only be visible from certain positions

Version 4.12.2

Using the “absolute world” position node in the material editor as input or part of the input causes the dynamic volumetric translucent shadows cast by a directional light from either a particle or mesh to cut away when in certain positions.

I tested in an empty project using two cubes, one scaled to double the size with the shadow of the small one cast on the big one and a single directional light shining along the X axis.
After creating a simple translucent material with opacity 1 (which behaved acceptably though still flickered on occasion), I used the world position node, unmasked ‘B’ (Z-coordinate) and plugged that into the opacity.
Looking from certain angles and distances causes the shadow to disappear.
Also while smaller cube was below the Z plane and thus invisible it was still casting a shadow.

Changing the material to masked and plugging the ‘B’ from the world position node in the opacity mask behaved as expected.

Hey Bosoft,

Can you provide me with some screenshots so I can visualize the issue you are reporting on my end?

It sounds like you are not compensating for the WPO shadowing or that you have a bounds scale issue since you mention flickering, but is hard to tell.

Generally when providing repro steps, we ask users to try and simplify their explanations and narrow it down to a handful of steps for a minimal test case scenario. Also, when dealing with rendering issues like the one you are reporting, providing images of an issue can help explain more often than not, the issue that is occurring.

Let me know if you have further questions or need additional assistance.

Thank you,

Here are some screenshots.

The masked material seen from directly behind and behind and below.
And the same for the translucent material.

static shadows were disabled in the project settings on the light and on the mesh.

The translucent material casts a full shadow while only partially visible and when moving below the mesh the shadow slowly disappears horizontally. I’ve moved far enough to leave a small sliver of shadow still visible, but any further down and it disappears completely.

The only difference in the material is the masked/translucent setting.

For some reason my viewport is not showing the same results. The material set up is pretty simple and straight forward, so I am curious as to what could be occurring on my end, or if you might have left out a step?

From your screenshots it looks like you might just need to either increase the Cascaded Shadow Map’s dynamic shadow distance setting, or try increasing the ‘Bounds Scale’ of the cube mesh casting the shadow.

If you are still having issues, could you provide me with the test project you are using so I can have a look at it on my end?

Thank you,

dynamic shadow distance does nothing, it defaults to 0 and changing it makes no difference at all to the shadow.

Increasing the bounds scale made the shadow lighter and disappear faster.

There is also no problem at all if world position is not connected to opacity and both of the above settings wouldn’t be affected by that, right?

The project is simply a blank slate with the light, cubes and material. I could share it but it’s almost 700 Mb.

I neglected to say that only the smaller cube has the translucent material and that this is on a gtx 970, in case that makes a difference.

So what you are seeing is not actually a bug, but expected when combining a World Position mask with Volumetric Translucent Shadows. As explained in the tooltip setting, Volumetric translucent shadows are useful for primitives with smoothly changing opacity like particles representing a volume, but have artifacts when used on highly opaque surfaces.

Lit translucency gets most of its lighting through a series of cascaded volume textures oriented around the view frustum. This allows lighting to be known in a single forward pass for any point inside the volumes, but has the downside that the volume texture is fairly low resolution, and can only cover a limited depth range from the viewer.

Shadowed direct lighting from all movable light types is injected into the translucency lighting volume.

The volume is configured through cvars that can be set differently based on the scalability level:

  • r.TranslucencyLightingVolumeDim, which defaults to 64. Raising this by a factor of 2 increases the cost to light volume by a factor of 8.

  • r.TranslucencyLightingVolumeInnerDistance, which defaults to 1500. Raising this increases lighting volume coverage but reduces effective resolution.

  • r.TranslucencyLightingVolumeOuterDistance, which defaults to 5000. Raising this increases lighting volume coverage but reduces effective resolution.

All of these combine to make Volumetric Translucent Shadows function. This is why you do not have the same issues when setting the material to masked. This is simply a limitation of volumetric translucent shadow casting.

Thank you,