freezes when entering edit mode with active geometry nodes #87554

Closed
opened 2021-04-16 09:19:02 +02:00 by kaiwas · 6 comments

System Information
Operating system: Linux-5.4.108-1-MANJARO-x86_64-with-glibc2.33 64 Bits
Graphics card: GeForce GTX 660/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 460.67

Blender Version
Broken: version: 2.93.0 Beta, branch: master, commit date: 2021-04-15 17:14, hash: fa8d566c3b
Worked: (newest version of Blender that worked as expected)

Short description of error
the program hangs when entering edit mode with active geometry nodes.

If you turn off the visibility of the modifier, then the problem disappears.

Peek 2021-04-16 10-10.gif

Exact steps for others to reproduce the error
[Based on the default startup or an attached .blend file (as simple as possible)]

bug2.blend

**System Information** Operating system: Linux-5.4.108-1-MANJARO-x86_64-with-glibc2.33 64 Bits Graphics card: GeForce GTX 660/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 460.67 **Blender Version** Broken: version: 2.93.0 Beta, branch: master, commit date: 2021-04-15 17:14, hash: `fa8d566c3b` Worked: (newest version of Blender that worked as expected) **Short description of error** the program hangs when entering edit mode with active geometry nodes. If you turn off the visibility of the modifier, then the problem disappears. ![Peek 2021-04-16 10-10.gif](https://archive.blender.org/developer/F9935625/Peek_2021-04-16_10-10.gif) **Exact steps for others to reproduce the error** [Based on the default startup or an attached .blend file (as simple as possible)] [bug2.blend](https://archive.blender.org/developer/F9935627/bug2.blend)
Author

Added subscriber: @kaiwas

Added subscriber: @kaiwas
Member

Added subscribers: @howardt, @JacquesLucke

Added subscribers: @howardt, @JacquesLucke
Member

Looks like there is an O(n^2) algorithm in the boolean code. The issue seems to be that many faces are on the same plane.
Note, the file from the original report might not show the issue anymore, because there was another bug that was fixed in 1266df87c8.

Here is a more simplified file:
boolean_quadratic.blend

image.png

Adding some prints shows the quadratic behavior:

diff --git a/source/blender/blenlib/intern/mesh_intersect.cc b/source/blender/blenlib/intern/mesh_intersect.cc
index ce3a5b55f98..f64519cb24f 100644
--- a/source/blender/blenlib/intern/mesh_intersect.cc
+++ b/source/blender/blenlib/intern/mesh_intersect.cc
@@ -1852,6 +1852,7 @@ static IMesh extract_subdivided_tri(const CDT_data &cd,
 {
   const CDT_result<mpq_class> &cdt_out = cd.cdt_out;
   int t_in_cdt = -1;
+  std::cout << "a: " << cd.input_face.size() << "\n";
   for (int i = 0; i < cd.input_face.size(); ++i) {
     if (cd.input_face[i] == t) {
       t_in_cdt = i;
@@ -1865,6 +1866,7 @@ static IMesh extract_subdivided_tri(const CDT_data &cd,
   int t_orig = in_tm.face(t)->orig;
   constexpr int inline_buf_size = 20;
   Vector<Face *, inline_buf_size> faces;
+  std::cout << "b: " << cdt_out.face.size() << "\n";
   for (int f : cdt_out.face.index_range()) {
     if (cdt_out.face_orig[f].contains(t_in_cdt)) {
       BLI_assert(cdt_out.face[f].size() == 3);
@@ -2638,6 +2640,7 @@ IMesh trimesh_nary_intersect(const IMesh &tm_in,
 #  endif
   for (int t : tm_clean->face_index_range()) {
     int c = clinfo.tri_cluster(t);
+    std::cout << t << "\n";
     if (c != NO_INDEX) {
       BLI_assert(tri_subdivided[t].face_size() == 0);
       tri_subdivided[t] = extract_subdivided_tri(cluster_subdivided[c], *tm_clean, t, arena);

The output ends with

507
a: 512
b: 512
508
a: 512
b: 512
509
a: 512
b: 512
510
a: 512
b: 512
511
a: 512
b: 512

This might also be related to #87505.

Looks like there is an O(n^2) algorithm in the boolean code. The issue seems to be that many faces are on the same plane. Note, the file from the original report might not show the issue anymore, because there was another bug that was fixed in 1266df87c8. Here is a more simplified file: [boolean_quadratic.blend](https://archive.blender.org/developer/F9935822/boolean_quadratic.blend) ![image.png](https://archive.blender.org/developer/F9935823/image.png) Adding some prints shows the quadratic behavior: ``` diff --git a/source/blender/blenlib/intern/mesh_intersect.cc b/source/blender/blenlib/intern/mesh_intersect.cc index ce3a5b55f98..f64519cb24f 100644 --- a/source/blender/blenlib/intern/mesh_intersect.cc +++ b/source/blender/blenlib/intern/mesh_intersect.cc @@ -1852,6 +1852,7 @@ static IMesh extract_subdivided_tri(const CDT_data &cd, { const CDT_result<mpq_class> &cdt_out = cd.cdt_out; int t_in_cdt = -1; + std::cout << "a: " << cd.input_face.size() << "\n"; for (int i = 0; i < cd.input_face.size(); ++i) { if (cd.input_face[i] == t) { t_in_cdt = i; @@ -1865,6 +1866,7 @@ static IMesh extract_subdivided_tri(const CDT_data &cd, int t_orig = in_tm.face(t)->orig; constexpr int inline_buf_size = 20; Vector<Face *, inline_buf_size> faces; + std::cout << "b: " << cdt_out.face.size() << "\n"; for (int f : cdt_out.face.index_range()) { if (cdt_out.face_orig[f].contains(t_in_cdt)) { BLI_assert(cdt_out.face[f].size() == 3); @@ -2638,6 +2640,7 @@ IMesh trimesh_nary_intersect(const IMesh &tm_in, # endif for (int t : tm_clean->face_index_range()) { int c = clinfo.tri_cluster(t); + std::cout << t << "\n"; if (c != NO_INDEX) { BLI_assert(tri_subdivided[t].face_size() == 0); tri_subdivided[t] = extract_subdivided_tri(cluster_subdivided[c], *tm_clean, t, arena); ``` The output ends with ``` 507 a: 512 b: 512 508 a: 512 b: 512 509 a: 512 b: 512 510 a: 512 b: 512 511 a: 512 b: 512 ``` This might also be related to #87505.
Howard Trickey self-assigned this 2021-04-30 15:54:58 +02:00
Member

I will remove this quadratic behavior.

I will remove this quadratic behavior.

This issue was referenced by 28bf1d4037

This issue was referenced by 28bf1d4037496397e3bc5d69ce51d8ac9b8a2738
Member

Changed status from 'Needs Triage' to: 'Resolved'

Changed status from 'Needs Triage' 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
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#87554
No description provided.