vpenades / SharpGLTF

glTF reader and writer for .NET Standard
MIT License
470 stars 75 forks source link

Less textures than expected #23

Closed rolandkru closed 5 years ago

rolandkru commented 5 years ago

I create 8 nodes with each having a mesh, material and texture. However, in the resulting gltf file, I see 8 nodes, 8 meshes, 8 materials but only 6 textures. Could you give me a hint where I miss something?

vpenades commented 5 years ago

Are all these textures different from each other? Does the model look fine anyway?

SharpGLTF tries to reuse resources as much as possible, so if it finds two textures are exactly the same, it will use only one.

rolandkru commented 5 years ago

Yes, that's it. For your information: we generate a gltf file with a blank (gray) texture. 2x2 of the textures are identical. We later want to generate a glb file based on the gltf file but with colorized textures. This use case does not work, when the textures in the gltf file where reused. As a workaround, I create the gltf file now with random colorized textures.