assimp
assimp copied to clipboard
Question about GLTF2 import with negative scale
Describe the technical debt I'm importing two gltf 2 models that are created by blender. { "asset" : { "generator" : "Khronos glTF Blender I/O v1.8.19", "version" : "2.0" }, ...
One of the two files is created by an mirrored copy operation from the other one and it has negative node scale values, e.g.
{
"mesh" : 1,
"name" : "TRANSPARENT",
"rotation" : [
0.9873442053794861,
0,
-0.15859262645244598,
1.933285176392019e-07
],
"scale" : [
-1,
-1,
-1
],
"translation" : [
-26.700267791748047,
7.51713228225708,
-20.994590759277344
]
After importing these models into my application I get the rendering wrong for the model with negative determinante transform.
The specification of GLTF2 says:
"When a mesh primitive uses any triangle-based topology (i.e., triangles, triangle strip, or triangle fan), the determinant of the node’s global transform defines the winding order of that primitive. If the determinant is a positive value, the winding order triangle faces is counterclockwise; in the opposite case, the winding order is clockwise."
Now, I do not know, if I can expect the Assimp Lib to handle this situation or if I do have to take measures in my own application?
How do you handle such situations? I can't apply the post processing procedure or I do have to load the model twice. Additionally, not all nodes of the model might have neg determinate transforms.
So I would like to ask the following two question:
- What is the correct way to handle such imports from the library user perspective?
- Is the implementation of the current GLTF2 import correct with respect to the specification of this matter?
Any information, hint, answer or help is very much appreciated.
Best Hatlafax
In our loader we duplicated the geometry and reversed the triangle indice order. I'm not a fan of this feature in the glTF spec.