mathutils.geometry.points_in_planes: hardcoded precision set too high #120862

Closed
opened 2024-04-20 20:15:18 +02:00 by Dmitry C. · 3 comments

System: Windows 10
Broken: Blender 2.79 - 4.1.1
Worked: never?

Short description of error
The operation returns all points of intersection for given planes.

The epsilon for checking if a vertex lies on a plane is too small, which often leads to the planes cutting off their own verts if more than three planes meet at the same point.

I'm attaching a .blend file (2.79) with text editor script that illustrates the problem and contrasts the behavior with the same function ported to python (with custom precision).

Notably, Blender versions prior to 2.9 seem to have even worse issues than the current 4.1. I'm guessing the face normals were made more accurate between 2.8 and 2.9.

It seems like the operation was custom-made for the Cell Fracture addon (in Blender 2.64). The addon uses it to generate random cells for cutting into a mesh, so a lost vert here and there doesn't matter much. For other applications, the precision not being exposed renders the operation practically unusable.

Additionally, unrelated to this operation, the Cell Fracture addon makes heavy use of booleans which default to "Exact" solver without "Self Intersection". This leads to missing chunks on more complex meshes (for example, the Blender demo basemeshes). Switching to "Fast" solver would improve both performance and reliability. A single line fix.

System: Windows 10 Broken: Blender 2.79 - 4.1.1 Worked: never? **Short description of error** The operation returns all points of intersection for given planes. The epsilon for checking if a vertex lies on a plane is too small, which often leads to the planes cutting off their own verts if more than three planes meet at the same point. I'm attaching a .blend file (2.79) with text editor script that illustrates the problem and contrasts the behavior with the same function ported to python (with custom precision). Notably, Blender versions prior to 2.9 seem to have even worse issues than the current 4.1. I'm guessing the face normals were made more accurate between 2.8 and 2.9. It seems like the operation was custom-made for the Cell Fracture addon (in Blender 2.64). The addon uses it to generate random cells for cutting into a mesh, so a lost vert here and there doesn't matter much. For other applications, the precision not being exposed renders the operation practically unusable. Additionally, unrelated to this operation, the Cell Fracture addon makes heavy use of booleans which default to "Exact" solver without "Self Intersection". This leads to missing chunks on more complex meshes (for example, the Blender demo basemeshes). Switching to "Fast" solver would improve both performance and reliability. A single line fix.
Dmitry C. added the
Type
Report
Priority
Normal
Status
Needs Triage
labels 2024-04-20 20:15:18 +02:00
Iliya Katushenock added the
Interest
Modeling
label 2024-04-20 20:17:29 +02:00
Member

Can confirm. It does seem that this kind of epsilon values has to be tuned for individual usages and not a one-value-fits-all. And thank you very much for the detailed script for reproduction 👍

Looks like M_Geometry_points_in_planes is already VA_ARG... Might need a new function that takes thresholds first (or everything as named variables)? This way we can keep old code working and supply custom thresholds as needed. I could take a look on how to achieve this. cc @JacquesLucke @ideasman42

Can confirm. It does seem that this kind of epsilon values has to be tuned for individual usages and not a one-value-fits-all. And thank you very much for the detailed script for reproduction 👍 Looks like `M_Geometry_points_in_planes` is already VA_ARG... Might need a new function that takes thresholds first (or everything as named variables)? This way we can keep old code working and supply custom thresholds as needed. I could take a look on how to achieve this. cc @JacquesLucke @ideasman42
YimingWu added
Module
Python API
Status
Confirmed
and removed
Status
Needs Triage
labels 2024-04-22 04:46:39 +02:00

Planes is only a single argument, so having two optional epsilon arguments seems reasonable.

Planes is only a single argument, so having two optional epsilon arguments seems reasonable.
Member

Oh I see it's a single argument of a list. I guess I could add some named arguments too.

Oh I see it's a single argument of a list. I guess I could add some named arguments too.
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2024-04-24 09:38:36 +02:00
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
3 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#120862
No description provided.