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

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.

Differential Revision: https://developer.blender.org/D14643
This commit is contained in:
Kévin Dietrich 2022-04-14 15:11:58 +02:00
parent 31b2b84b3c
commit a9b94e5f81
Notes: blender-bot 2023-02-14 07:18:54 +01:00
Referenced by issue #98796, Regression: Drop in performance when manipulating instances in geometry nodes Blender 3.2
Referenced by issue #98717, GPU Subivsion behaves different in Blender 3.2
Referenced by issue #96729, Geonode + Cycles displaying of instances that uses GPU subdiv (either rendering unsubdivided, or in combination with Set Material node completely vanishing)
Referenced by issue #95700, GPU subdivision: Referencing object with subdivision surface with Object info node does not work
1 changed files with 6 additions and 1 deletions

View File

@ -50,7 +50,12 @@ GeometrySet object_get_evaluated_geometry_set(const Object &object)
return geometry_set;
}
if (object.runtime.geometry_set_eval != nullptr) {
return *object.runtime.geometry_set_eval;
GeometrySet geometry_set = *object.runtime.geometry_set_eval;
/* Ensure that subdivision is performed on the CPU. */
if (geometry_set.has_mesh()) {
add_final_mesh_as_geometry_component(object, geometry_set);
}
return geometry_set;
}
/* Otherwise, construct a new geometry set with the component based on the object type. */