Geometry Nodes: refactor simulation storage and how simulation nodes access it #111623
No reviewers
Labels
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 project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#111623
Loading…
Reference in New Issue
No description provided.
Delete Branch "JacquesLucke/blender:better-simulation-state-api"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goals of the refactor:
Previously, there were a bunch of simulation specific properties in
GeoNodesModifierData
and then the simulation input and output nodes would have to figure out what to do with that data. Now, there is a newGeoNodesSimulationParams
which controls the behavior of simulation zones. Contrary to before, different simulation zones can now be handled independently, even if that is not really used yet.GeoNodesSimulationParams
has to be subclassed by a user of the geometry nodes API. The subclass controls what each simulation input and output node does. This some of the logic that was part of the node before, into the modifier.The way we store simulation data is "transposed". Previously, we stored zone data per frame, but now we store frame data per zone. This allows different zones to be more independent. Consequently, the way the simulation cache is accessed changed. I kept things simpler for now, avoiding many of the methods we had before, and directly accessing the data more often which is often simple enough. This change also makes it theoretically possible to store baked data for separate zones independently. A downside of this is, that existing baked data can't be read anymore. We don't really have compatibility guarantees for this format yet, so it's ok. Users will have to bake again. The bake folder for the modifier now contains an extra subfolder for every zone.
Drawing the cached/baked frames in the timeline is less straight forward now. Currently, it just draws the state of one of the zones, which usually is identical to that of all other zones. This will change in the future though, and then the timeline drawing also needs some new UI work.
There are a few things that could be worked on after this patch:
std::shared_ptr
that is used currently).@blender-bot build
WIP: Geometry Nodes: refactor simulation storage and how simulation nodes access itto Geometry Nodes: refactor simulation storage and how simulation nodes access itI guess mainly I'd like to see a few more comments. Even if they feel obvious, there's a lot going on here, and the functionality is spread out much more than usual. The only places that's a blocking comment for me I've noted in comments though.
What's the reasoning for splitting
NodesModifierSimulationParams
andGeoNodesSimulationParams
? I guess you're thinking we might use simulation without the modifier in the future? That makes sense to me, just want to be sure.@ -88,1 +32,3 @@
const ModifierSimulationStateAtFrame *next = nullptr;
struct SimulationZoneFrameCache {
SubFrame frame;
Map<int, std::unique_ptr<BakeItem>> items;
Here and below, add a comment like "map from X to Y". That's helpful because the int here isn't so helpful to the reader.
Hmm, I don't see a comment here :/ sorry if I'm missing something.
@ -13,6 +13,7 @@
#include <cstdlib>
#include <cstring>
#include "BLI_binary_search.hh"
Unused include?
@ -43,0 +57,4 @@
Map<int, std::unique_ptr<bke::BakeItem>> prev_items;
};
using SimInputBehavior = std::variant<PassThrough, OutputCopy, OutputMove>;
I find these type names and namespaces redundant. What about:
I think that gets the same thing across without the redundancy
@ -43,0 +67,4 @@
};
struct StoreAndPassThrough {
std::function<void(Map<int, std::unique_ptr<bke::BakeItem>>)> store_fn;
Reading this code, it's a bit frustrating to encounter something like this without any comment. There's clearly a lot going on, and some reason for a function object, but to understand why I have to flip through the places it's assigned and used. That gives me the impression it's for code reuse between the "realtime cache" and "frame cache" versions? But it's hard to tell.
Yes right, we already talked about that we would like to use simulations for e.g. modal operators, which don't have a modifier.
The comments you added since last time help so much, I think they'll save a lot of time for many people over the years. :)
@ -40,6 +42,92 @@ namespace blender::nodes {
using lf::LazyFunction;
using mf::MultiFunction;
/** The structs in here describe the different possible behaviors of a simulation input node. */
Thanks, this is so much more friendly now!
@blender-bot build