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:
#if USE_INSTANCING’
to
'#if USE_INSTANCING || USE_INSTANCE_CULLING

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: )