Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cycles seg-faults with USD from blender #6267

Open
redhoot-dev opened this issue Feb 10, 2025 · 3 comments
Open

Cycles seg-faults with USD from blender #6267

redhoot-dev opened this issue Feb 10, 2025 · 3 comments

Comments

@redhoot-dev
Copy link

Version: Gaffer 1.5.4.1-linux

Description

Loading a blender USD results in a seg fault. There seems to be some unsupported primvars from the USD that causes cycles in Gaffer to seg/fault. The opengl viewport works fine. Both viewport and render/interactive render crashes.
I`ve tried to remove the primvars using the DeletePrimitiveVariables node to no avail.

Steps to reproduce

Download geo, load it in gaffer, hit render / switch to cycles in the viewport and it instantly crashes.

USD: https://drive.google.com/file/d/1QUHcR17EAG6y8uStOpgJC1vYIbWBDd7X/view?usp=sharing

Debug log

Click to Expand


WARNING : IECoreUSD::PrimitiveAlgo : Ignoring invalid primitive variable "/root/low_box8/box8__001/Mesh_253.points"
WARNING : IECoreUSD::PrimitiveAlgo : Ignoring invalid primitive variable "/root/Vert__001/Vert_004.points"
WARNINGWARNINGWARNING : IECoreUSD::PrimitiveAlgo : Ignoring invalid primitive variable "/root/platform_rails__005/Mesh_114.points"
 : IECoreUSD::PrimitiveAlgo : Ignoring invalid primitive variable "/root/platform_rails__002/Mesh_111.points"
WARNING : IECoreUSD::PrimitiveAlgo : Ignoring invalid primitive variable "/root/platform_rails__004/Mesh_113.points"
 : IECoreUSD::PrimitiveAlgo : Ignoring invalid primitive variable "/root/platform_rails/Mesh_109.points"
WARNING : IECoreCyles::GeometryAlgo::convertPrimitiveVariable : Primitive variable "SculptFreezeColorTemp" has unsupported type "Color4fVectorData".
WARNING : IECoreCyles::GeometryAlgo::convertPrimitiveVariable : Primitive variable "SculptMaskColorTemp" has unsupported type "Color4fVectorData".
WARNING : IECoreCyles::GeometryAlgo::convertPrimitiveVariable : Primitive variable "metal" has unsupported type "Color4fVectorData".
WARNING : IECoreCyles::GeometryAlgo::convertPrimitiveVariable : Primitive variable "plastic" has unsupported type "Color4fVectorData".
WARNING : IECoreCyles::GeometryAlgo::convertPrimitiveVariable : Primitive variable "metal_part" has unsupported type "Color4fVectorData".
WARNING : IECoreCyles::GeometryAlgo::convertPrimitiveVariable : Primitive variable "outlet" has unsupported type "Color4fVectorData".
WARNING : IECoreCyles::GeometryAlgo::convertPrimitiveVariable : Primitive variable "outlet_cover" has unsupported type "Color4fVectorData".
WARNING : IECoreCyles::GeometryAlgo::convertPrimitiveVariable : Primitive variable "Attribute" has unsupported type "Color4fVectorData".
WARNING : IECoreCyles::GeometryAlgo::convertPrimitiveVariable : Primitive variable "Attribute" has unsupported type "Color4fVectorData".
/mnt/common/pipeline/software/configs/gaffer/./gaffer.sh: line 7: 861426 Segmentation fault      (core dumped) /mnt/common/pipeline/software/binary/gaffer/bin/gaffer "$@"

@murraystevenson
Copy link
Contributor

The pertinent warnings are these:

WARNING : IECoreUSD::PrimitiveAlgo : Ignoring invalid primitive variable "/root/low_box8/box8__001/Mesh_253.points"
WARNING : IECoreUSD::PrimitiveAlgo : Ignoring invalid primitive variable "/root/Vert__001/Vert_004.points"
WARNING : IECoreUSD::PrimitiveAlgo : Ignoring invalid primitive variable "/root/platform_rails/Mesh_109.points"
WARNING : IECoreUSD::PrimitiveAlgo : Ignoring invalid primitive variable "/root/platform_rails__002/Mesh_111.points"
WARNING : IECoreUSD::PrimitiveAlgo : Ignoring invalid primitive variable "/root/platform_rails__005/Mesh_114.points"
WARNING : IECoreUSD::PrimitiveAlgo : Ignoring invalid primitive variable "/root/platform_rails__004/Mesh_113.points"

usdview also warns about the same locations:

Invalid Hydra prim '/root/platform_rails__004/Mesh_113': Vertex primvar points has 1370 elements, while its topology references only upto element index 1369.
Invalid Hydra prim '/root/platform_rails/Mesh_109': Vertex primvar points has 274 elements, while its topology references only upto element index 273.
Invalid Hydra prim '/root/platform_rails__005/Mesh_114': Vertex primvar points has 274 elements, while its topology references only upto element index 273.
Invalid Hydra prim '/root/low_box8/box8__001/Mesh_253': Vertex primvar points has 1 elements, while its topology references only upto element index 0.
Invalid Hydra prim '/root/Vert__001/Vert_004': Vertex primvar points has 1 elements, while its topology references only upto element index 0.
Invalid Hydra prim '/root/platform_rails__002/Mesh_111': Vertex primvar points has 274 elements, while its topology references only upto element index 273.

We're pretty strict about not loading invalid primitive variables from USD, though here it results in the objects being created without a P primitive variable as points is invalid. GafferCycles is expecting meshes to contain P, and is crashing if they don't (best case will be an error if the mesh first requires triangulation as MeshAlgo::triangulate() will throw). We should definitely handle this situation better, but it's curious that Blender is outputting invalid data like this.

For now, if those locations are pruned in Gaffer then the Cycles render doesn't crash.

@redhoot-dev
Copy link
Author

I'll see if we can find a process to sanitize the geometry before saving it out.

It would however be nice if Gaffer could fail more gracefully when it does encounter invalid data like this.

@murraystevenson
Copy link
Contributor

It would however be nice if Gaffer could fail more gracefully when it does encounter invalid data like this.

Indeed! Thanks for the report. I'd imagine our more graceful failing would be either "cause the render to error" or "omit the invalid geometry" so ensuring clean geo is exported out of Blender does sound like a worthwhile pursuit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants