CesiumGS / obj2gltf

Convert OBJ assets to glTF
Apache License 2.0
1.7k stars 305 forks source link

Material assigned to meshes with different attributes #160

Closed lilleyse closed 5 years ago

lilleyse commented 5 years ago

If a material is assigned to meshes with different attributes it should be duplicated. If one of those meshes doesn't have texture coordinates the textures in the duplicated material should be removed.

The glTF spec backs this up by saying:

Mesh must have corresponding texture coordinate attributes for the material to be applicable to it.

https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textureinfotexcoord

Example obj snippet:

usemtl red
f 1//2 3//2 5//2 1//1
...
usemtl red
f 1/2/3 5/4/2 1/7/4