Fix #111978: Passthrough if there is no simulation state (backport to 3.6) #112110

Closed
MKRelax wants to merge 1 commits from MKRelax/blender:111978-simulation-empty-geometry into blender-v3.6-release

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
First-time contributor

This is a fix for #111978 (Geometry disappearing when using simulation zone).

The following Blender 4.0 commit was backported to 3.6:

commit 81096abe2a3929c5e02e8d8c697a9571079fe0ef
Author: Jacques Lucke <jacques@blender.org>
Date:   Fri Aug 4 19:34:35 2023 +0200

    Fix: simulation outputs empty geometry when going to frame zero

    Previously, simulation nodes would output default values when there is no
    current simulation state and nothing should be computed. Now, the data is
    just passed through which is usually less confusing.

Blender 4.0 has many simulation node changes. This pull request specifically backports the above commit from 4.0 to 3.6 and nothing more. Specifically it excludes all changes that were made to avoid copies in "no cache simulation" (commit 424c6edc).

Although this pull request fixes #111978, some other issues that are already present in 3.6 might become more apparent after applying this pull request, e.g. the "cache miss" behavior mentioned in #112094.

This pull requests needs to be reviewed thoroughly because I'm a complete novice at C++ development. Added a WIP prefix to prevent merging for now.

This is a fix for https://projects.blender.org/blender/blender/issues/111978 (Geometry disappearing when using simulation zone). The following Blender 4.0 commit was backported to 3.6: ``` commit 81096abe2a3929c5e02e8d8c697a9571079fe0ef Author: Jacques Lucke <jacques@blender.org> Date: Fri Aug 4 19:34:35 2023 +0200 Fix: simulation outputs empty geometry when going to frame zero Previously, simulation nodes would output default values when there is no current simulation state and nothing should be computed. Now, the data is just passed through which is usually less confusing. ``` Blender 4.0 has many simulation node changes. This pull request specifically backports the above commit from 4.0 to 3.6 and nothing more. Specifically it excludes all changes that were made to avoid copies in "no cache simulation" (commit 424c6edc). Although this pull request fixes #111978, some other issues that are already present in 3.6 might become more apparent after applying this pull request, e.g. the "cache miss" behavior mentioned in #112094. This pull requests needs to be reviewed thoroughly because I'm a complete novice at C++ development. Added a WIP prefix to prevent merging for now.
MKRelax added 1 commit 2023-09-08 00:35:59 +02:00
Iliya Katushenock added this to the Nodes & Physics project 2023-09-08 00:42:13 +02:00
Iliya Katushenock added the
Interest
Geometry Nodes
label 2023-09-08 00:42:18 +02:00
Member

Added a WIP prefix to prevent merging for now.

The PR won't be merged if it isn't accepted. The "WIP" status basically means it isn't ready for review. The description is a bit confusing.

The changes look good to me, though we should probably wait for Jacques since he'll have a better memory of the original commit.

>Added a WIP prefix to prevent merging for now. The PR won't be merged if it isn't accepted. The "WIP" status basically means it isn't ready for review. The description is a bit confusing. The changes look good to me, though we should probably wait for Jacques since he'll have a better memory of the original commit.
Hans Goudey changed title from WIP: Fix #111978: Passthrough if there is no simulation state (backport to 3.6) to Fix #111978: Passthrough if there is no simulation state (backport to 3.6) 2023-09-08 00:51:07 +02:00
Hans Goudey requested review from Jacques Lucke 2023-09-08 00:51:16 +02:00
Member

@blender-bot build

@blender-bot build
Author
First-time contributor

@HooglyBoogly Updated the PR description to (hopefully) make it less confusing.

@HooglyBoogly Updated the PR description to (hopefully) make it less confusing.
Member

The description is a bit confusing.

Oh, sorry, I was confusing myself! Your description was very clear actually, I appreciated that but forgot to mention it in my comment. Thanks for that :) I meant the description of what the "WIP" tag means in Gitea.

>The description is a bit confusing. Oh, sorry, I was confusing myself! Your description was very clear actually, I appreciated that but forgot to mention it in my comment. Thanks for that :) I meant the description of what the "WIP" tag means in Gitea.
Member

Looks good. I'm a bit hesitant because the behavior will actually be different in 4.0 than what is implemented here now, but maybe that's ok (implementing what will be the behavior in 4.0 is too risky, because it requires some more internal changes). Also I can't really reproduce this in a debug build yet, because it's crashing earlier already. Probably because of a not-so-great implementation of ModifierSimulationCache::get_states_around_frame :/
Have you tried running this patch in a debug build?

Looks good. I'm a bit hesitant because the behavior will actually be different in 4.0 than what is implemented here now, but maybe that's ok (implementing what will be the behavior in 4.0 is too risky, because it requires some more internal changes). Also I can't really reproduce this in a debug build yet, because it's crashing earlier already. Probably because of a not-so-great implementation of `ModifierSimulationCache::get_states_around_frame` :/ Have you tried running this patch in a debug build?
Member

If there is consensus to have this in 3.6, please add it to the backport list #109399 (mentioning to use this PR in the remarks)

If there is consensus to have this in 3.6, please add it to the backport list #109399 (mentioning to use this PR in the remarks)
Author
First-time contributor

@JacquesLucke Hmm, you're right. The debug build crashes on ModifierSimulationCache::get_state_at_frame_for_write, assertion BLI_assert(frame > states_at_frames_.last()->frame);. Addition: this happens with and without this backport.

