Crash when animating Viewport visibility of Curves / GPv3 object #113182

Closed
opened 2023-10-03 04:09:57 +02:00 by Diego Verger · 8 comments

System Information
Operating system: Linux-6.2.0-33-generic-x86_64-with-glibc2.37 64 Bits, X11 UI
Graphics card: NVIDIA GeForce RTX 2060/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 470.199.02

Blender Version
Broken: version: 4.1.0 Alpha, branch: main, commit date: 2023-10-02 23:22, hash: 77057e90c936

Short description of error
There is a crash when you re-enable viewport visibility of a hair curve, if it is keyframed first.

Exact steps for others to reproduce the error

  1. Select default cube
  2. Add Curve > Fur
  3. Outliner > Click on the Curve object's "Disable in Viewports" icon
  4. Hit I key over Disable in Viewports to set key
  5. Click on Disable in Viewports

Please find attached an example file ready to be crashed with step 5.

Thank you.

**System Information** Operating system: Linux-6.2.0-33-generic-x86_64-with-glibc2.37 64 Bits, X11 UI Graphics card: NVIDIA GeForce RTX 2060/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 470.199.02 **Blender Version** Broken: version: 4.1.0 Alpha, branch: main, commit date: 2023-10-02 23:22, hash: `77057e90c936` **Short description of error** There is a crash when you re-enable viewport visibility of a hair curve, if it is keyframed first. **Exact steps for others to reproduce the error** 1. Select default cube 2. Add Curve > Fur 3. Outliner > Click on the Curve object's "Disable in Viewports" icon 4. Hit I key over Disable in Viewports to set key 5. Click on Disable in Viewports Please find attached an example file ready to be crashed with step 5. Thank you.
Diego Verger added the
Severity
Normal
Type
Report
Status
Needs Triage
labels 2023-10-03 04:09:57 +02:00
Member

Hi, thanks for the report. Can confirm the crash (present since introduction of new hair curves)

>	blender.exe!blender::draw::curves_batch_cache_valid(const Curves & curves) Line 80	C++
 	blender.exe!DRW_curves_batch_cache_validate(Curves * curves) Line 682	C++
 	blender.exe!drw_batch_cache_validate(Object * ob) Line 3328	C++
 	blender.exe!drw_engines_cache_populate(Object * ob) Line 1075	C++
 	blender.exe!DRW_draw_render_loop_ex(Depsgraph * depsgraph, RenderEngineType * engine_type, ARegion * region, View3D * v3d, GPUViewport * viewport, const bContext * evil_C) Line 1727	C++
 	blender.exe!DRW_draw_view(const bContext * C) Line 1632	C++
 	blender.exe!view3d_draw_view(const bContext * C, ARegion * region) Line 1596	C++
 	blender.exe!view3d_main_region_draw(const bContext * C, ARegion * region) Line 1631	C++
 	blender.exe!ED_region_do_draw(bContext * C, ARegion * region) Line 537	C++
 	blender.exe!wm_draw_window_offscreen(bContext * C, wmWindow * win, bool stereo) Line 1001	C++
 	blender.exe!wm_draw_window(bContext * C, wmWindow * win) Line 1169	C++
 	blender.exe!wm_draw_update(bContext * C) Line 1565	C++
 	blender.exe!WM_main(bContext * C) Line 616	C++
 	blender.exe!main(int argc, const char * * __formal) Line 593	C++
Hi, thanks for the report. Can confirm the crash (present since introduction of new hair curves) ``` > blender.exe!blender::draw::curves_batch_cache_valid(const Curves & curves) Line 80 C++ blender.exe!DRW_curves_batch_cache_validate(Curves * curves) Line 682 C++ blender.exe!drw_batch_cache_validate(Object * ob) Line 3328 C++ blender.exe!drw_engines_cache_populate(Object * ob) Line 1075 C++ blender.exe!DRW_draw_render_loop_ex(Depsgraph * depsgraph, RenderEngineType * engine_type, ARegion * region, View3D * v3d, GPUViewport * viewport, const bContext * evil_C) Line 1727 C++ blender.exe!DRW_draw_view(const bContext * C) Line 1632 C++ blender.exe!view3d_draw_view(const bContext * C, ARegion * region) Line 1596 C++ blender.exe!view3d_main_region_draw(const bContext * C, ARegion * region) Line 1631 C++ blender.exe!ED_region_do_draw(bContext * C, ARegion * region) Line 537 C++ blender.exe!wm_draw_window_offscreen(bContext * C, wmWindow * win, bool stereo) Line 1001 C++ blender.exe!wm_draw_window(bContext * C, wmWindow * win) Line 1169 C++ blender.exe!wm_draw_update(bContext * C) Line 1565 C++ blender.exe!WM_main(bContext * C) Line 616 C++ blender.exe!main(int argc, const char * * __formal) Line 593 C++ ```
Member

Same is true for GPv3

Same is true for GPv3
Philipp Oeser changed title from Crash when animating Viewport visibility of Hair Curve object to Crash when animating Viewport visibility of Curves / GPv3 object 2023-10-04 11:34:33 +02:00
Philipp Oeser added the
Interest
Grease Pencil
label 2023-10-04 11:34:40 +02:00
Member

Will dare setting this to High priority since this is a crasher which is not so uncommon to run into

