RGBA or RGB and A in seperate textures?

Hi there! Regarding to optimization I’d like some more background info on the question if its better to keep a Colour texture and a mask texture separate or to combine them into a RGBA texture.
In which situation is it better to separate them and in which situation its not?
Because just looking at the statistics would suggest its better to keep them separate because it saves memory.
So instead of using a diffuse and a mask maybe use a diffuse and a texture including 3 masks?

If I look at the statistics window I see these entries for example:
RGBA (diffuse+mask) max dimension: 1024x1024 format: PF BC5 Fully Loaded Memory: 1,365 kb
RGB (Diffuse) max dimension: 1024x1024 format: PF DXT1 Fully Loaded Memory: 682 kb

Hi Esther,

There are a couple of things to keep in mind when going through this kind of optimization. Combining your Alpha’s into separate textures will add a texture lookup to your materials, and there might be some cross-reading between the RGB channels because of compression.

As far as workflow is concerned, you will need to manage your combined mask textures, which might complicate things a bit. By using a ComponentMask converted to dynamic parameter (right-click Convert to Parameter) you can specify which Alpha mask to use per-instance of a material.

Example:

I took a look at the memory cost for textures and you could save up to 1.8 megs for a 2048x2048 texture by moving it into a separate mask (you only safe anything if you combine it with two others of course, otherwise you’ll end up with the exact same cost) These are the results from some quick tests using DXT5, DXT1 and BC4 compression. The saving for your 1024 textures is even less.

My recommendation is to only go for this if you are starved for memory. It will impact your workflow and add some additional cost for texture look-ups from a separate texture, possibly bad quality from compressed masks and keeping track of your combined texture masks.

Cheers,

Tom

Thank you for the explenaition tom :slight_smile:
Is an extra texture lookup the same as a drawcall? How can texture lookups slow your processes down?

Texture lookups and Drawcalls add cost in different areas. The GPU is enormously parallel. To put it simply, an extra drawcall is an additional request from the CPU to GPU to render something. A texture lookup adds cost to the fragment/pixel shader which is a different area of the GPU.

Adding cost to one will not directly impact the other. They are handled by different parts of the (GPU) pipeline. Hope that helps clear things up!

  • Tom