Download

Popping glitches of black spots appearing on Foliage

Hi,
In my foliage I have a “wind sway” shader which uses “rotateaboutaxis” node to sway the foliage with the wind using world position offset. This works pretty well but after I add this to my shader, I get weird popping glitches of dark spots on the foliage. When I disconnect the wind sway nodes, the glitches are gone.
I’m on ue5, but i had the same problem on ue4 as well. any idea on how to solve this would be greatly appreciated!
here’s a video showing the glitch:

this is what my mesh looks like, no duplicate vertices:

a freeze frame of the glitch (don’t mind the highlighted area) :

here’s the guilty nodes:

Only thing I can thing of is that the object pivot is not in the correct spot.

Pat yourself on the back for asking help and providing near everything needed in order for us to try and help though.
Probably first post in this forum I have ever seen where this has occurred…

Other thing I can think of.
Set the LOD group to foliage.
and disable DFAO on it if it’s on.

Tips:
instead of the max height mask. Vertex paint and use the mask to apply the wind.
Costs less. you get more control. and on the very off chance the calculations are at fault, you just eliminated the whole set of nodes…
(literally plug a single channel from vertex pain into the multiply).

Cheers :smiley:
-What would be the correct spot for the pivot? You can see the pivot point of the mesh in the screenshots from Blender, tiny orange dot at the bottom of the object.


-Just set the LOD group to foliage, no change
-I use DFAO for the whole project, do you mean disable it as a whole?

-You’re right about using vertex paint instead of height mask, I never considered that because I already use the vertex paint to paint the tips of the leaves for another “wind rustle” effect, but haven’t thought of using R and G channels!
Thank you for your answer!

That’s where I think it should be given the math - but is it actually there in engine?
And further, is it being considered by foliage or is it aggregating it?
Actor Position WS may be a better node. (depends on what the object pivot function is using).

No, just for the mesh.
You can set it not to generate distance fields, which will cause the DFAO shadows not to be created on it.

-Checked in-engine static mesh inspenctor, pivot seems to be at the right location:

-How do I check if it’s being considered by foliage? I don’t know how to go about that.

-Tried replacing object pivot point node with actor position ws, here is the result with the foliage, pretty messed up (highly possible that i’m using this wrong, never used this node before) :
Screenshot 2021-11-19 151918

-I can’t figure out a way to disable DFAO for a single mesh? The checkbox is already checked off, and it’s off on every mesh because it’s checked on in project settings globally, and as it says here in the tooltip, it’s ignored if it’s enabled in the project settings.

Sorry for being oblivious about this stuff, not very experienced with unreal.

Oh I forgot to mention, for some reason the glitching is happening rarely on instanced foliage objects, but it’s happening aggresively on regular static meshes. Same mesh, placed as a static mesh, glitching heavily.

Double click ObjectPivotPoint. See what is being used as the object pivot within it.
In your recent change. try adding a vertex interpolator node between actor position and the pivot point.

If the checkbox is unchecked the mesh doesn’t generate the required distance fields to cast a distance field based shadow. So that’s normally good enough.

Could be something with self shadowing.
Try the vertex interpolator node first.

I’ve tried adding the vertex interpolator node but here’s the result:

By the way, clicking inside the objectpivotpoint node gives me this, never knew this node was so simple (only the top part is used) :

By the way, are you sure about the Distance Fields checkbox thing? cause i have it enabled in the project settings and I’m using DFAO, but none of the hundreds of assets has the box checked. Am I not actually using DFAO lol?

100% sure? No…
I messed with the source code to get that going that way in .22 or something similar.

The other work-around is to set the custom distance field replacement mesh to something with a very small 3vert mesh.

I’m not sure why it’s being a pain.

Do this. click the background of the material to access the properties. Add a custom UV.
plug Actor Position into the UV.
use the CustomUV you added as the pivot point/replacement for actor location.

000 > transform position usually resolves to the position of the actor containing the meshes.
When foliage aggregates actors into groups this causes issues.

HOWEVER.
if you place a single mesh, this also means that the code you have should give you no artifacts at all.
In fact, since it probably doesn’t distort inside the material editor, you should expect that to be the same for the mesh if you place it in the scene.

So the next thing to try is to place a single mesh with the material at 0,0,0 to match the material panel rendering.
And the second thing is to move that mesh around to see if it generates the issue.
WHEN it generates the issue, it means that one of the calculations occurring on.with world position offset is wrong.

Screenshot 2021-11-21 163907
I did this but I can’t find a way to use customUV as an input in the shader editor? How do I call that?

Use the uv node, set the uv channel in its settings.