Will dare setting this to High priority since this is a crasher which is not so uncommon to run into
Philipp Oeser added
Severity
High
and removed
Severity
Normal
labels 2024-02-13 15:12:04 +01:00
Member

The issue is that DEG_OBJECT_ITER is yielding an OB_CURVES Object with null data, which AFAIK shouldn't happen.
We can add a workaround at the draw module level, but I think this should be probably solved on the dependency graph side?
@Sergey @mont29 ?

The issue is that `DEG_OBJECT_ITER` is yielding an `OB_CURVES` `Object` with null data, which AFAIK shouldn't happen. We can add a workaround at the draw module level, but I think this should be probably solved on the dependency graph side? @Sergey @mont29 ?

This indeed seems to be either a depsgraph, or curves evaluation code issue. Maybe @JacquesLucke is the best man to take investigation further here then?

This indeed seems to be either a depsgraph, or curves evaluation code issue. Maybe @JacquesLucke is the best man to take investigation further here then?
Bastien Montagne added
Interest
Dependency Graph
Type
Bug
and removed
Type
Report
labels 2024-03-08 10:00:17 +01:00
Member

The bug seems to affect all geometry types, not just curves. The difference is that it crashes with curves while for other types the behavior is "just" wrong.

Steps to reproduce on a mesh object:

  1. Open the file below.
  2. Click on (already animated) disable icon in the outliner.
  3. Notice the default cube is shown in the viewport. The wireframe modifier on the cube is not evaluated.

I couldn't quite find the root cause so far, because I don't have a deep enough understanding of how the dynamic visibility stuff works yet. Maybe @Sergey has some insight into what might go wrong here.

The bug seems to affect all geometry types, not just curves. The difference is that it crashes with curves while for other types the behavior is "just" wrong. Steps to reproduce on a mesh object: 1. Open the file below. 2. Click on (already animated) disable icon in the outliner. 3. Notice the default cube is shown in the viewport. The wireframe modifier on the cube is *not* evaluated. I couldn't quite find the root cause so far, because I don't have a deep enough understanding of how the dynamic visibility stuff works yet. Maybe @Sergey has some insight into what might go wrong here.

This is an oversight of the animated visibility optimization in the dependency graph, which tries to skip evaluation of hidden objects as much as possible. The dependency graph tracks what is being visible, or affects visible, and skips evaluation of operations which do not affect anything visible. It relies on the OperationNode::flag & DEPSOP_FLAG_NEEDS_UPDATE to be preserved to "recover" from situation when something got skipped from evaluation, but is needed later on.

What happens with the case from this report, is that the object is first partially evaluated as hidden, the geometry component is skipped. But with the manual edit of the viewport visibility the graph is tagged for relations update, which looses the operation's flags.

A quick mitigation for this is to add

  for (const OperationNode *op_node : graph_->operations) {
    if (op_node->flag & DEPSOP_FLAG_NEEDS_UPDATE) {
      saved_entry_tags_.append_as(op_node);
    }
  }

in the DepsgraphNodeBuilder::begin_build (after the for (const OperationNode *op_node : graph_->entry_tags) {).

The downside of such quick change is that all tags will be considered as DEPSOP_FLAG_DIRECTLY_MODIFIED and DEPSOP_FLAG_USER_MODIFIED, potentially clearing automatic caches. So to be safe, would be good to somehow preserve the direct/user modified flags somehow. Shouldn't be very hard.

@JacquesLucke Is it something you can/want/have time for to dig a bit deeper? :)

This is an oversight of the animated visibility optimization in the dependency graph, which tries to skip evaluation of hidden objects as much as possible. The dependency graph tracks what is being visible, or affects visible, and skips evaluation of operations which do not affect anything visible. It relies on the `OperationNode::flag & DEPSOP_FLAG_NEEDS_UPDATE` to be preserved to "recover" from situation when something got skipped from evaluation, but is needed later on. What happens with the case from this report, is that the object is first partially evaluated as hidden, the geometry component is skipped. But with the manual edit of the viewport visibility the graph is tagged for relations update, which looses the operation's flags. A quick mitigation for this is to add ``` for (const OperationNode *op_node : graph_->operations) { if (op_node->flag & DEPSOP_FLAG_NEEDS_UPDATE) { saved_entry_tags_.append_as(op_node); } } ``` in the `DepsgraphNodeBuilder::begin_build` (after the `for (const OperationNode *op_node : graph_->entry_tags) {`). The downside of such quick change is that all tags will be considered as `DEPSOP_FLAG_DIRECTLY_MODIFIED` and `DEPSOP_FLAG_USER_MODIFIED`, potentially clearing automatic caches. So to be safe, would be good to somehow preserve the direct/user modified flags somehow. Shouldn't be very hard. @JacquesLucke Is it something you can/want/have time for to dig a bit deeper? :)
Member

Thanks for checking. I'd prefer it if you could try to come up with a proper fix. If you don't have time for this soonish, I can look into it again, sure.

Thanks for checking. I'd prefer it if you could try to come up with a proper fix. If you don't have time for this soonish, I can look into it again, sure.
Jacques Lucke added
Module
Core
and removed
Module
Viewport & EEVEE
labels 2024-04-10 15:11:39 +02:00
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2024-04-10 16:26:47 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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 & 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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
7 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#113182
No description provided.