syoyo / tinyusdz

Tiny, dependency-free USDZ/USDA/USDC library written in C++14
Other
453 stars 32 forks source link

USDLoadFromFile fails for some models #174

Open Richard-Ly opened 1 week ago

Richard-Ly commented 1 week ago

When using USDLoadFromFile, these USD files fail to open with the below error messages:

Arcade_Fight_Stick_Final.usd Download: https://www.dropbox.com/scl/fi/h8boiuvylzqkwg0sax8kl/Arcade_Fight_Stick_Final.usd?rlkey=1wqa8rkn6j9ueqb3mw389qtgr&dl=0

[error]C:\Users\xxxxx\Desktop\tinyusdz\tinyusdz-dev\src\usdc-reader.cc:ReconstructStage():3438 Failed to reconstruct Stage(Prim hierarchy)
[error]C:\Users\xxxxx\Desktop\tinyusdz\tinyusdz-dev\src\usdc-reader.cc:ReconstructPrimFromTypeName():1748 Failed to reconstruct Prim Mesh elementName: Button4BaseShape
[error]C:\Users\xxxxx\Desktop\tinyusdz\tinyusdz-dev\src\usdc-reader.cc[USDC]:ReconstructPrim():1433 Failed to build PropertyMap.
[error]C:\Users\xxxxx\Desktop\tinyusdz\tinyusdz-dev\src\usdc-reader.cc[USDC]:BuildPropertyMap():831 Failed to construct Property `primvars:normals` from FieldValuePairVector.
[error]C:\Users\xxxxx\Desktop\tinyusdz\tinyusdz-dev\src\usdc-reader.cc[USDC]:ParseProperty():1087 `elementSize` must be within [1, 512), but got 840

BattleSpaceship.usd Dowload: https://www.dropbox.com/scl/fi/gqr8w0js7idma0fubfsqf/BattleSpaceship.usd?rlkey=vsgu9zjbouqnhsfm771qkmsla&dl=0

[error]C:\Users\xxxxx\Desktop\tinyusdz\tinyusdz\src\usdc-reader.cc:ReconstructStage():3441 Failed to reconstruct Stage(Prim hierarchy)
[error]C:\Users\xxxxx\Desktop\tinyusdz\tinyusdz\src\usdc-reader.cc:ReconstructPrimFromTypeName():1748 Failed to reconstruct Prim Mesh elementName: Casco_de_cristalShape
[error]C:\Users\xxxxx\Desktop\tinyusdz\tinyusdz\src\usdc-reader.cc[USDC]:ReconstructPrim():1433 Failed to build PropertyMap.
[error]C:\Users\xxxxx\Desktop\tinyusdz\tinyusdz\src\usdc-reader.cc[USDC]:BuildPropertyMap():831 Failed to construct Property `primvars:normals` from FieldValuePairVector.
[error]C:\Users\xxxxx\Desktop\tinyusdz\tinyusdz\src\usdc-reader.cc[USDC]:ParseProperty():1087 `elementSize` must be within [1, 512), but got 7050

Any ideas on what is causing the issue?

Thanks.

syoyo commented 1 week ago

https://www.dropbox.com/scl/fi/h8boiuvylzqkwg0sax8kl/Arcade_Fight_Stick_Final.usd?rlkey=1wqa8rkn6j9ueqb3mw389qtgr&dl=0

Seems contain invalid primvars:normals attribute. No values and elementSize is quite large.

                    vector3f[] primvars:normals (
                        elementSize = 840
                        interpolation = "faceVarying"
                    )

You can ask around OpenUSD community this is a valid USD file.

Richard-Ly commented 1 week ago

Would it be possible to ignore these primvars:normals (or any invalid data)? I'm able to import these models into Blender, though it seems like it fails to load the materials and normals.