Blender Git Loki

Git Commits -> Revision 3206397

Revision 3206397 by Jacques Lucke (temp-gpu-image-engine)
December 15, 2021, 13:37 (GMT)
Geometry Nodes: support instance attributes when realizing instances

This patch refactors the instance-realization code and adds new functionality.
* Named and anonymous attributes are propagated from instances to the
realized geometry. If the same attribute exists on the geometry and on an
instance, the attribute on the geometry has precedence.
* The id attribute has special handling to avoid creating the same id on many
output points. This is necessary to make e.g. the Random Value node work
as expected afterwards.

Realizing instance attributes has an effect on existing files, especially due to the
id attribute. To avoid breaking existing files, the Realize Instances node now has
a legacy option that is enabled for all already existing Realize Instances nodes.
Removing this legacy behavior does affect some existing files (although not many).
We can decide whether it's worth to remove the old behavior as a separate step.

This refactor also improves performance when realizing instances. That is mainly
due to multi-threading. See D13446 to get the file used for benchmarking. The
curve code is not as optimized as it could be yet. That's mainly because the storage
for these attributes might change soonish and it wasn't worth optimizing for the
current storage format right now.

```
1,000,000 x mesh vertex: 530 ms -> 130 ms
1,000,000 x simple cube: 1290 ms -> 190 ms
1,000,000 x point: 1000 ms -> 150 ms
1,000,000 x curve spiral: 1740 ms -> 330 ms
1,000,000 x curve line: 1110 ms -> 210 ms
10,000 x subdivided cylinder: 170 ms -> 40 ms
10 x subdivided spiral: 180 ms -> 180 ms
```

Differential Revision: https://developer.blender.org/D13446

Commit Details:

Full Hash: 320639740d58693cbd656b44a4c7fc7f74cd26f4
Parent Commit: 5f9a6ac
Committed By: Jeroen Bakker
Lines Changed: +1530, -418

2 Added Paths:

/source/blender/geometry/GEO_realize_instances.hh (+52, -0) (View)
/source/blender/geometry/intern/realize_instances.cc (+1347, -0) (View)

54 Modified Paths:

/source/blender/blenkernel/BKE_blender_version.h (+1, -1) (Diff)
/source/blender/blenkernel/BKE_geometry_set_instances.hh (+0, -2) (Diff)
/source/blender/blenkernel/BKE_spline.hh (+1, -0) (Diff)
/source/blender/blenkernel/BKE_type_conversions.hh (+2, -0) (Diff)
/source/blender/blenkernel/intern/curve_eval.cc (+7, -0) (Diff)
/source/blender/blenkernel/intern/geometry_set.cc (+7, -2) (Diff)
/source/blender/blenkernel/intern/geometry_set_instances.cc (+0, -369) (Diff)
/source/blender/blenkernel/intern/type_conversions.cc (+17, -0) (Diff)
/source/blender/blenloader/intern/versioning_300.c (+14, -0) (Diff)
/source/blender/geometry/CMakeLists.txt (+3, -0) (Diff)
/source/blender/makesdna/DNA_node_types.h (+4, -0) (Diff)
/source/blender/makesrna/intern/rna_nodetree.c (+11, -0) (Diff)
/source/blender/modifiers/CMakeLists.txt (+1, -0) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_align_rotation_to_vector.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_clamp.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_color_ramp.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_combine_xyz.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_compare.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_convert.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_curve_map.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_fill.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_math.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_mix.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_proximity.cc (+2, -2) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_randomize.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_sample_texture.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_separate_xyz.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_transfer.cc (+2, -2) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_vector_math.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_vector_rotate.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_endpoints.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_reverse.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_select_by_handle_type.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_set_handles.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_spline_type.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_subdivide.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_curve_to_points.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_delete_geometry.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_edge_split.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_material_assign.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_mesh_to_curve.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_points_to_volume.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_instance.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_rotate.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_scale.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_separate.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_point_translate.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_raycast.cc (+2, -2) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_select_by_material.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_subdivision_surface.cc (+1, -1) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc (+6, -1) (Diff)
/source/blender/nodes/geometry/nodes/node_geo_realize_instances.cc (+14, -1) (Diff)
/source/blender/nodes/NOD_geometry_exec.hh (+2, -1) (Diff)
/source/blender/nodes/NOD_static_types.h (+1, -1) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021