Using a megatexture

Kind of a weird use case, but we’re wondering if a Node Material could be created to use a single “megatexture” to populate a PBR Node material


We’re using KTX compression and for transparencies, we have to use DXT-5, which ends up a larger file size than the original PNG. Just as an experiment, we’re trying to see if it’s possible to combine the various maps into a single image and pack the channels to see if this actually loads faster.

If I were writing a custom shader, I could offset and scale the UVs in the sampler2D lookup. Is this possible using Node Materials?

*** Chalk this up to a crazy experiment.

Fun experiments but as the property of all channels might be different I wonder if that would work. Adding @PatrickRyan to the thread to provide feedback and @bghgary FYI

1 Like

@Alex_B, you can certainly use node material to pass the correct UVs to map the correct quadrant from your atlas. Here’s a quick sample that you can use to map a specific quadrant for a specific texture. This is using the upper right quadrant of the texture (with UV coordinates coming from the upper left corner 0-1).

There is one issue you will need to deal with here and that is color space. You are packing together textures with different color spaces as the base color texture is in gamma space while the ORM and normal are in linear space. When you are combining these using compression, you have to be careful about the compression algorithm you use because some lead to cross talk between the channels which is fine for a gamma space image, but incorrect for a linear space image that needs distinct values per channel like the normal map. If you have cross talk between the channels, your normal vectors will likely get screwed up with compression being determined across channels. Same thing would happen with a channel packed image. This is just something to be careful about. I would also check your pipeline to determine that there are no color space conversions happening just to make sure you know when you load the image what space each quadrant should be considered.

Hope this helps. Let me know if you have any questions.


This is great, thanks. If we realize any benefit from this approach I’ll definitely dig into addressing any color space issues.