Foliage Actor Instance Pivot? Help with foliage wind material

Hey guys, hope someone can help me with this rather specific and tricky problem.

I’m trying to achieve a wind like effect on my foliage actors within the material. I’m using the “Rotate About Axis” node to achieve this simple nodding effect. (see above) Ideally I want all of my foliage to use this effect.
Here is what the “World Position Offset” of the material looks like

The only problem is, while using this function for foliage instanced actors, the pivot point of the “Rotate About Axis” node becomes the global foliage actor pivot… (see below) in other words, on an individual hand placed actor this effect works fine, however when using the foliage tool to “paint” foliage the effect breaks.

I imagine there may either be a simple fix for this that I’m overlooking, or no real way to fix this issue.

-Chris

You can get instance pivot location by transforming 0,0,0 from local to world in a vertex shader.

I tried this method and it resulted in the same problem occurring.

-Chris

Use the “object position” node instead of “actor position” for your pivot point.

Edit: As noted “object position” will rotate around the center of the mesh, for a rotation around the object origin use the “object pivot point” node instead.

This is really close!! Although this does work, it also adjusts the pivot from the actor pivot to the center of the actor.

Here is what that looks like (below)

I can probably solve this problem with some math, but if you know any simpler solutions please let me know. Thanks for the help!

-Chris

The simplest solution would be to either change the model in your 3D tool so that it starts at the origin or you can change it directly in Unreal for your static mesh with the “import translation” setting so that the origin is where you want it to be (you’ll have to reimport the mesh for it to take effect, I think).

Not sure I quite understand what you are asking me to do. The current Pivot of the mesh is also where I want it to rotate from, however the “Object Position” node ignores the pivot and instead uses the center mass of the object, adjusting the pivot has no effect. Again if I’m misunderstanding you let me know.

-Chris

Ah, sorry, you are right, in this case it’s simplest to use the object pivot point node (it’s just a transform of (0.0, 0.0, 0.0) from local to world space).

PERFECT! That worked like a charm, thanks so much witch-dev for the help really appreciated! I’ll add some more screen, for anyone in the future looking for the same solution.

-Chris

Here is how the final WORKING structure looks, for future reference.

-Chris

Unreal Engine 5.3 update:
This code in Material (in Shader) returns pivotPoint of mesh (manually placed single mesh) and mesh instance pivotPoint (if mesh instances are placed using Foliage tool, for example). Basically, it is compatible with UE5 Foliage tool.

1 Like

Thank you good sir. Just saved my day. I wonder why the usual “object pivot point” doesn’t work like this normaly.

1 Like