How to iterate atlas textures in UE4

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

01

Ending and starting point simply define two point on the UV space. For example let’s use this atlas

AtlasTest

02.PNG

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.

03.PNG

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.

 

Bye!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s