UE4 material - tiling a flipbook texture?

Hi I was working on my rain material, and got into problems.

I imported and animated sprite texture and used flipbook node for it.
After applying the material, I thought the raindrops were too small/big and needs to be adjusted.
so, what I tried first was this:


but, it didn’t work. there were seams and speed was crushing.

my second try was this:


and same thing happened.

is there any way to adjust tiling with a texture already has a uv input with a flipbook node?

Multiply the input UVs, then apply a Frac on them, instead of multiplying the output UVs

1 Like

I keeps getting helps from you :slight_smile: thank you very much!
can you explain why adding frac solves this?

Sure :slight_smile: Frac leaves only the fractional part of a number. For example, if you provide:
2.9…3.0…3.1…3.2…3.3
it will return:
0.9…0.0…0.1…0.2…0.3.

This way, the previously multiplied UVs will be always 0-1 after frac. While it doesn’t matter for the regular texture sampler (it wraps UVs automatically), it makes a difference for the SubUV_Function / Flipbook node.

Using frac has one disadvantage - it breaks the continuity of the UVs between the 0.999 and 0.0. A texture sampler would most likely produce a blurred 2-pixel seam in such places. In other words, when frac on UVs is not needed, it’s better to avoid it - and let the texture sampler do the wrapping automatically. But that’s another, long story, about derivatives, DDX / DDY and such. :smile: