Simple question regarding Textures

Hey Everyone

Just have a real simple question i’m hoping someone can answer for me. I’m real new to unreal and just want to confirm something.

When I import a texture into unreal, and i right-click that texture in the content browser and choose Size Map, in the top right hand corner it allows me to choose the size to display.

What I want to know, is the Disk Size the actual size of that texture that will be included in the packaged game (android mobile for example)? I’m asking as the file on my computer is for example 400KB, but Size on Disk in Unreal says it’s 600KB.

So is Unreal basically taking a copy of my Texture I imported from my computer and putting it into the Project folder with a size of 600kb instead of 400kb?

My file is a basic 1024x1024 PNG which I use as a background image. I’m assuming Unreal processes the images differently which is why there is a size difference?

Also this same image and some others I have at the same size of 1024*1024 have a resource size of 700kb. Is that alot? I’m not sure how to reduce this further without reducing the texture size which i can’t do otherwise things look bad. I tried setting mipmaps to none and it brought it down to about 500kb, but not sure if that’s a good idea. It’s only a static background. It’s basically a plane i have used a material on which is my background image.

I know I have alot of learning to do, but just wanted to get this question out of the way.

Thanks Heaps!

PNG isn’t format that GPU can handle. Texture are compressed using runtime compression that GPU can decode on the chip. S3 Texture Compression - Wikipedia

As far as I understand, UE supports use mip maping to display textures to avoid any lag in run time. Now, the textures you have on the disk is not mi mapped and when you import it to UE it adds all the Mip map as per its algorithm.
So you have a 1024x1024 texture which is 400kb on disk and then imports it to UE, now you have 1024x1024; 512x512; 256x256; 128x128; 64x64 and so on. That is why sometimes size is higher sometimes it reduces (may be due to compression)
This is my understanding as i have seen this happening while working in VRay, Redshift and other pre renders.
May be someone from Epic could clarify your doubt.
Hope this helps in some way
Cheers

Yeah, so, PNGs have more advanced deflating algorithms to drastically reduce the size of an image, but game textures need to decompress quickly and efficiently, so they use a different compression system that is not as effective. Also, mip-maps need to be generated, to improve memory headroom where the texture is not visible, so the one texture you import actually becomes up to 13 different textures in the engine. Basically, your texture needs to be converted to a less memory-efficient format so it can run faster and look better in a 3D engine.

UE4 will accept PNGs and JPGs and Targas as valid textures, but that’s not literally what’s going into the game. Typically textures will be converted to DXT5.

Thanks so much for the replies guys. Makes so much more sense now.

BTW - The Disk Size listed is NOT the package size. Package size is dependent on which Profile is used. These are determined by the settings in Device Profiles. E.g. ios might have a smaller max set than PC. AFAIK the Disk Size is the current max size used on disk for the asset by the editor.

Determining actual package size is difficult without packaging for the device.

From my knowledge of texturing and materials, PNG’s are just insane to use for a game. If you’re using them for transparency, just convert them to JPEG or Targa and use an Alpha/Opacity map to create transparency. Import as JPEG’s or Targa’s and just use other maps (if you can afford to) to create your material. I brought the PBR Guidebook, from Allegorithmic, and it explains in-depth about using materials and texture maps so maybe reading into it will give you a solution and further information on materials and textures in games. You can read part 1 here; The PBR Guide - Part 1 on Substance 3D Tutorials - Hope this helped :slight_smile:

1 Like

Don’t use JPEG(or other lossy compression formats) for texture at all. If you use lossy offline texture compression you get all the cons but none of the pros. When you import JPEG to UE4 its decoded and then recompressed to runtime format(dxt, astc, etc1…). Those JPEG artefacts can be quite visible with added DXT artefacts. Still the game package size is as big as with uncompressed BMP textures.

So what’s the best to use?

TGA is lossless and have independent alpha channel so we use it for everything.

It doesnt matter what format your textures in. They are compressed at the packaging stage for the final Game anyway.
It is advised to use a Lossless Format (PNG, TGA) as the Source and compress it according to your use.
For Grayscale Textures, I recommend using the “Alpha” Compression and not the “Default” Compression.
If you want to check out how much VRAM your texture uses within the Game, you can right click on it and open up “Size Map”. In the upper Right Corner of this Window is a button “Disk Size”, change it to “Memory Size” to see how much of your Memory (at runtime) this texture will use.
The Memory Size is affected by the Size and Compression.

PNG is bad idea for texture that contain alpha channel. If PNG texel alpha channel is zero then you will lose rgb data of that texel. TGA do not have this problem.