Geometry Nodes: Move instance reference indices to a builtin attribute #117951

Merged
Hans Goudey merged 2 commits from HooglyBoogly/blender:instances-index-attribute into blender-v4.1-release 2024-02-08 20:55:42 +01:00
Member

This means the array can be shared between geometries when unchanged,
reducing memory usage and increasing performance. It also means that
handling the data can be done more generically using the attribute
system. In the future the transforms can become attributes too.

Two other changes are related here:

  • The "almost unique ids" are cached with a shared cache so they
    are shared too.
  • The reference indices are baked as an attribute now, making the process
    more generic and potentially easier to optimize in the future.
This means the array can be shared between geometries when unchanged, reducing memory usage and increasing performance. It also means that handling the data can be done more generically using the attribute system. In the future the transforms can become attributes too. Two other changes are related here: - The "almost unique ids" are cached with a shared cache so they are shared too. - The reference indices are baked as an attribute now, making the process more generic and potentially easier to optimize in the future.
Hans Goudey requested review from Jacques Lucke 2024-02-07 17:45:01 +01:00
Hans Goudey added the
Interest
Geometry Nodes
label 2024-02-07 17:45:05 +01:00
Hans Goudey added this to the Nodes & Physics project 2024-02-07 17:45:18 +01:00
Author
Member

@blender-bot build

@blender-bot build
Jacques Lucke requested changes 2024-02-08 16:35:11 +01:00
Jacques Lucke left a comment
Member

I think this might result in crashes when loading existing bakes, because there is no check if the new attribute is actually initialized anymore. It won't be initialized when loading old bake data. You could check if the attribute exists after the call to load_attributes in try_load_instances. It would be even better if the code could also load the handles explicitly if the .reference_index attribute didn't exist in the bake. This should be easy enough and avoids unnecessary breakages.

I think this can still go into 4.1. Better than making bake files incompatible between main and 4.1 now already.

I think this might result in crashes when loading existing bakes, because there is no check if the new attribute is actually initialized anymore. It won't be initialized when loading old bake data. You could check if the attribute exists after the call to `load_attributes` in `try_load_instances`. It would be even better if the code could also load the `handles` explicitly if the `.reference_index` attribute didn't exist in the bake. This should be easy enough and avoids unnecessary breakages. I think this can still go into 4.1. Better than making bake files incompatible between `main` and `4.1` now already.
HooglyBoogly changed target branch from main to blender-v4.1-release 2024-02-08 16:39:36 +01:00
Hans Goudey force-pushed instances-index-attribute from 807ddeaa83 to 7fe06b0624 2024-02-08 16:55:39 +01:00 Compare
Author
Member

It would be even better if the code could also load the handles explicitly if the .reference_index attribute didn't exist in the bake. This should be easy enough and avoids unnecessary breakages.

Good point. I added support for reading the old format too. Tested with an old bake.

>It would be even better if the code could also load the handles explicitly if the .reference_index attribute didn't exist in the bake. This should be easy enough and avoids unnecessary breakages. Good point. I added support for reading the old format too. Tested with an old bake.
Hans Goudey requested review from Jacques Lucke 2024-02-08 16:56:32 +01:00
Jacques Lucke approved these changes 2024-02-08 20:02:48 +01:00
Jacques Lucke left a comment
Member

@blender-bot build

@blender-bot build
Hans Goudey merged commit 2e6223d90f into blender-v4.1-release 2024-02-08 20:55:42 +01:00
Hans Goudey deleted branch instances-index-attribute 2024-02-08 20:55:45 +01:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#117951
No description provided.