Changes of rigid body related settings during simulation will break the simulation (worked in 2.78c) #52374

Closed
opened 2017-08-13 02:47:15 +02:00 by Kai Kostack · 17 comments

System Information
Win7 x64

Blender Version
Broken: 2.79 RC (Master since between April and Juli)
Worked: 2.78c

Short description of error
Rigid body physics doesn't allow changes of related settings during simulation anymore. Either on mesh objects itself or on constraint objects a change immediately invalidates the simulation point cache and everything is lost.

Changing settings of physics during simulation is a crucial part for VFX work. This has been possible since Bullet is accessible from viewport, it was fully supported by Blender and Bullet in all past Blender releases. Also this breaks some Bullet related add-ons like the Bullet Constraints Builder on a fundamental level.

Exact steps for others to reproduce the error

  • Add rigid body property to the default cube
  • Start simulation and change mass of the object during simulation
    Expected behavior: Cube continues to drop without noticeable influence
    Current behavior: Cube suddenly jumps out of frame, orange cache indicator in timeline disappears

rb-cube.blend

**System Information** Win7 x64 **Blender Version** Broken: 2.79 RC (Master since between April and Juli) Worked: 2.78c **Short description of error** Rigid body physics doesn't allow changes of related settings during simulation anymore. Either on mesh objects itself or on constraint objects a change immediately invalidates the simulation point cache and everything is lost. Changing settings of physics during simulation is a crucial part for VFX work. This has been possible since Bullet is accessible from viewport, it was fully supported by Blender and Bullet in all past Blender releases. Also this breaks some Bullet related add-ons like the Bullet Constraints Builder on a fundamental level. **Exact steps for others to reproduce the error** - Add rigid body property to the default cube - Start simulation and change mass of the object during simulation Expected behavior: Cube continues to drop without noticeable influence Current behavior: Cube suddenly jumps out of frame, orange cache indicator in timeline disappears [rb-cube.blend](https://archive.blender.org/developer/F708806/rb-cube.blend)
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @KaiKostack-3

Added subscriber: @KaiKostack-3

#52216 was marked as duplicate of this issue

#52216 was marked as duplicate of this issue

#52457 was marked as duplicate of this issue

#52457 was marked as duplicate of this issue

Added subscribers: @LucaRood-3, @Sergey

Added subscribers: @LucaRood-3, @Sergey
Luca Rood was assigned by Sergey Sharybin 2017-08-14 15:23:17 +02:00

Another physics issue for @LucaRood-3!

Another physics issue for @LucaRood-3!
Member

Added subscribers: @MichaelDanielson, @brecht, @mont29

Added subscribers: @MichaelDanielson, @brecht, @mont29
Member

Added subscribers: @akej74, @SteffenD

Added subscribers: @akej74, @SteffenD
Member

Added subscriber: @jta

Added subscriber: @jta
Member

Ummmm, ya, this is a bad thing....

Ummmm, ya, this is a bad thing....
Author

Hey @LucaRood-3, if there is no further fix to be expected, can you revert the changes leading to this serious issue now for the release please?

Commits:
9cd6b03187
3edc8c1f9b
b87d10d4fe

Hey @LucaRood-3, if there is no further fix to be expected, can you revert the changes leading to this serious issue now for the release please? Commits: 9cd6b03187b91bb2c267a45eac3cee7738e0e220 3edc8c1f9bc625547fc234b8dbe613f3b60c0eb4 b87d10d4fe4df2d87d3acdd366f4bd5e2d1350fb

This issue was referenced by 4ad5df8858

This issue was referenced by 4ad5df885820f5f589e78d01ff3d53dd34546b31

Added subscriber: @sreich

Added subscriber: @sreich

Can someone test this patch to make sure it fixes this and #50230 before I commit?

diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index 167b3ad1fec..03eb83376e7 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -1596,8 +1596,12 @@ void BKE_rigidbody_do_simulation(Scene *scene, float ctime)
 	BKE_ptcache_id_time(&pid, scene, ctime, &startframe, &endframe, NULL);
 	cache = rbw->pointcache;
 
+	if (ctime <= startframe) {
+		rbw->ltime = startframe;
+		return;
+	}
 	/* make sure we don't go out of cache frame range */
-	if (ctime > endframe) {
+	else if (ctime > endframe) {
 		ctime = endframe;
 	}
 
@@ -1611,12 +1615,9 @@ void BKE_rigidbody_do_simulation(Scene *scene, float ctime)
 	// RB_TODO deal with interpolated, old and baked results
 	bool can_simulate = (ctime == rbw->ltime + 1) && !(cache->flag & PTCACHE_BAKED);
 
-	if (cache->flag & PTCACHE_OUTDATED || cache->last_exact == 0) {
-		rbw->ltime = cache->startframe;
-	}
-
-	if (BKE_ptcache_read(&pid, ctime, can_simulate)) {
+	if (BKE_ptcache_read(&pid, ctime, can_simulate) == PTCACHE_READ_EXACT) {
 		BKE_ptcache_validate(cache, (int)ctime);
+		rbw->ltime = ctime;
 		return;
 	}
 
Can someone test this patch to make sure it fixes this and #50230 before I commit? ``` diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index 167b3ad1fec..03eb83376e7 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -1596,8 +1596,12 @@ void BKE_rigidbody_do_simulation(Scene *scene, float ctime) BKE_ptcache_id_time(&pid, scene, ctime, &startframe, &endframe, NULL); cache = rbw->pointcache; + if (ctime <= startframe) { + rbw->ltime = startframe; + return; + } /* make sure we don't go out of cache frame range */ - if (ctime > endframe) { + else if (ctime > endframe) { ctime = endframe; } @@ -1611,12 +1615,9 @@ void BKE_rigidbody_do_simulation(Scene *scene, float ctime) // RB_TODO deal with interpolated, old and baked results bool can_simulate = (ctime == rbw->ltime + 1) && !(cache->flag & PTCACHE_BAKED); - if (cache->flag & PTCACHE_OUTDATED || cache->last_exact == 0) { - rbw->ltime = cache->startframe; - } - - if (BKE_ptcache_read(&pid, ctime, can_simulate)) { + if (BKE_ptcache_read(&pid, ctime, can_simulate) == PTCACHE_READ_EXACT) { BKE_ptcache_validate(cache, (int)ctime); + rbw->ltime = ctime; return; } ```

Also found another bug unrelated to this which was introduced after 2.78 and is in the RC (baking is broken).
Will look into it later today.

Also found another bug unrelated to this which was introduced after 2.78 and is in the RC (baking is broken). Will look into it later today.
Author

The issue seems to be solved by this patch. Thanks for taking care of it.

The issue seems to be solved by this patch. Thanks for taking care of it.

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sign in to join this conversation.
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
6 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#52374
No description provided.