My attempt at Tilable flipbooks in Unity (also some rain)

Hello :wave:, it has been a while

Untitled video - Made with Clipchamp (1)

I have been trying to create a tilable flipbook. Why? I thought it would be a neat way to dissolve or as a repeating noise, so I looked it up, but I didn’t find a resource for this (might have been a case of bad searching :sweat_smile: )

Anyway, here’s what I did.

I started with creating a flipbook function based on the index, but thanks to Unity’s UVs 0,0 being on the bottom left instead of the top left (not the same order as any normal flipbook:slightly_smiling_face:)

After that, I started to see how to make the flipbook tile, so I calculated the start and end positions in the UV cells so I can lerp between them through frac(UV * number of tiles), getting a gradient between 0 ->1


and simply use the resulted UVs to sample the texture … well, it would wor,k but it would result in a hard line between each cell

Well, a really simple solution that came up was to use gradient mip sampling instead of the standard (DDX & DDY), but still got the God forsaken line


So I tried to play with the import settings of the texture itself. Here are some things I found through experimentation

1- instead of the bilinear → point (no filter)
2- the texture shouldn’t be downscaled (I have been playing around, but raising the resolution of the texture fixed it )

That fixed it soooo yeah that’s it

I tried to break the tiling (works fine if it’s organic, no hard straight lines :sweat: )

sampled the texture multiple times at different rotations

Use any way to mask each layer. I used the built-in Voronoi noise

created another one for normals and getting the direction of the directional light to fake the catch highlights using the dot product

Hopefully someone found my ramblings useful

And please, if there is any other better way to do what I did, I would love to hear it :sweat_smile: since. I feel like it can be more optimized, but I am a big dumb dumb :sob:

1 Like