SpeedTree wind incorrect calculation on instanced meshes (foliage)

SpeedTree material node does not work correctly with instanced meshes (foliage). It calculates World Offset as if each tree is located in 0,0,0 World Coordinates. So if your SpeedTree is not in the center of the world, it will go crazy. On picture you can see red Tree is in 0,0,0 and blue Tree is 0,0,1500 - you can see how its trunk is bended like as if tree is growing from 0,0,0. With non-instanced meshes it works fine. So it has to be something to do with calculatin local position for instanced meshes.

Did you ever figure out how to solve this? I’m having the same issue

If you go into Engine / Plugins / Editor/ Shaders /Private /MaterialTemplate.ush line 1902 (or around there, you can also search for it), try changing:

It’ll be under ‘if USES_SPEEDTREE’ as a clue.
It seems to work on my version of UE 5, so hopefully it’ll work for everyone else (forever and ever until someone actually fixes it on the main branch :slight_smile: )

1 Like

Went and edited the MaterialTemplate.ush line 1902 and changed it as suggested.

I have an entire island using trees with SpeedTree. They were being very naughty (moving around… honestly, this would have been great in a horror story).

After rebuilding all the shaders (only over 6700 of them)… the result was: good. I need to look at some of the trees (nothing is moving), but I’m cautiously optimistic about the fix!