UnityGLTF
UnityGLTF copied to clipboard
Allocates More Texture Memory than Required for Samplers
Wanted to highlight and issue in texture sampler creation. The hierarchy of glTF is Material -> Textures -> (Sampler, Image)
Currently UnityGLTF creates Texture2D at the image creation level which necessitates a CPU copy of the texture in order to create different samples at the texture layer.
This can be improved by making it so that ConstructImage simply creates a CPU buffer (byte array or memorystream) and then ConstructTexture simply uses that to instantiate textures. This will make it so that the Texture2D can by default be marked as GPU only, reducing resulting memory footprint by 1/2 (though peak will be having an additional CPU copy still.