4.24 - 26 RT shadows ignoring world position shader

I’m having an issue with rt shadows for directional light where the shadows ignore the animated leaves on my trees, the leaves are animated using world position offset in the material.
What ends up happening is a weird look on the trees and static shadows on the floor.
Cascade shadows work perfectly but are more taxing on the hardware.

Screen shots wont help as this is only visible in motion.

So is there a way to make the directional light take these materials into account?


For raytracing, WPO has to be enabled per actor.

In your static mesh actor properties there is an option called “Evaluate World Position Offset”, enable it and it should work.

No idea how this will behave on foliage instances.

Hmm interesting, it works for single trees, but Im using foliage, any suggestions there?

2023 Update: There’s a much easier way to resolve this now, simply run the following command: r.RayTracing.Geometry.InstancedStaticMeshes.EvaluateWPO 1

Original Reply

Use actor foliage instead of static mesh foliage:

  1. Make a new blueprint class that inherits from static mesh actor
  2. Turn evaluate world position offset on in the static mesh component, set the mesh to your desired mesh
  3. Create an Actor Foliage class that uses your new class as its base class
  4. Use the actor foliage with the foliage tool

I’ve used this trick before in order to use settings that are typically unavailable to foliage, such as indirect distance field shadows. I tested it just a second ago and it works. Can’t vouch for the performance in dense scenes though. I have no suggestions otherwise, the documentation makes it seem like this is a hard limitation.

1 Like

■■■■, that is a great idea (I will need to try it to see if I can actually do it)
But I tried several times to use the distance field stuff and at the end I gave up.
Will try this.

What I posted works for raytraced shadows, don’t need to use distance fields (unless you want to)

I only brought it up as an example of how you can use actor foliage to get around the limitations of the regular foliage instances.

Got it to work!!
Fantastic man! Awesome, I will do some testing regarding performance and will post back.
Also, will probably use distance field indirect shadows as I had to create a shader-based AO to simulate it since it didnt work before. nice!!

Yes, this works! Thanks so much :slight_smile:

I’m on 4.27 and the hack with Actor Foliage works, BUT the performance is totally screwed. I droped from 60fps to just 8.

I’m a bit surprised that an issue of this magnitute doesn’t got more attention, or at least I didn’t notice it. It makes RT unuasable with slightly bigger landscaped.

That’s expected… the raytracing acceleration structure has to be rebuilt every frame for skinned/dynamic meshes which is insanely slow. There’s no solution to this. Unless you’re making a cinematic you should not be enabling WPO for raytracing on many objects in your scene, thats why it is disabled by default.

1 Like