Page MenuHome

Fix T95700: Oject Info node does not work with GPU subdivided meshes
ClosedPublic

Authored by Kévin Dietrich (kevindietrich) on Apr 14 2022, 4:27 AM.

Details

Summary

When GPU subdivision is enabled the mesh objects remain unsubdivided on
the CPU side, and subdivision should be requested somewhat manually (via
BKE_object_get_evaluated_mesh).

When referencing an object, the Object Info node calls
bke::object_get_evaluated_geometry_set which first checks if a Geometry
Set is present on the object (unless we have a mesh in edit mode). If so
it will return it, if not, the object type is discriminated, which will
return a properly subdivided mesh object via add_final_mesh_as_geometry_component.

The unsubdivided mesh is returned because apparently the check on the
Geometry Set always succeeds (as it is always set in mesh_build_data).
However, the mesh inside this Geometry Set is not subdivided.

This adds a check for a MeshComponent in this Geometry Set, and if one
exists, calls add_final_mesh_as_geometry_component which will ensure
that the mesh is subdivided on the CPU side as well.


Another fix could be to move the check on the existing Geometry Set below
the check on the object type, but I am unsure about the consequences.

Diff Detail

Repository
rB Blender

Event Timeline

Kévin Dietrich (kevindietrich) requested review of this revision.Apr 14 2022, 4:27 AM
Kévin Dietrich (kevindietrich) created this revision.

This seems reasonable to me, at least I can't think of any unintended consequences. Thanks for the good patch description.
Eventually maybe we'll want something like nodes implemented with the GPU that use the GPU subdivision. In the meantime, I guess this is a better solution since it doesn't require ensuring the subdivision is evaluated in many places.

This revision is now accepted and ready to land.Apr 14 2022, 11:15 AM

This seems reasonable to me, at least I can't think of any unintended consequences. Thanks for the good patch description.
Eventually maybe we'll want something like nodes implemented with the GPU that use the GPU subdivision. In the meantime, I guess this is a better solution since it doesn't require ensuring the subdivision is evaluated in many places.

⭐ 🏅 ⭐

@Jacob Merrill (blueprintrandom) I appreciate the excitement about that idea, but please keep the patch comments for discussions of the changes and for code review. Thanks.