Some days ago, I needed to find a way to iterate through an atlas of textures in a UE4 material: I wanted to apply this to some decals that I was spawning always together.
So I setup this material which allows me to iterate through an atlas and pick a texture from it, and I would like to share it with you.
The setup is really basic
Ending and starting point simply define two point on the UV space. For example let’s use this atlas
Starting point is basically the U and V starting points, so in this case is 0,0. The ending point is 0.5, 0.5 so it will take everything included between U 0 – 0.5 and V 0 – 0.5.
This has a bleeding issue: it’s taking a pixel row from the adiacent texture horizontally and vertically.
I’ll try to solve it soon, however since I am using it on decals (which have 0 opacity on borders) this issue is not giving me problem at all, since even if any pixel is taken from other textures it would be a transparent one.