[WIP] Blender Destructability Editor

The mango team should pay attention to this thread :wink:
I hope all these destructions add-on will be stable and shared with 2.63.
But what about these and the bullet integration in blender?? will it be compatible??

How come I noticed this thread only now…? Wow… good work!

I have one question though… is it possible to make shards work with force fields?

I have tried to make shards as particles and animating them with force fields, but there is one BIG issue with them… you can define particles to be as objects, but not other way around…and can’t make them react with each other like rigid bodies should…

I can not believe my eyes… This is what I always have been dreaming of! YESSS!

@scorpion81

I used TetGen to generate a tetrahedral mesh of the object, which btw is the software that isn’t covered by a free license and thus is not free. After that I joined many tetrahedrons randomly to create more interesting shapes. The house itself is hand modelled within 5 minutes, nothing spectacular. A grid domain is automatically generated around the object, whereby everything near the ground plane is anchor point by default.

I didn’t tinker around with bullet soft bodies much, actually I expected it to be not as easy to work with. I just was quite disappointed that compound objects doesn’t update the collision mesh on parenting changes. I don’t see a reason for this and I couldn’t quickly find out how that could be fixed. On restart of the game engine it works but not on runtime. Did you look into this too?

@eversimo: Thanks for update
In video is fragmentation by shape.
It would be great have fragmentation from image like (pildanovak has a script for blender 2.4x) or fragmentation from Grease Pencil draw :slight_smile:

@Kai Kostack: your example looks great :slight_smile:
About Tetrahedral - Manifold Lab part of Wings 3D use tetrahedral fragmentation for free.

@vklidu
Are you sure? On their site they state “Tetrahedralization function in developement” and I couldn’t find an option for that.

With mesh selected > Right Click > Lots more . . . > Tetrahedral Tidbits via TetGen
Sorry if it is not the same. I used Wings just for voronoi fracturing (before scorpion81 great work) so I so just title in the list.



Tried to use Destructability, but have this error… :frowning:
http://img72.imageshack.us/img72/6627/errorlk.png

Uploaded with ImageShack.us

@kala_ndo, @karlis.stigis
I think i wait until aligoriths code gets into trunk, then i will try to make the shards rigidbodies in the game engine AND in blender rigidbody simulation (automatically) You cannot apply forces to them directly in the game engine (at least not very easy) but you can record animations from the game engine to blender to have the pieces moving in blender too, but on the paths they flew in the game engine.
I have added a fake gravity based collapse option, useful for buildings. Collapse takes place earlier this way when structure gets too weak. But the building collapses to its pieces entirely above the fracturing location, so unfortunately you cant tilt the building (it has to be parented for that or you have to calculate the needed horizontal impulse for each shard individually, no fun.)
I will test this without ground connectivity, maybe this buildings will drop to the side.

@Kai Kostack
Yes, reparenting does not work. Even via bpy access you cant do it. You can change the bpy compound option this way, but it wont be propagated to the game engine, not even with remove/re-add of the same object. To have hierarchical break up (currently not together with ground connectivity) I basically substitute a “backup” shard which is stored before fracturing with the compound and its children on collision. To do that i add them from another layer and remove the backup object. I hide the hierarchy on a specified layer (use other than 1). Additionally i have bpy access to different properties because i could not squeeze everything into game properties (string length was too severely limited). Yes, bpy access from bge is evil, but sometimes you have to do it.

@vklidu
Hmmm. image based decomposition sounds hard to implement. I will take a look at pildanovaks script how he did it (i think it was with voronoi too. ) but later. Now i try to make realistic tiltable collapse of buildings and maybe that object clustering. With particle systems you can achieve irregular voronoi, but those shapes need to parented as well. To have jaggy pieces when hitting an object.

@karlis.stigis
About the error… looks like you got an outdated version of my addon. Try to grab the newest version from github (see link in first post), then click the zip button there. This should get you a zipball with the addon in it.

@scorpion81 Thanks, it works now! I have another question… I made all the shards to be rigid bodies, but as soon as I press “play”, everything just blows apart… probably because objects are too close together. I changed sensitivity margin setting to zero, but it’s not helping… hmm. Oh… as you probably understood, I’m talking about using them in blender timeline, not game engine.

