04bc3f155e6400f04b117523d21dad97b9bb5b37
A small number of USD files in the wild contain invalid face index data for some of their meshes. This leads to asserts in debug builds and crashes for users in retail builds(sometimes). There is already an import option to Validate Meshes but it turns out that we, and most other importers, perform validation too late. We crash before getting to that validate option (see notes). This PR implements a cheap detection mechanism and will auto-fix if we detect broken data. The detection may not find all types of bad data but it will detect what is known to fail today for duplicate vertex indices. We immediately validate/fix before loading in the rest of the data. The downside is that this will mean no additional data will be loaded. Normals, edge creases, velocities, UVs, and all other attributes will be lost because the incoming data arrays will no longer align. It should be noted also that Alembic has also chosen this approach. It's check is significantly weaker though and can be improved separately if needed. If auto-fix is triggered, it will typically appear as one trace on the terminal. ``` WARN (io.usd): <path...>\io\usd\intern\usd_reader_mesh.cc:684 read_mesh_sample: Invalid face data detected for mesh '/degenerate/m_degenerate'. Automatic correction will be used. ``` A more general downside of these fixes is that this applies to each frame of animated mesh data. The mesh will be fixed, and re-fixed, on every frame update when the frame in question contains bad data. For well-behaved USD scenes, the penalty for this check is between 2-4%. For broken USD scenes, it depends on how many meshes need the fixup. In the case of the Intel 4004 Moore Lane scene, the penalty is a 2.7x slowdown in import time (4.5 s to 12.5 s). Pull Request: https://projects.blender.org/blender/blender/pulls/138633
…
Blender
Blender is the free and open source 3D creation suite. It supports the entirety of the 3D pipeline—modeling, rigging, animation, simulation, rendering, compositing, motion tracking and video editing.
Project Pages
Development
License
Blender as a whole is licensed under the GNU General Public License, Version 3. Individual files may have a different but compatible license.
See blender.org/about/license for details.
Description
Languages
C++
78%
Python
14.9%
C
2.9%
GLSL
1.9%
CMake
1.2%
Other
0.9%
