Blender Git Loki
Git Commits -> Revision 922c709
Revision 922c709 by Hans Goudey (pygpu_extensions) February 12, 2021, 21:54 (GMT) |
Geometry Nodes: Make instances real on-demand This commit makes the geometry output of the collection info usable. The output is the geometry of a collection instance, but this commit adds a utility to convert the instances to real geometry, used in the background whenever it is needed, like copy on write. The recursive nature of the "realize instances" code is essential, because collection instances in the `InstancesComponent`, might have no geometry sets of their own containing even more collection instances, which might then contain object instances, etc. Another consideration is that currently, every single instance contains a reference to its data. This is inefficient since most of the time there are many locations and only a few sets of unique data. So this commit adds a `GeometryInstanceGroup` to support this future optimization. The API for instances returns a vector of `GeometryInstanceGroup`. This may be less efficient when there are many instances, but it makes more complicated operations like point distribution that need to iterate over input geometry multiple times much simpler. Any code that needs to change data, like most of the attribute nodes, can simply call `geometry_set_realize_instances(geometry_set)`, which will move any geometry in the `InstancesComponent` to new "real" geometry components. Many nodes can support read-only access to instances in order to avoid making them real, this will be addressed where needed in the near future. Instances from the existing "dupli" system are not supported yet. Differential Revision: https://developer.blender.org/D10327 |
Commit Details:
Full Hash: 922c7095bf07089e82fa7b2d17b692def4d3abfc
Parent Commit: fd2888d
Committed By: Germano Cavalcante
Lines Changed: +502, -28
26 Modified Paths:
/source/blender/blenkernel/BKE_geometry_set.hh (+22, -0) (Diff)
/source/blender/blenkernel/intern/geometry_set.cc (+150, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_align_rotation_to_vector.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_attribute_color_ramp.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_attribute_compare.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_attribute_fill.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_attribute_math.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_attribute_mix.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_attribute_proximity.cc (+6, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_attribute_randomize.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_attribute_sample_texture.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_attribute_vector_math.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_boolean.cc (+6, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_edge_split.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_object_info.cc (+8, -28) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc (+3, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc (+3, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_point_instance.cc (+4, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_point_rotate.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_point_scale.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_point_separate.cc (+4, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_point_translate.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_triangulate.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/node_geometry_util.cc (+249, -0) (Diff)
/source/blender/nodes/geometry/node_geometry_util.hh (+17, -0) (Diff)
/source/blender/blenkernel/intern/geometry_set.cc (+150, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_align_rotation_to_vector.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_attribute_color_ramp.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_attribute_compare.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_attribute_fill.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_attribute_math.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_attribute_mix.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_attribute_proximity.cc (+6, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_attribute_randomize.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_attribute_sample_texture.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_attribute_vector_math.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_boolean.cc (+6, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_edge_split.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_object_info.cc (+8, -28) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_points_to_volume.cc (+3, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_point_distribute.cc (+3, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_point_instance.cc (+4, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_point_rotate.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_point_scale.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_point_separate.cc (+4, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_point_translate.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_subdivision_surface.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_triangulate.cc (+2, -0) (Diff)
/source/blender/nodes/geometry/node_geometry_util.cc (+249, -0) (Diff)
/source/blender/nodes/geometry/node_geometry_util.hh (+17, -0) (Diff)