New complex solidify algorithm handles poorly merging threshold of small geometry details. #75032

Closed
opened 2020-03-23 15:20:59 +01:00 by Bastien Montagne · 9 comments

Using same file from #74195: bug_svg_solidify_03.blend

  • Open the file
  • Set curve precision to 15 and increment the value further.

Notice how incrementally bigger and bigger chunks of the geometry get merged together.

Think there are two issues there:

  • Merge threshold seems to be a constant, non-editable value currently. It should either be exposed to user (as many other places in Blender), and/or made "smart" by adjusting its value to the global size of the geometry (using eg the farthest vertex from origin, or something like that).
  • Merge algorithm itself looks somewhat broken, as it seems to merge more and more geometry, leading to serious loss of details when the vertex density gets high.

Note: noticed while reviewing D7214.

Using same file from #74195: [bug_svg_solidify_03.blend](https://archive.blender.org/developer/F8369236/bug_svg_solidify_03.blend) - Open the file - Set curve precision to 15 and increment the value further. # Notice how incrementally bigger and bigger chunks of the geometry get merged together. Think there are two issues there: - Merge threshold seems to be a constant, non-editable value currently. It should either be exposed to user (as many other places in Blender), and/or made "smart" by adjusting its value to the global size of the geometry (using eg the farthest vertex from origin, or something like that). - Merge algorithm itself looks somewhat broken, as it seems to merge more and more geometry, leading to serious loss of details when the vertex density gets high. *Note: noticed while reviewing [D7214](https://archive.blender.org/developer/D7214).*
Henrik D. was assigned by Bastien Montagne 2020-03-23 15:20:59 +01:00
Author
Owner

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

Changed status from 'Needs Triage' to: 'Confirmed'
Author
Owner

Added subscriber: @mont29

Added subscriber: @mont29
Member

the chain merging is a technical limitation that I also noticed during testing your file.

I would like to get a second opinion how to fix that, so I will explain here why that is the case and why merging is sooo important.

My algorithm sorts faces around an edge by angle. To do so it needs a normalised direction vector of the edge.
If vertices are really close normalization might fail or come out with very poor precision. Thats why merging is important.
Merging is then done edge by edge. So it would start in element order with the first edge and check if it should merge it and
then go over to the next one and so on. The merge will always prefer the vertex with the smaller index (I think there was a reason but I forgot...)
The problem arises if the next edge is the one that has the vertex that the previous edge is merged to, because then, that edge
needs to be collapsed as well and that can chain through infinitly many vertices.

The main ways to fix it that I can think of right now are the following:

  • randomize the order to check the edges in a deterministic way
    • pro: it would fix the issue without too much overhead
    • contra: it would be unpredictable by the user (but I don't think thats really bad)
  • merge vertices to the center of the edge
    • pro: it would be predictable and stable
    • contra: would require yet one more copy of the vertex data

after writing this I see merge to center as the way to go, but feel free to add an idea to the list.

After all keep in mind that the degenerate feature of solidify is not meant for dissolving, just to handle degenerate cases.

the chain merging is a technical limitation that I also noticed during testing your file. I would like to get a second opinion how to fix that, so I will explain here why that is the case and why merging is sooo important. My algorithm sorts faces around an edge by angle. To do so it needs a normalised direction vector of the edge. If vertices are really close normalization might fail or come out with very poor precision. Thats why merging is important. Merging is then done edge by edge. So it would start in element order with the first edge and check if it should merge it and then go over to the next one and so on. The merge will always prefer the vertex with the smaller index (I think there was a reason but I forgot...) The problem arises if the next edge is the one that has the vertex that the previous edge is merged to, because then, that edge needs to be collapsed as well and that can chain through infinitly many vertices. The main ways to fix it that I can think of right now are the following: - randomize the order to check the edges in a deterministic way - pro: it would fix the issue without too much overhead - contra: it would be unpredictable by the user (but I don't think thats really bad) - merge vertices to the center of the edge - pro: it would be predictable and stable - contra: would require yet one more copy of the vertex data after writing this I see merge to center as the way to go, but feel free to add an idea to the list. After all keep in mind that the degenerate feature of solidify is not meant for dissolving, just to handle degenerate cases.
Member

also... How do I add a field to struct SolidifyModifierData in DNA_modifier_types.h ?
I feel like just making it longer would mess with things. Last time I used the padding (the char _pad- [x] is now a char _pad and my mode data is stored there instead). This time there is definitly not the space for an additional float value for the precision user input.

also... How do I add a field to `struct SolidifyModifierData` in DNA_modifier_types.h ? I feel like just making it longer would mess with things. Last time I used the padding (the char _pad- [x] is now a char _pad and my mode data is stored there instead). This time there is definitly not the space for an additional float value for the precision user input.
Member

Added subscriber: @HooglyBoogly

Added subscriber: @HooglyBoogly
Member

It should be fine to make DNA structs longer. The DNA system / readfile can handle that fine.

It should be fine to make DNA structs longer. The DNA system / readfile can handle that fine.
Author
Owner

Regarding DNA, yes, just add some new value, and for 32bits things (like floats or ints), group them by two to get 64bits (that means that if you only need one float, you need to add another char _pad2- [x] just after it).

note that by default DNA will init that one to zero when loading a file from a version where it did not exist, so if you need a different default value you'll have to edit the versioning file (just look at surrounding code for examples of how to do it exactly).

Regarding merging, I indeed think that merging at the center of the edge is the best way to go.

Regarding DNA, yes, just add some new value, and for 32bits things (like floats or ints), group them by two to get 64bits (that means that if you only need one float, you need to add another `char _pad2- [x]` just after it). note that by default DNA will init that one to zero when loading a file from a version where it did not exist, so if you need a different default value you'll have to edit the versioning file (just look at surrounding code for examples of how to do it exactly). Regarding merging, I indeed think that merging at the center of the edge is the best way to go.

This issue was referenced by 5cf7283342

This issue was referenced by 5cf72833429f4c63d27ea0a72878af1fec6dcf4e
Author
Owner

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' 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#75032
No description provided.