Download

Help w/Texture Resource Effeciency

The following question arose from this post we’ve not received an answer from yet:

Our game will be running on iOS/Android. It was suggested that we separate out all of our UI elements into separate textures. I thought that textures must be in (power of 2 sizes) such as 128x128, 256x256, 512x512, etc. Most of our UI images will be very distinct sizes. I feel as though we are wasting texture space all over the place if we have to put each in its own size with emptiness surrounding most of it. That is why I was wondering if it would be more efficient to place multiple UI images within a single larger (power of 2) texture. Or am I wrong in that we can have irregular sized texture images such as 128x16, etc?? What do the developers at Epic recommend? This seems to be a very common scenario and yet I’ve not found any documentation on the matter.

Much appreciated and thanks!
-jeff

I am no expert on rendering, but I don’t think you need power of two, unless you want mipmaps…

You don’t need power of two for UI, since you don’t want mipmaps on UI (looks terrible). However, PVRTC can only compress power-of-two images so your UI images won’t be compressed. So, for large images you’re better off using power of two sizes to save VRAM (just remember to disable mipmap generation to avoid blurriness). For small images, specially for stuff like UI skin elements (button boxes, borders, etc.) you’re better off disabling compression, since PVRTC is very aggressive on small images.

Also, power-of-two doesn’t mean “square”. You can have 128x16 textures and they can be compressed normally.

It can be more efficient to put a group of textures into one larger texture (that has a power of 2). But only if these textures are used simultaneously often. (so in the case of a UI this could make sense). These are called a ‘Texture Atlas’. The idea being, the game loads the large texture into memory, then using coordinates you specify, you can show specific parts of the texture for your sprite, and since everything is on one texture its more efficient then loading all the textures one by one. However, I don’t know or think Unreal has support for Texture Atlases, it looks like Paper2d will for Sprites, but that won’t help you much if your using UMG. so I think someone else will need to come in here and comment on that.

What would be awesome is if unreal had a tool for automatic texture at atlasing like SpriteKit for iOS does.

But you can not use texture atlas easliy with UMG … if you can, please show me how !