@karlis.stigis
Up to now only rigidbodies via game engine are supported by my addon, i wanted to wait until aligoriths code gets into trunk. But maybe i take a look at it earlier. In the game engine i use object compounding, dunno whether this is possible with rigidbody simulation in blender itself. I only took a quick look at aligoriths work a while ago. Must take a closer look.

Ok, thank you again. I really appreciate your work, so take your time. Main thing is to maintain quality of it.
About game engine usage… I just couldn’t figure it out…

@karlis.stigis
To use the fractured object in the game engine choose the parent and hit setup player. if ground connectivity is desired, you must leave the according checkbox checked, scale the ground object to match the bottom of the fractured object (make the plane a little smaller so it is completely inside the objects bottom) . choose a connectivity grid size e.g 4 x 4 x 4.
Then select the parent again and hit To Game Parenting (save before doing that, you can undo it only via regular undo)
Start the game engine. If you wanted to have ground connectivity, watch for “Found Ground cell” messages. Then the ground object was scaled correctly.
You can move the camera with WSADXY keys. left click mouse to fire a ball, right click to “detonate” an object (ball is placed inside)
Hold mouse button longer to increase strength.

If you’re using the Aligorith build this “problem” is caused because the shape of the shards. The default shape is “Mesh” and you need to change the shape of every shard to “Convex Hull” and the margin sensitivity to 0.
There’s a button in “RigidBody tools” operator called “Copy from Active…” that transfer the physics settings from the active shard to selected others… This will solve the explosion at the start. :wink:

{Sigh}
Boolean doesn’t work:

Traceback (most recent call last):
File “/home/melvin_frohike/Documents/Blender_Builds/blender-2.62-r44667-linux-glibc27-x86_64/2.62/scripts/addons/object_destruction/destruction_gui.py”, line 947, in execute
dd.DataStore.proc.processDestruction(context)
File “/home/melvin_frohike/Documents/Blender_Builds/blender-2.62-r44667-linux-glibc27-x86_64/2.62/scripts/addons/object_destruction/destruction_proc.py”, line 98, in processDestruction
eval(modes[mode])
File “<string>”, line 1, in <module>
File “/home/melvin_frohike/Documents/Blender_Builds/blender-2.62-r44667-linux-glibc27-x86_64/2.62/scripts/addons/object_destruction/destruction_proc.py”, line 770, in applyFracture
fo.fracture_basic(context, [obj], parts, crack_type, roughness)
File “/home/melvin_frohike/Documents/Blender_Builds/blender-2.62-r44667-linux-glibc27-x86_64/2.62/scripts/addons/object_destruction/fracture_ops.py”, line 280, in fracture_basic
newshards = splitobject(context, ob, crack_type, roughness)
File “/home/melvin_frohike/Documents/Blender_Builds/blender-2.62-r44667-linux-glibc27-x86_64/2.62/scripts/addons/object_destruction/fracture_ops.py”, line 242, in splitobject
fault, newshards = boolop(ob, cutter, op)
File “/home/melvin_frohike/Documents/Blender_Builds/blender-2.62-r44667-linux-glibc27-x86_64/2.62/scripts/addons/object_destruction/fracture_ops.py”, line 179, in boolop
ctx = bpy.context.copy()
File “/home/melvin_frohike/Documents/Blender_Builds/blender-2.62-r44667-linux-glibc27-x86_64/2.62/scripts/modules/bpy_types.py”, line 41, in copy
value = getattr(self, attr)
AttributeError: ‘Context’ object has no attribute ‘texture_slot’

location:<unknown location>:-1

Voroni+Boolean doesn’t work:

