Freezes when jumping in front of a keyframe. #38870

Closed
opened 2014-02-27 14:25:22 +01:00 by Rick Globe · 15 comments

System Information
Win7 Enterprise, Radeon X850

Blender Version
Broken: 2.69

Short description of error
Freezing when jumping before a frame.

Exact steps for others to reproduce the error

see file for details: vis.blend

I have a cube that's Z scale is controlled by an F-curve that was baked from a sound (mp3 to be precise, using the default settings, RHCP:Body of Water, if that means anything :) )
I also added the song to a speaker that I parented to the camera (for easier editing).
When I jump after a certain frame and want to go back before it, Blender freezes.

**System Information** Win7 Enterprise, Radeon X850 **Blender Version** Broken: 2.69 **Short description of error** Freezing when jumping before a frame. **Exact steps for others to reproduce the error** see file for details: [vis.blend](https://archive.blender.org/developer/F79125/vis.blend) I have a cube that's Z scale is controlled by an F-curve that was baked from a sound (mp3 to be precise, using the default settings, RHCP:Body of Water, if that means anything :) ) I also added the song to a speaker that I parented to the camera (for easier editing). When I jump after a certain frame and want to go back before it, Blender freezes.
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @PeterPronai

Added subscriber: @PeterPronai

Added subscriber: @mont29

Added subscriber: @mont29

Confirmed in current master as well…

Confirmed in current master as well…
Sergey Sharybin was assigned by Bastien Montagne 2014-02-27 19:29:50 +01:00

Added subscriber: @Sergey

Added subscriber: @Sergey

Note: to reproduce, you need a rather large gap, e.g. in given file, first click on frame 240, then on frame 10, locks 100% of time here. Also note the file has drivers…

Looks like we have a race condition here, in scene_update_objects, BLI_task_pool_work_and_wait() (line 1494) seems to wait indefinitely on BLI_condition_wait(&pool->num_cond, &pool->num_mutex); (line 383 in BLI's task.c). At least, that’s what says gdb.

@Sergey, think this is your area?

Note: to reproduce, you need a rather large gap, e.g. in given file, first click on frame 240, then on frame 10, locks 100% of time here. Also note the file has drivers… Looks like we have a race condition here, in scene_update_objects, BLI_task_pool_work_and_wait() (line 1494) seems to wait indefinitely on BLI_condition_wait(&pool->num_cond, &pool->num_mutex); (line 383 in BLI's task.c). At least, that’s what says gdb. @Sergey, think this is your area?

Developer note: that's not related on threaded update. Root of the issue is caused by count driver producing really huge values in some cases which makes array modifier work quite some time.

Developer note: that's not related on threaded update. Root of the issue is caused by count driver producing really huge values in some cases which makes array modifier work quite some time.
Sergey Sharybin was unassigned by Bastien Montagne 2014-02-28 09:17:13 +01:00
Bastien Montagne self-assigned this 2014-02-28 09:17:13 +01:00
Bastien Montagne was unassigned by Sergey Sharybin 2014-02-28 10:56:33 +01:00
Sergey Sharybin self-assigned this 2014-02-28 10:56:33 +01:00

Added subscriber: @brecht

Added subscriber: @brecht

Developer note:
Ok, the issue is coming from BKE_constraint_mat_convertspace() when converting world space to local one. This will get object world matrix and invert it. Now, when object does have zero scale across some axis it makes matrix uninvertible and gives verido results.

Now, the question is why do we need to get object matrix and normalize it? Wouldn't it be more mathematically robust to get rotation matrix and flip components which corresponds to negative scale components?

@brecht, afair you had quite same issues in Cycles, what was your solution there?

Developer note: Ok, the issue is coming from `BKE_constraint_mat_convertspace()` when converting world space to local one. This will get object world matrix and invert it. Now, when object does have zero scale across some axis it makes matrix uninvertible and gives verido results. Now, the question is why do we need to get object matrix and normalize it? Wouldn't it be more mathematically robust to get rotation matrix and flip components which corresponds to negative scale components? @brecht, afair you had quite same issues in Cycles, what was your solution there?

What we do in Cycles is add a small value to the diagonal in case computing the matrix inverse fails:

  if(!transform_matrix4_gj_inverse(R, M)) {
      /* matrix is degenerate (e.g. 0 scale on some axis), ideally we should
     * never be in this situation, but try to invert it anyway with tweak */
      M[0][0] += 1e-8f;
      M[1][1] += 1e-8f;
      M[2][2] += 1e-8f;
      if(!transform_matrix4_gj_inverse(R, M))
          return transform_identity();
  }

There's also a pseudoinverse_m4_m4 function in blenlib that you could use as a fallback instead of adding a value to the diagonal. That will actually keep the axis zero in the inverted matrix so I think it's more accurate but also slower..

What we do in Cycles is add a small value to the diagonal in case computing the matrix inverse fails: ``` if(!transform_matrix4_gj_inverse(R, M)) { /* matrix is degenerate (e.g. 0 scale on some axis), ideally we should ``` * never be in this situation, but try to invert it anyway with tweak */ ``` M[0][0] += 1e-8f; M[1][1] += 1e-8f; M[2][2] += 1e-8f; ``` ``` if(!transform_matrix4_gj_inverse(R, M)) return transform_identity(); } ``` There's also a `pseudoinverse_m4_m4` function in blenlib that you could use as a fallback instead of adding a value to the diagonal. That will actually keep the axis zero in the inverted matrix so I think it's more accurate but also slower..

Seems this http://www.pasteall.org/50452/diff solves the issue, but not sure whether it's really good idea to use pseudo-inverse performance-wise.

Seems this http://www.pasteall.org/50452/diff solves the issue, but not sure whether it's really good idea to use pseudo-inverse performance-wise.

This issue was referenced by blender/blender-addons-contrib@d4cc81d552

This issue was referenced by blender/blender-addons-contrib@d4cc81d5523b3e625b809baa4a57c73664fb13db

This issue was referenced by d4cc81d552

This issue was referenced by d4cc81d5523b3e625b809baa4a57c73664fb13db

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Closed by commit d4cc81d552.

Closed by commit d4cc81d552.
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
5 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#38870
No description provided.