After packing the rest of my textures I’m left with one ambient occlusion map. I’ve converted it from RGB to Grayscale in Photoshop and reimported it in an attempt to save a little bit of texture memory. The RGB version is 4MB and the Grayscale one is 1mb on disk.
When looking at the texture in the content browser the RGB one has a resource size of 683KB and the Grayscale one is 1365KB.
Is the resource size in the texture viewer representative of the memory use in game?
color and greyscale doesn’t affect it
re-save all your images as 24bit if they aren’t meant to have any alpha channel
RGB = 24 bit
RGBA = 32 bit
the extra channel costs more to resources and sizes
First, when you import a texture, it will be compressed. If it’s RGB, it will likely be compressed to 4 bits per pixel. However, grayscale textures may be saved as 8 bits per pixel – either as “straight” encoding, or using 4+4 bit compressed encoding.
Second, yes, the resource viewer size is how much it will use in game.
Third, 1 MB isn’t a lot on modern cards. On even the lowest-end integrated graphics cards, you’ll easily have 2000 MB of available texture memory. Depending on how many of these you’re making, you may not need to change much.
Fourth, if you don’t want your RGB texture to be compressed, you can double-click the texture and edit its compression mode in the asset/import settings, and reimport it.
Why do you need to reimport the texture? I thought the compression mode just is a setting for when the engine is loading that texture. I saw this setting mentioned in a Book and also a tutorial from epic and neither one said to reimport the texture.
I’d the engine wrote the compression onto the original file, changing compression won’t actually change the file anymore.
Re-importing is thereof 100% always safer. You can’t get stuck with a file that’s been compressed and lost definition.
Thanks, I’'ll completely reimport and see what happens. It was just strange to me that the tiny grayscale image ended up bigger than the RGB one.
Because my ambient occlusion map is black and white. By importing a Grayscale ambient occlusion map its cuts the file size down by 75%.
Yeah I know all of that but I appreciate you writing it.
I was just curious to know why my Grayscale texture is double the size of my RGB texture in the engine after compression without any alpha maps on either.
The images are the same resolution too.
The RGB of course has Red Green and Blue channels and the Grayscale only has Grey.
The internal format for the RGB texture, by default, is not actually RGB, but is instead DXT1 compression, with 64 bits per 4x4 block of pixel (or 4 bits per pixel.)
The internal format for the grayscale texture, by default, is a straight 8 bits per pixel grayscale format.
Hence, the RGB input ends up being smaller at runtime, with default settings. In fact, exactly half.
Note that there’s also overhead for mip maps, and for the general file header/asset information, although those are generally smaller than the main payload image.
Thanks so much for explaining this!