Godot Version
4.3.stable
Question
An idea for more efficient material and texture usage - am I making a mistake?
I’m starting a larger project and I want to target older machines. In previous projects I’ve found that some of my bottlenecks were around managing a large number of materials and having many different textures associated with each material - having to constantly swap around lots of small textures and making it harder to reduce draw calls.
This time around, I want to use a handful of big(ish) textures and really minimise the number of materials. In theory, instead of a model having a few textures all to itself with its UV’s spanning its whole size, I could set the UV’s to only have a small section of a bigger texture that gets shared between as many meshes as makes sense (grouping all of the models in an area that have a similar material profile) and giving them one or two big texture files to share.
the biggest problem with this is that there are only so many channels to go around (most of the material properties want to use some combination of RGB and A). I had the idea to split the texture into two regions and separate out the different material properties by UV1/UV2, but it seems like almost none of the properties can even use UV2.
So here’s the idea. Seeing how these materials are almost all going to use albedo and normals anyway, it MIGHT work out to use the ‘detail’ property, which lets you use albedo and normals in UV2, and then mask out the entire model, so the ‘detail’ makes up the entirety of the models albedo/normals, store them both in two RGBA8 textures only taking up one half of the texture, put my AO map in the spare alpha channel, and then use the other half of the textures as UV1 coordinates for the rest of the material propeties I want (rim/clearcoat/backlighting/metal/roughness/whatever).
Its not quite as good as putting everything into one giant texture (like is often done in AAA) but i feel like it could be a step in the right direction. I also feel like i could be hopelessly naive. would there be a significant performance cost to using the detail property for my albedo/normals like this? I feel like this should reduce cache misses as well, but there could be any number of reasons this is a bad idea im not thinking of. Although i will say building a script to stitch a bunch of textures together and shuffle the UV coordinates around in the editor sounds kinda fun.
Is this a bad idea?