Cell Fracture AddOn - Margin-Attitude don't works #93931

Open
opened 2021-12-10 09:16:09 +01:00 by August Humann · 10 comments

System Information
Operating system: Windows-10-10.0.19043-SP0 64 Bits
Graphics card: GeForce GTX 980 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 456.71

Blender Version
Broken: version: 3.0.0, branch: master, commit date: 2021-12-02 18:35, hash: blender/blender@f1cca30557
Worked: (newest version of Blender that worked as expected)

Addon Information
Name: Cell Fracture (0, 2)
Author: ideasman42, phymec, Sergey Sharybin

Short description of error
Margin in cell fracture setting is 0.0000. But result shows the Gap between greater (not 0.000).

Exact steps for others to reproduce the error

  • Open default scene
  • Enable Cell fracture addon
  • {nav Object > Quick effects > Cell fracture}
  • Set margin to 0
  • Apply cell fracture

prog.PNG

**System Information** Operating system: Windows-10-10.0.19043-SP0 64 Bits Graphics card: GeForce GTX 980 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 456.71 **Blender Version** Broken: version: 3.0.0, branch: master, commit date: 2021-12-02 18:35, hash: `blender/blender@f1cca30557` Worked: (newest version of Blender that worked as expected) **Addon Information** Name: Cell Fracture (0, 2) Author: ideasman42, phymec, Sergey Sharybin **Short description of error** Margin in cell fracture setting is 0.0000. But result shows the Gap between greater (not 0.000). **Exact steps for others to reproduce the error** - Open default scene - Enable `Cell fracture` addon - {nav Object > Quick effects > Cell fracture} - Set margin to 0 - Apply cell fracture ![prog.PNG](https://archive.blender.org/developer/F12726795/prog.PNG)
Author

Added subscriber: @Justus-3

Added subscriber: @Justus-3
Author

Cell Fracture Addon - Margin-Attitude don't works.
No matter what setting I make, there is always a gap between the broken elements. This was not the case in Blender 2.8.

Cell Fracture Addon - Margin-Attitude don't works. No matter what setting I make, there is always a gap between the broken elements. This was not the case in Blender 2.8.
Member

Added subscriber: @PratikPB2123

Added subscriber: @PratikPB2123
Member

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'
Member

Hi, Thanks for the report. Do you mean margin value 0 still keeps the gap when Cell fracture is applied? I did not understand the issue completely.

Not sure just a guess: may happen because of the floating point accuracy.

Hi, Thanks for the report. Do you mean margin value 0 still keeps the gap when Cell fracture is applied? I did not understand the issue completely. Not sure just a guess: may happen because of the floating point accuracy.
Author

Hello,
yes, the margin in cell fracture setting is 0.0000. But by result the Gap between the fractured Elements is greather (not 0.000).
Yo sad: may happen because of the floating point accuracy.
But where I can the floating set?

Hello, yes, the margin in cell fracture setting is 0.0000. But by result the Gap between the fractured Elements is greather (not 0.000). Yo sad: may happen because of the floating point accuracy. But where I can the floating set?
Member

Changed status from 'Needs User Info' to: 'Confirmed'

Changed status from 'Needs User Info' to: 'Confirmed'
Member

yes, the margin in cell fracture setting is 0.0000. But by result the Gap between the fractured Elements is greater

Hi, thanks for clarifying. I can reproduce as well.

But where I can the floating set?

Not sure if I understand this.

> yes, the margin in cell fracture setting is 0.0000. But by result the Gap between the fractured Elements is greater Hi, thanks for clarifying. I can reproduce as well. > But where I can the floating set? Not sure if I understand this.

Added subscriber: @michael64

Added subscriber: @michael64

In the object_fracture_cell and also object_fracture_crack addon there is still a workaround from a long time ago
that adds small noise as "WORKAROUND FOR CONVEX HULL BUG/LIMIT":

        - ---------------------------------------------------------------------
        - BMESH
        # create the convex hulls
        bm = bmesh.new()

        - WORKAROUND FOR CONVEX HULL BUG/LIMIT
        - XXX small noise
        import random
        def R():
            return (random.random() - 0.5) * 0.001
        # XXX small noise

        for i, co in enumerate(cell_points):

            # XXX small noise
            co.x += R()
            co.y += R()
            co.z += R()
            # XXX small noise

            bm_vert = bm.verts.new(co)

        import mathutils
        bmesh.ops.remove_doubles(bm, verts=bm.verts, dist=0.005)
        try:
            bmesh.ops.convex_hull(bm, input=bm.verts)
        except RuntimeError:
            import traceback
            traceback.print_exc()

Commenting out the three lines containing " += R()" results in a seemingly perfectly divided cube without gaps.
To put a kludge on top of a workaround we could loop twice over the hull computation.
In the first iteration no noise is added and the hull is computed.
When no exception is thrown we break out of the loop after the first iteration and are done without noise.
If an exception is thrown, the break statement is not reached, a second iterations begins, this time
by adding the noise as a workaround.

        - ---------------------------------------------------------------------
        - BMESH
        for hull_try in range(2):
            # create the convex hulls
            bm = bmesh.new()

            - WORKAROUND FOR CONVEX HULL BUG/LIMIT
            - XXX small noise
            import random
            def R():
                return (random.random() - 0.5) * 0.001
            # XXX small noise

            for i, co in enumerate(cell_points):
                if hull_try > 0:
                    # XXX small noise
                    co.x += R()
                    co.y += R()
                    co.z += R()
                    # XXX small noise

                bm_vert = bm.verts.new(co)

            import mathutils
            bmesh.ops.remove_doubles(bm, verts=bm.verts, dist=0.005)
            try:
                bmesh.ops.convex_hull(bm, input=bm.verts)
                - If convex_hull did not throw an exception
                - we break out of the hull_try loop without
                # adding small noise.
                break
            except RuntimeError:
                import traceback
                traceback.print_exc()
In the object_fracture_cell and also object_fracture_crack addon there is still a workaround from a long time ago that adds small noise as "WORKAROUND FOR CONVEX HULL BUG/LIMIT": ``` - --------------------------------------------------------------------- - BMESH # create the convex hulls bm = bmesh.new() - WORKAROUND FOR CONVEX HULL BUG/LIMIT - XXX small noise import random def R(): return (random.random() - 0.5) * 0.001 # XXX small noise for i, co in enumerate(cell_points): # XXX small noise co.x += R() co.y += R() co.z += R() # XXX small noise bm_vert = bm.verts.new(co) import mathutils bmesh.ops.remove_doubles(bm, verts=bm.verts, dist=0.005) try: bmesh.ops.convex_hull(bm, input=bm.verts) except RuntimeError: import traceback traceback.print_exc() ``` Commenting out the three lines containing " += R()" results in a seemingly perfectly divided cube without gaps. To put a kludge on top of a workaround we could loop twice over the hull computation. In the first iteration no noise is added and the hull is computed. When no exception is thrown we break out of the loop after the first iteration and are done without noise. If an exception is thrown, the break statement is not reached, a second iterations begins, this time by adding the noise as a workaround. ``` - --------------------------------------------------------------------- - BMESH for hull_try in range(2): # create the convex hulls bm = bmesh.new() - WORKAROUND FOR CONVEX HULL BUG/LIMIT - XXX small noise import random def R(): return (random.random() - 0.5) * 0.001 # XXX small noise for i, co in enumerate(cell_points): if hull_try > 0: # XXX small noise co.x += R() co.y += R() co.z += R() # XXX small noise bm_vert = bm.verts.new(co) import mathutils bmesh.ops.remove_doubles(bm, verts=bm.verts, dist=0.005) try: bmesh.ops.convex_hull(bm, input=bm.verts) - If convex_hull did not throw an exception - we break out of the hull_try loop without # adding small noise. break except RuntimeError: import traceback traceback.print_exc() ```
Sign in to join this conversation.
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-addons#93931
No description provided.