coreBlackbird icon indicating copy to clipboard operation
coreBlackbird copied to clipboard

Instanced attribute sets

Open dedoardo opened this issue 3 years ago • 1 comments

Description This patch allows objects to read from and index shared attribute sets. The logic in the geometry manager has been changed to allocate an extra device attribute map for each InstanceGroup which is essentially an alias for an AttributeSet. The attribute requests are fulfilled by the instanced attribute set, or the geometry attribute set if the former are not found.

Design considerations are very welcome. One thing that can be addressed with the current method is that geometry attributes which are overwritten by instanced attributes are committed to the device buffers. Skipping this commit requires knowing which attributes in the geometry attribute set are always overwritten by instanced attribute sets, requiring extra management logic.

Changes

  • Added a vector of attribute sets at the scene level which can be referenced by objects
  • Changed Geometry::device_update to combine geometry and instanced attribute sets
  • find_attribute uses the per object instance_index to index the attribute set
  • The kernel object for point clouds has switched to using numverts, rather than numkeys to match the interpolation ATTR_ELEMENT_VERTEX

Test Here is a test file perpoint_attr.zip

image

dedoardo avatar Jul 19 '21 19:07 dedoardo

Hi, thanks a lot for the review @bareya and @skwerner for the bugfix :) I made the following changes

  • Removed double initialization of InstanceGroup::attr_map_offset
  • Moved Attribute::instances to a private block and changed the type to size_t to be consistent with other sizes
  • Made Geometry::num_points virtual. There should probably be a simpler way to pass numverts/numpoints specific to each geometry and avoid duplication.
  • More descriptive comments for internal variables

Maybe Attribute::element_size should include the number of instances. What do you think?

dedoardo avatar Jul 21 '21 19:07 dedoardo