Traceback (most recent call last):
File “/home/melvin_frohike/Documents/Blender_Builds/blender-2.62-r44667-linux-glibc27-x86_64/2.62/scripts/addons/object_destruction/destruction_gui.py”, line 947, in execute
dd.DataStore.proc.processDestruction(context)
File “/home/melvin_frohike/Documents/Blender_Builds/blender-2.62-r44667-linux-glibc27-x86_64/2.62/scripts/addons/object_destruction/destruction_proc.py”, line 98, in processDestruction
eval(modes[mode])
File “<string>”, line 1, in <module>
File “/home/melvin_frohike/Documents/Blender_Builds/blender-2.62-r44667-linux-glibc27-x86_64/2.62/scripts/addons/object_destruction/destruction_proc.py”, line 275, in applyVoronoi
voronoi.voronoiCube(context, obj, parts, volume, wall)
File “/home/melvin_frohike/Documents/Blender_Builds/blender-2.62-r44667-linux-glibc27-x86_64/2.62/scripts/addons/object_destruction/voronoi.py”, line 363, in voronoiCube
newnames.extend(booleanIntersect(context, o, obj, oldnames))
File “/home/melvin_frohike/Documents/Blender_Builds/blender-2.62-r44667-linux-glibc27-x86_64/2.62/scripts/addons/object_destruction/voronoi.py”, line 388, in booleanIntersect
ctx = context.copy()
File “/home/melvin_frohike/Documents/Blender_Builds/blender-2.62-r44667-linux-glibc27-x86_64/2.62/scripts/modules/bpy_types.py”, line 41, in copy
value = getattr(self, attr)
AttributeError: ‘Context’ object has no attribute ‘texture_slot’

location:<unknown location>:-1

Eplosion Modifier doesn’t work:

Traceback (most recent call last):
File “/home/melvin_frohike/Documents/Blender_Builds/blender-2.62-r44667-linux-glibc27-x86_64/2.62/scripts/addons/object_destruction/destruction_gui.py”, line 947, in execute
dd.DataStore.proc.processDestruction(context)
File “/home/melvin_frohike/Documents/Blender_Builds/blender-2.62-r44667-linux-glibc27-x86_64/2.62/scripts/addons/object_destruction/destruction_proc.py”, line 98, in processDestruction
eval(modes[mode])
File “<string>”, line 1, in <module>
File “/home/melvin_frohike/Documents/Blender_Builds/blender-2.62-r44667-linux-glibc27-x86_64/2.62/scripts/addons/object_destruction/destruction_proc.py”, line 305, in applyExplo
self.explo(context, obj, parts, granularity, thickness, massive, pairwise)
File “/home/melvin_frohike/Documents/Blender_Builds/blender-2.62-r44667-linux-glibc27-x86_64/2.62/scripts/addons/object_destruction/destruction_proc.py”, line 177, in explo
self.separateExplo(context, thickness)
File “/home/melvin_frohike/Documents/Blender_Builds/blender-2.62-r44667-linux-glibc27-x86_64/2.62/scripts/addons/object_destruction/destruction_proc.py”, line 325, in separateExplo
ctx = context.copy()
File “/home/melvin_frohike/Documents/Blender_Builds/blender-2.62-r44667-linux-glibc27-x86_64/2.62/scripts/modules/bpy_types.py”, line 41, in copy
value = getattr(self, attr)
AttributeError: ‘Context’ object has no attribute ‘texture_slot’

location:<unknown location>:-1

It doesn’t even show up in some blender builds.

I must say though that I am happy to report that I can change the origin of an object and it will fracture there.

@jackblack

Again, this is a cycles related error. See my bug report http://projects.blender.org/tracker/index.php?func=detail&aid=30505&group_id=9&atid=498, you must use blender internal materials prior to fracture, switch to cycles AFTER fracturing is done.
That bug really is a bummer and still isnt fixed. Seems to be a hard one.
So you have linux. There compiling blender yourself is very easy. See http://wiki.blender.org/index.php/Dev:2.5/Doc/Building_Blender/Linux I use Cmake-gui to generate makefiles and in the specified build directory simply make and make install
Before that get the sources via svn. Its all described under the 2nd link. This way you can make sure you always have a fresh build.

Well when I switch it to Blender Render or Blender Game it just crashes blender completely.

Good news! I just got the new build and EVERYTHING WORKS! Except the knife tool, but other than that it’s AWESOME!