Download

How to prevent world position offsets in materials from distorting meshes?

I had followed a tutorial for interactive grass, and wanted to add some other foliage that reacts to the player (starting with flowers). However I noticed that if I apply the same material to a simple flower mesh with a top-projected texture (shown below; all flower vertices have a vertex weight of 1) for the base color and opacity mask of the material (compared to the solid color of the triangular plane grass blades), walking over the flowers will cause certain vertices to be rotated much more than their neighbors (also shown below). This causes the texture to be stretched dramatically. I experimented with putting the texture on a small area of a large triangular plane, and it still gets distorted. Distortion also occurs with simple grass wind and other foliage wind techniques, but is not noticeable.

QUESTION:
How do I set up this flower to behave like the grass without distorting the mesh/texture? Is it possible to reconcile this grass material for use on things other than a solid color triangular plane?

Annotation 2020-05-31 094230.jpg

Did you manage to find an answer for that? I’m new to Unreal and am trying to go through that same tutorial. :stuck_out_tongue: I’m stuck because I can’t find the MF_GetProjectonUVs or MF_MaskUV0-1 nodes…

I wasn’t able to find an answer unfortunately. Posting here was my last resort. Maybe I need to find a forum that’s a little more… active.

Or just wait for the right person to pass by.

Technically no. You cannot use the same way for flowers.
practically yes… With the help of vertex paint and a ton of work.

You paint your flower mesh properly with at least 2 colors. One for what the wind affects that fades from white at the top to 0 at the bottom. Anything colored in 0 will not be affected by the wind.
And the other color to things that need to distort or move uniformly.

Within the material you can use both masks to isolate what would be affected by the WPO or not.
generally material solutions on flowers do Not look pretty. but if you combine the 2 techniques they can still be passable.

The theory is simple, if the object is painted with the second vertrx color you shift All the vertices relative to the normal between character position and themselves (absolute world position). You just translate those without any rotation (or very minimal)
Additionally, you can layer on the translation down the line using the other vertex colors thats used for wind.

When that fails or doesn’t give you the result you need, you can have a look at something like my plugin for foliage. Dynofoliage. It works with skeletal meshes and PHAT assets so it is definitely more accurate then the material method can be without Major work…