Fracture Voronoi

292 votes
Version: 
1.1

This script breaks any mesh while preserving its volume.

Additional Info: 

v1.0: The object is broken in a number of chunks equal to 'Nb Parts' to the power of 'Iterations', using Voronoi cells. The final number appears on the 'Break' button.
The creation process is visible in the viewport.
For a similar result, it is faster to use several iterations with a small number of parts than creating all the parts in one iteration.
Note that the original object is just hidden, not deleted.

v1.1: In this version, the code has been improved and runs much faster. But there is no viewport feedback any more.
Materials:
- the outer faces keep their original material IDs and the new faces are assigned a unique ID. The value that appears by default is the highest ID in use (by the original object) + 1.
- mapping coordinates (if any) are preserved and somehow 'projected' onto the new faces.
- an extra planar mapping is applied to all the pieces at once and set on its own channel, typically for use with 3D procedural maps, so the pattern flows continuously from piece to piece but sticks to them when they are moved apart.
Hierarchy:
- when using several iterations, it is possible to keep the intermediate generations of parts.
- when linked, each part is parented to the one it is derived from.
- generations are set on their own layers, which are hidden except for the last one.

Enjoy :)

AttachmentSize
FractureVoronoi_v1.1.ms10.85 KB
FractureVoronoi_v1.0.ms4.67 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Script_Butler's picture

Slight script enhancement

Hello.

I was wondering if it was easy to add an option to add some noise to the plane thats created and have options to adjust the noise parameters.

I only as because currently the fractures are all straight edges and i'd like to have some smoothness and curvature to them.

Can it also be changed to convert to editablepolys rather than editable meashes?

Are these something you think could be added?

Cheers.

Script_Butler

1acc's picture

you can make it faster

There is a way to make it at least 2 times faster. The method is based on skipping points outside bounding box of chunk:
http://www.scriptattack.com/lessons/voronoi/img4.gif

Points have to be sorted by distance from center of chunk.

Sample code:
http://www.scriptattack.com/lessons/voronoi/script_itself_voronoi_tessel...

Thank you for "Slice -> Cap Holes" idea.

Garp's picture

Create a macro for it.

macroScript runFractureVoronoi
category:"MAX Script Tools"
internalCategory:"MAX Script Tools"
buttonText:"Fracture"
toolTip:"Fracture Voronoi"
(
    fileIn "C:\\...\\FractureVoronoi_v1.1.ms"
)

Paste this in a new script window, change the path to wherever it is saved on your hard drive, evaluate it once and close the window without saving (the macro has been saved to the userMacros folder).
From the Customize UI dialog > Toolbars panel > MAX Script Tools category, drag it from the Action list to your toolbar.
Et voilà.

HarryPotter's picture

Uhmm... How can i put this

Uhmm...
How can i put this script on a Toolbar?
Can't find it through Customize UI...

Thanks!

Garp's picture

@pokoy: I suppose it's

@pokoy: I suppose it's possible, though I wouldn't know how. Sorry about that (and the late answer).

@kearns892: say you have a geosphere at [0,0,0]. Break it, select all the fragments and run something like
for obj in selection do obj.pos *= 1.2
in the listener.
This would effectively add 20% to each distance from the origin.

kearns892's picture

Expanding Elements?

Is there a relatively simple method for achieving an effect similar to that in the photo where the fragments are slightly spaced apart?

pokoy's picture

Awesome script, having much

Awesome script, having much fun with it!
I'd like to request following workflow feature: is it possible to map the 'break' operation to a key instead of clicking 'choose object' first?
This way you'd just select the object you want to break, press the hotkey and it would break with the current settings. This would greatly speed up the process when breaking many parts.

Suzume's picture

Will try this script, thx for

Will try this script, thx for posting this one here.

Garp's picture

Yep, I saw you over there. I

Yep, I saw you over there.
I knew there was an easy way :)

tumblingweed's picture

Another kind soul on

Another kind soul on maxforum.org gave me some help and Iv got the planet textured and breaking apart now, again this script is just pure awsome!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.