Not sure what to do about that tbh. In the end I'm just a end user trying to get a (simulation) node setup to work (an eye rig automatically looking at POIs in the scene, using a simulation zone for easing in and out) and in fact that works now. I don't have any C++ experience, I just looked at the 4.0 commits, tried to understand the (gist of) the passthrough code, adjusted that for 3.6 and ran make test to check that I didn't break anything. That's basically all I'm able to do at the moment.

Hopefully this PR can still serve as a starting point / timesaver for a fully working backport to 3.6.

@JacquesLucke Hmm, you're right. The debug build crashes on `ModifierSimulationCache::get_state_at_frame_for_write`, assertion `BLI_assert(frame > states_at_frames_.last()->frame);`. **Addition**: this happens with and without this backport. Not sure what to do about that tbh. In the end I'm just a end user trying to get a (simulation) node setup to work (an eye rig automatically looking at POIs in the scene, using a simulation zone for easing in and out) and in fact that works now. I don't have any C++ experience, I just looked at the 4.0 commits, tried to understand the (gist of) the passthrough code, adjusted that for 3.6 and ran `make test` to check that I didn't break anything. That's basically all I'm able to do at the moment. Hopefully this PR can still serve as a starting point / timesaver for a fully working backport to 3.6.
Author
First-time contributor

@lichtwerk Although @PratikPB2123 added this to the 3.6 LTS milestone last week, I'm not sure there is consensus on backporting this to 3.6 and personally I respect the fact that Simulation Nodes are a work in progress. This backport seemed doable, but if it can't be done, we'll just have to wait for 4.0.

However, 3.6 is an LTS version and simulation nodes are in it. So I think that the basis of it (an empty simulation zone) should work. End users who are experimenting with this new functionality will, like me, assume that they made a mistake in their node setup if their geometry disappears & animation stops working. So fixing this could save them a lot of time.

@lichtwerk Although @PratikPB2123 added this to the 3.6 LTS milestone last week, I'm not sure there is consensus on backporting this to 3.6 and personally I respect the fact that Simulation Nodes are a work in progress. This backport seemed doable, but if it can't be done, we'll just have to wait for 4.0. However, 3.6 is an LTS version and simulation nodes are in it. So I think that the basis of it (an empty simulation zone) should work. End users who are experimenting with this new functionality will, like me, assume that they made a mistake in their node setup if their geometry disappears & animation stops working. So fixing this could save them a lot of time.
Member

I'm unable to reproduce the issue in current 3.6 (e55ca270e2). Can you still reproduce it? Can you try to find precise reproduction steps (more than just "scrub through the timeline")?

I'm unable to reproduce the issue in current 3.6 (e55ca270e2c37ebbfd09858ba9ec36e9a5361b37). Can you still reproduce it? Can you try to find precise reproduction steps (more than just "scrub through the timeline")?
Author
First-time contributor

@JacquesLucke
(edit: removed "assertion still failing", I was wrong).
Commit e55ca270e2 does indeed seem to fix #111978. I can no longer reproduce it in this version, both in test files and my real animations.

@JacquesLucke (**edit**: removed "assertion still failing", I was wrong). Commit https://projects.blender.org/blender/blender/commit/e55ca270e2c37ebbfd09858ba9ec36e9a5361b37 does indeed seem to fix https://projects.blender.org/blender/blender/issues/111978. I can no longer reproduce it in this version, both in test files and my real animations.
Author
First-time contributor

@JacquesLucke One remark: I do see geometry disappearing at frame 0 regularly (but not always, see below) but I assume that could be by design (although from a user's point of view, running an empty simulation, or running "set position" zero times should still pass through the original geometry, even at frame 0).
It is a bit "on and off" though: when there is a single cache, clicking from within that cache back to 0 makes the geometry disappear. Clicking on a further uncached frame e.g. 20, then back to 0 will preserve the geometry (probably because the caches are reset). See screencast.

@JacquesLucke One remark: I do see geometry disappearing at frame 0 regularly (but not always, see below) but I assume that could be by design (although from a user's point of view, running an empty simulation, or running "set position" zero times should still pass through the original geometry, even at frame 0). It is a bit "on and off" though: when there is a single cache, clicking from within that cache back to 0 makes the geometry disappear. Clicking on a further uncached frame e.g. 20, then back to 0 will preserve the geometry (probably because the caches are reset). See screencast.
Member

I see. If this patch fixes "just that", then I'd probably not commit it to 3.6, because it's a bit too risky (changes things in non-trivial ways).

I see. If this patch fixes "just that", then I'd probably not commit it to 3.6, because it's a bit too risky (changes things in non-trivial ways).
Author
First-time contributor

Totally agree. The only purpose of this PR was to save you time when backporting the fix from 4.0 to 3.6. But apparently there were other problems (the failing assertion from #112363) and now that commit e55ca270e2 fixes (most of) #111978, this PR is obsolete.

Totally agree. The only purpose of this PR was to save you time when backporting the fix from 4.0 to 3.6. But apparently there were other problems (the failing assertion from https://projects.blender.org/blender/blender/pulls/112363) and now that commit https://projects.blender.org/blender/blender/commit/e55ca270e2c37ebbfd09858ba9ec36e9a5361b37 fixes (most of) https://projects.blender.org/blender/blender/issues/111978, this PR is obsolete.
MKRelax closed this pull request 2023-09-15 10:14:29 +02:00
Some checks failed
buildbot/vexp-code-patch-coordinator Build done.

Pull request closed

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
4 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#112110
No description provided.