Adding variance to Flipbook animation - impossible without glitches?

Hey, I have a simple (4 frames) flipbook animation of a branch with moving leaves. I’ve created a setup that plays this back and forth and it works:

… But as you can see, it doesn’t look natural (all the leaves are moving using the same sine value). So I’ve thought about adding some variance by using perlin noise like that:


… And it works really well, but with visible artifacts:

I’ve tried many things to make them disappear, but without luck. The only thing that helped is the ‘Dither Opacity Mask’ checkbox in the material - it minimizes the artifacts, but they’re still visible.

Is there a way to fix this? Or maybe add animation variance in some other way? I’ve spent almost entire day trying to add variance to this animation and now I feel like my brain just turned into scrambled eggs :frowning:
I’ve also tried masking the perlin noise by the leaf opacity mask - but this way the artifacts still appear on the un-masked part.
… And I’ve also tried adding variance by using world position, but this gives the same effect, just with differently shaped artifacts.

… Here is my little test project (2MB) with this material and test plane:

Update: I’ve just discovered the SubUV Function, maybe it will behave differently, but I’m still figuring out how to use it.
Update2: … OK, same artifacts with the SUbUV Function, unfortunately.

You will need to change the function inputs to specify MipLevel. That means changing both the bool and the mip inputs. When different parts of the same surface read different frames of the subUV, the graphics hardware sees a large change in UV tiling and assume there must be a very blurry sample there.

A better solution would be to change the interior texture samples to user Derivative sampling mode and pass in the DDX,DDY from the UVs.

Thank you very much, I’ve changed the texture samples MipValueMode and it fixed the artifacts. By the way, plugging in the DDX and DDY (Derivative mode) resulted in blurry texture and jagged edges, but setting it to ‘MipLevel (absolute, 0 is full resolution)’ fixed it.

To plug in DDX and DDY, you would need to make sure to use UVs at the proper scale that the flipbook is sampled at. For example, if the flipbook layout was 8x8 frames you would do UV / (8,8) first.

Oh, that did the trick - I guess that plugging in the DDX & DDY is better than just selecting the ‘MipLevel (absolute, 0 is full resolution)’, because its tooltip says that it disables anisotropic filtering :slight_smile: Thanks again!