Strange material "Object Position" node behavior with PCG and foliage

I have made a foliage billboard material with a custom node, that makes two things:

  • calculates WPO to align a mesh to the camera, for this it uses nodes “Object Position”, “Camera Position” and “Absolute World Position”;
  • calculates angle between the mesh and the camera, for this it uses nodes “Object Position” and “Camera Position” (then baset on the angle I choose image from a texture atlas to draw the correct projection).

If I place a separate mesh with this material in my scene, it works correctly (so the custom node written corretly). But if I use this mesh in PCG or in a foliage object - WPO looks correctly, but the angle isn’t calculated correctly - it looks like the node “Object Position” instead of taking the coordinates of each instance, takes the same coordinates for every instance. As for WPO it takes the right coordinates, I think it has to do with the sequence of shader calculation in the engine, does anyone have any thoughts on this, any solutions?

Hi, which version of UE are you using?

The Object Position usually returns the whole ISM Components pivot point in the world.

If you’re using 5.0 or above, you can use the lower pin on that node which returns the actual instance position.

If you’re using UE4.27 or lower, you can calculate it by doing a “Transform” of a 0,0,0 Vector from Tangent Space to World Space

Hi, I’m using 5.3.

Elaborate on this please, the Object Position has only one pin.

Oh, I’m thinking of the “ObjectPivotPoint” node - which will do what you want I think.

1 Like

Thank you very much, it works!

1 Like

Its very helpful :+1:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.