Page MenuHome

Geometry Nodes: Only create instance IDs when they exist
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Oct 24 2021, 4:25 AM.

Details

Summary

Instance IDs serve no purpose for rendering when they aren't stable from
one frame to the next, and if the index is used in the end anyway, there
is no point in storing a vector of IDs and copying it around.

This commit exposes the id attribute on the instances component,
makes it optional-- only generated by default with the distribute points
on faces node.

Since the string to curves node only added the index as each instance's
ID, I just removed it. This means that it would be necessary to add the
ID data manually if the initial index actually helps (when deleting
only certain characters, for example). I think that's more consistent
with the workflow elsewhere, but I'm not totally set on it.

Diff Detail

Repository
rB Blender
Branch
geometry-nodes-instance-id-optional (branched from master)
Build Status
Buildable 18212
Build 18212: arc lint + arc unit

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.Oct 24 2021, 4:25 AM
Hans Goudey (HooglyBoogly) created this revision.
Jacques Lucke (JacquesLucke) requested changes to this revision.Oct 24 2021, 8:54 PM
Jacques Lucke (JacquesLucke) added inline comments.
source/blender/blenkernel/BKE_geometry_set.hh
663

Should probably be called something like instance_ids_ensure.

source/blender/blenkernel/intern/geometry_component_instances.cc
98

This has to increase the size of the ids vector, otherwise the sizes go out of sync.

101

Think we can remove this method now. It doesn't seem to be used.

475

Think we can use the default 0 now. -1 probably doesn't make too much sense in general. Don't remember why we used that originally.

This revision now requires changes to proceed.Oct 24 2021, 8:54 PM
Hans Goudey (HooglyBoogly) marked 4 inline comments as done.
  • Rename to instance_ids_ensure
  • Handle different vector sizes in a better way
  • Remove unused function
Jacques Lucke (JacquesLucke) added inline comments.
source/blender/blenkernel/intern/geometry_component_instances.cc
76

unused variable

This revision is now accepted and ready to land.Oct 26 2021, 2:25 PM
Hans Goudey (HooglyBoogly) marked an inline comment as done.Oct 26 2021, 7:41 PM
Hans Goudey (HooglyBoogly) added inline comments.
source/blender/blenkernel/BKE_geometry_set.hh
663

I went back and forth between the two. I'm fine ending here though :)

663

Oops, forgot to submit this earlier.