Skip to content

Wrong indexing used for normals, etc. in gltfwriterVBO::GetLayerElements #15

Description

@alinen

The resulting glTF has incorrect normals as a result.

To work around the issue, I have changed the macro GetLayerElement to use the MappingMode rather than the ReferenceMode, like so

#define GetLayerElement(layerElt, indexV, T, V, index, lambda)
int indexV =-1 ;
T V ;
if ( layerElt ) {
indexV =(layerElt->GetMappingMode () == FbxLayerElement::eByPolygonVertex ? index : layerElt->GetIndexArray () [index]) ;
V =layerElt->GetDirectArray ().GetAt (indexV) ;
lambda (V) ;
}

Models that demonstrate the problem are here

https://github.com/alinen/FBX-glTF/tree/master/three.js/models/drone_shell (needs updated three.js too)
https://github.com/alinen/FBX-glTF/tree/master/three.js/models/airplane

I would be interested in knowing the proper fix!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions