Geometry Nodes: Make simulation caching optional #107767

Merged
Hans Goudey merged 13 commits from HooglyBoogly/blender:simulation-use-cache-option into main 2023-05-10 16:01:44 +02:00
Member

For realtime use cases, storing the geometry's state in memory at every
frame can be prohibitively expensive. This commit adds an option to
disable the caching, stored per object and accessible in the baking
panel. The default is still to enable caching.

For realtime use cases, storing the geometry's state in memory at every frame can be prohibitively expensive. This commit adds an option to disable the caching, stored per object and accessible in the baking panel. The default is still to enable caching.
Hans Goudey added 1 commit 2023-05-09 01:49:40 +02:00
9b9c593fee Geometry Nodes: Make simulation caching optional
For realtime use cases, storing the geometry's state in memory at every
frame can be prohibitively expensive. This commit adds an option to
disable the caching, stored per object and accessible in the baking
panel.

TODO:
- [ ] Seeking backwards in the timeline causes output node to emit default values
Jacques Lucke reviewed 2023-05-09 14:01:36 +02:00
@ -146,6 +147,12 @@ struct StatesAroundFrame {
const ModifierSimulationStateAtFrame *next = nullptr;
};
struct MutableStatesAroundFrame {
Member

Having this struct seems a little wrong because we should never really need write access to all of these simulation states at the same time afaik.

Having this struct seems a little wrong because we should never really need write access to all of these simulation states at the same time afaik.
@ -1267,2 +1267,4 @@
const Vector<BMeshToMeshLayerInfo> info = bm_to_mesh_copy_info_calc(bm.vdata, mesh.vdata);
MutableSpan<float3> dst_vert_positions = mesh.vert_positions_for_write();
std::atomic<bool> any_loose_vert = false;
Member

unrelated changes

unrelated changes
@ -1207,9 +1207,12 @@ static void prepare_simulation_states_for_evaluation(const NodesModifierData &nm
return;
}
exec_data.simulation_cache = nmd_orig.simulation_cache;
Member

I think it might make sense to use a completely separate prepare_simulation_states_for_evaluation function for the case when the cache is not used.

I think it might make sense to use a completely separate `prepare_simulation_states_for_evaluation` function for the case when the cache is not used.
Member

I think it might make sense to use a completely separate prepare_simulation_states_for_evaluation function for the case when the cache is not used.

I think it might make sense to use a completely separate `prepare_simulation_states_for_evaluation` function for the case when the cache is not used.
@ -81,0 +99,4 @@
const float scene_ctime = BKE_scene_ctime_get(scene);
std::cout << "Removing state at " << scene_ctime << "\n";
modifier_data.prev_simulation_state->remove_zone_state(zone_id);
Member

Any reason for removing the zone state here, instead of just removing the entire state for the previous frame in MOD_nodes.cc?

Any reason for removing the zone state here, instead of just removing the entire state for the previous frame in `MOD_nodes.cc`?
Hans Goudey added 9 commits 2023-05-09 20:41:55 +02:00
Hans Goudey added 1 commit 2023-05-09 20:47:43 +02:00
Hans Goudey changed title from WIP: Geometry Nodes: Make simulation caching optional to Geometry Nodes: Make simulation caching optional 2023-05-09 20:47:56 +02:00
Hans Goudey requested review from Jacques Lucke 2023-05-09 20:53:01 +02:00
Hans Goudey added this to the Nodes & Physics project 2023-05-09 20:53:06 +02:00
Jacques Lucke approved these changes 2023-05-10 14:26:30 +02:00
@ -1352,2 +1352,4 @@
}
if (!(ctx->object->flag & OB_FLAG_USE_SIMULATION_CACHE)) {
nmd_orig->simulation_cache->clear_prev_states();
Member

Should only be done when the depsgraph is active. Other depsgraph should generally never modify the original data.

Should only be done when the depsgraph is active. Other depsgraph should generally never modify the original data.
Hans Goudey added 2 commits 2023-05-10 14:33:18 +02:00
Hans Goudey merged commit 8efd6d5f82 into main 2023-05-10 16:01:44 +02:00
Hans Goudey deleted branch simulation-use-cache-option 2023-05-10 16:01:45 +02:00
Howard Trickey referenced this issue from a commit 2023-05-29 02:51:41 +02: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#107767
No description provided.