Assimp's CalcTangentSpace deviates from de facto glTF 2.0 so we were compensating for this with an unconditional fixup in MeshAssimp. However the fixup should apply only when CalcTangentSpace is active, i.e. when the model is missing tangents. This makes it so that NormalTangentMirrorTest (has tangents) and NormalTangentTest (needs tangents) both look reasonable. I also noticed that MeshAssimp was inexplicably applying aiProcess_CalcTangentSpace twice: once as a flag, and once as a post-process. I removed the latter. This will be fixed in the upcoming cgltf-based loader, which will use our officially-sanctioned utility method in VertexBuffer. See #528
To update assimp use the following steps:
- Download or checkout Assimp's source code assimp.org or from GitHub
- In the Assimp directory, create an
out/directory and from there runcmake .. -DCMAKE_BUILD_TYPE=Release, thenmake -j - From
out/copyrevision.hto the root of the assimp source tree - From
out/copyinclude/assimp/config.htoinclude/assimp/config.hin the root of the assimp source tree - Open
tnt/CMakeLists.txtand update the lists of public headers, private headers and source files. All files present on disk can be listed but to speed up build times you should remove source files related to importers/exporters we do not use - Make sure to update the list of definitions that start with
-DASSIMP_BUILD_NO_to skip all the importers we do not want to use - Make sure the definition
-DASSIMP_BUILD_NO_EXPORTERis still there to remove all exporters
In addition we recommend to remove the following directories:
samples/test/tools/
We do not use these directories and they take up unnecessary space on disk.
Other Changes
(1)
In glTF2Importer.cpp, change from: ai_anim->mNumChannels = r.skins[0].jointNames.size(); to: ai_anim->mNumChannels = r.skins.Size() > 0 ? r.skins[0].jointNames.size() : 0;
(2)
Negate the bitangent in CalcTangentsProcess.cpp