Destructable terrain
- Los Frijoles
- Greenskin
- Posts: 123
- Joined: Wed Nov 02, 2005 11:26 pm
- Location: The Planet Earth
- Contact:
Destructable terrain
I know there was a thread on this a while ago...did anything even come of it/where is it?
I am basically looking for a method which is used to "destroy" meshes based upon events of some sort (such as an explosion or something). I know it is possible, but I am not sure how to do it. Does anyone know anything about this (such as how to do it or a link to a page which explains an algorithm)?
I am basically looking for a method which is used to "destroy" meshes based upon events of some sort (such as an explosion or something). I know it is possible, but I am not sure how to do it. Does anyone know anything about this (such as how to do it or a link to a page which explains an algorithm)?
- metaldev
- Orc Shaman
- Posts: 761
- Joined: Thu Mar 17, 2005 11:56 pm
- Location: Boston
- x 15
- Contact:
My recommendation is to not use true dynamic destruction. I worked on a project where it was tried, and the only answer is to give up on trying to have artistic control. Its really cool for a programmer to talk about how they programmed dynamic destruction, and it is in fact pretty impressive to do programmatically. But unless you are doing something crazy like havok simulations that needs a physics accelerator card, artists will be wincing.
A method that i can guarantee has been production tested and will give you professional looking results is the following. It is artist time heavy, but the results are seamless and highly controllable.
You must make 2 to 3 objects per destroyable object.
1)The first is a solid regular .mesh model of the complete, undestroyed object.
2)The second, is a skeletal mesh, each joint of the skeleton should be bound 100% to one of the destroyable "flying" pieces except for the root.
If physics are required you use it as bounding boxes on the joints.
3)A third mesh is needed for any part of the object that is not meant to 'fly away' such as the base of the wall or pillar which can't be destroyed. Of course, if you are talking about a destroyable vase this step isnt necessary.
So you start with model 1, the explosion occurs and you swap model(1) with: skeletal mesh (2), model (3), and 1 to 2 decent particle effects. After x time you can remove the skeletal mesh and keep the 3rd mesh around to maintain performance you had when you only had model 1 visible.
the result is a badass seamless predictable destructable object.
Its not easy to do, but it is how some of the big boys do it in practice, and it can be done for a small project if the destruction is selective enough or a pipeline can be set up.
A method that i can guarantee has been production tested and will give you professional looking results is the following. It is artist time heavy, but the results are seamless and highly controllable.
You must make 2 to 3 objects per destroyable object.
1)The first is a solid regular .mesh model of the complete, undestroyed object.
2)The second, is a skeletal mesh, each joint of the skeleton should be bound 100% to one of the destroyable "flying" pieces except for the root.
If physics are required you use it as bounding boxes on the joints.
3)A third mesh is needed for any part of the object that is not meant to 'fly away' such as the base of the wall or pillar which can't be destroyed. Of course, if you are talking about a destroyable vase this step isnt necessary.
So you start with model 1, the explosion occurs and you swap model(1) with: skeletal mesh (2), model (3), and 1 to 2 decent particle effects. After x time you can remove the skeletal mesh and keep the 3rd mesh around to maintain performance you had when you only had model 1 visible.
the result is a badass seamless predictable destructable object.
Its not easy to do, but it is how some of the big boys do it in practice, and it can be done for a small project if the destruction is selective enough or a pipeline can be set up.
- PolyVox
- OGRE Contributor
- Posts: 1316
- Joined: Tue Nov 21, 2006 11:28 am
- Location: Groningen, The Netherlands
- x 18
- Contact:
Re: Destructable terrain
In the title of the thread you specifically mention terrain so I will point you towards these two projects:Los Frijoles wrote:I know there was a thread on this a while ago...did anything even come of it/where is it?
I am basically looking for a method which is used to "destroy" meshes based upon events of some sort (such as an explosion or something). I know it is possible, but I am not sure how to do it. Does anyone know anything about this (such as how to do it or a link to a page which explains an algorithm)?
http://www.ogre3d.org/phpBB2/viewtopic.php?t=32486
http://www.ogre3d.org/phpBB2/viewtopic.php?t=30955 (also in the Addons Forum)
There is also my project, which goes beyond terrain to full 3D environments:
http://www.thermite3d.org (built on Ogre/Bullet)
Are any of these what you are trying to achieve?
It's getting more common though - I think Fracture and Bad Company are the two latest games to be making use of it, but I haven't played them.metaldev wrote:My recommendation is to not use true dynamic destruction. I worked on a project where it was tried, and the only answer is to give up on trying to have artistic control. Its really cool for a programmer to talk about how they programmed dynamic destruction, and it is in fact pretty impressive to do programmatically. But unless you are doing something crazy like havok simulations that needs a physics accelerator card, artists will be wincing.
I had the good fortune to run into Erwin Coumans (lead developer of Bullet) at the Austin GDC this year. He told me this is something which will be coming into bullet soon - firstly to facilitate the kind of approach you describe and later to automatically calculate the fracture pointsmetaldev wrote:A method that i can guarantee has been production tested and will give you professional looking results is the following:
...
the result is a badass seamless predictable destructable object.
- metaldev
- Orc Shaman
- Posts: 761
- Joined: Thu Mar 17, 2005 11:56 pm
- Location: Boston
- x 15
- Contact:
@ polyvox
yea it is getting used more and more, i thought that Crysis did an awesome job with half dynamic/ half prefab destruction as well. Its hard to have both the art and code resources be able to dedicate to destruction though. The thing is i am not sure which is more work... to get it done right on the code side is a huge feat, to get it done in art is a lot of work too but it is a guaranteed result although of course, variation will be limited and there will be limitations to what can be destroyed.
By the way awesome demo with the castle!
yea it is getting used more and more, i thought that Crysis did an awesome job with half dynamic/ half prefab destruction as well. Its hard to have both the art and code resources be able to dedicate to destruction though. The thing is i am not sure which is more work... to get it done right on the code side is a huge feat, to get it done in art is a lot of work too but it is a guaranteed result although of course, variation will be limited and there will be limitations to what can be destroyed.
By the way awesome demo with the castle!
- PolyVox
- OGRE Contributor
- Posts: 1316
- Joined: Tue Nov 21, 2006 11:28 am
- Location: Groningen, The Netherlands
- x 18
- Contact:
Well I do agree, but we are already starting to see this stuff handled by middleware. The obvious example is Digital Molecular Matter, but I've also seen videos from Havok and I'm sure other physics engines will have things in the pipeline. That said, I get the impression that DMM didn't quite live up to the hype. Has anybody played The Force Unleashed (the only game to use DMM so far)? I've heard it was just used to break a few windows and bend a few doors, with the majority of the world being static.
That said, eventually this stuff will come so it will be interesting to see how it affects games. Obviously it could really break the way some game types work, but at the same time will give the potential for some completely new ideas. The popularity of things like Garry's mod shows that gamers thinks in-game physics is cool.
Oh, and thanks
That said, eventually this stuff will come so it will be interesting to see how it affects games. Obviously it could really break the way some game types work, but at the same time will give the potential for some completely new ideas. The popularity of things like Garry's mod shows that gamers thinks in-game physics is cool.
Oh, and thanks
- Halifax
- Halfling
- Posts: 49
- Joined: Sun Nov 18, 2007 10:30 pm
Yeah, if anyone has seen the Unreal Engine 3.5 Technical Demonstrations, then you can see the PhysX technology being used for fully desctructible objects at run-time.
Like PolyVox said would be integrated into Bullet, is exactly what is used in Unreal Engine 3.5 via nVidia's PhysX. It calculates the fracture points, destroys the mesh, and sends back the triangles to the user to render. Should be some pretty simple stuff, once integrated into Bullet, but just time consuming, like soft bodies.
Anyways, I can't wait, Bullet is becoming quite the top-notch phyiscs engine.
Like PolyVox said would be integrated into Bullet, is exactly what is used in Unreal Engine 3.5 via nVidia's PhysX. It calculates the fracture points, destroys the mesh, and sends back the triangles to the user to render. Should be some pretty simple stuff, once integrated into Bullet, but just time consuming, like soft bodies.
Anyways, I can't wait, Bullet is becoming quite the top-notch phyiscs engine.
- PolyVox
- OGRE Contributor
- Posts: 1316
- Joined: Tue Nov 21, 2006 11:28 am
- Location: Groningen, The Netherlands
- x 18
- Contact:
I guess this is what you are referring to: http://www.gametrailers.com/player/30825.html (destructible environments around 3:22)Halifax wrote:Yeah, if anyone has seen the Unreal Engine 3.5 Technical Demonstrations, then you can see the PhysX technology being used for fully desctructible objects at run-time.
And yes, it's cool stuff Though actually it still suprises me that it has taken so long to get this far, considering what RedFaction was pulling off in 2001. I had great fun with that game!
- betajaen
- OGRE Moderator
- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
- Contact:
- Los Frijoles
- Greenskin
- Posts: 123
- Joined: Wed Nov 02, 2005 11:26 pm
- Location: The Planet Earth
- Contact:
So you're telling me that Aegia PhysX has destructible object features? I know I have the PhysX SDK, but is this included in the free version?
@metaldev: I am not sure what you mean...do you attach each bone in the skeleton to a piece of mesh which goes flying off and then replace the original mesh with the mesh in step three? Is the mesh originally modeled in pieces?
To take this down to another level, if I had a 2D physics engine and it used polygons for the background terrain which could be destroyed, is there a way to implement something of an on the fly boolean subtraction method with polygons to "remove" the chunk of the polygon and leave a hole? I can visualize the concept, but I can't visualize how to do it. I would not necessarily animate the pieces flying off and stuff, but rather I would just use particle effects and maybe some mesh "rocks" of the appropriate colors and textures which fly out.
EDIT: Hahaha...I spelled the topic title wrong.
@metaldev: I am not sure what you mean...do you attach each bone in the skeleton to a piece of mesh which goes flying off and then replace the original mesh with the mesh in step three? Is the mesh originally modeled in pieces?
To take this down to another level, if I had a 2D physics engine and it used polygons for the background terrain which could be destroyed, is there a way to implement something of an on the fly boolean subtraction method with polygons to "remove" the chunk of the polygon and leave a hole? I can visualize the concept, but I can't visualize how to do it. I would not necessarily animate the pieces flying off and stuff, but rather I would just use particle effects and maybe some mesh "rocks" of the appropriate colors and textures which fly out.
EDIT: Hahaha...I spelled the topic title wrong.
- metaldev
- Orc Shaman
- Posts: 761
- Joined: Thu Mar 17, 2005 11:56 pm
- Location: Boston
- x 15
- Contact:
yes, correctLos Frijoles wrote:do you attach each bone in the skeleton to a piece of mesh which goes flying off and then replace the original mesh with the mesh in step three?
no, the original model (model 1) is a simple model of the object, without any destruction. One of the advantages of the method is that the user can't tell that it is a dynamic object unless you indicate it through other means.Los Frijoles wrote:Is the mesh originally modeled in pieces?
- Los Frijoles
- Greenskin
- Posts: 123
- Joined: Wed Nov 02, 2005 11:26 pm
- Location: The Planet Earth
- Contact:
This would work for me except that I have to be able to "eat away" at the terrain based on explosions and stuff in my game. I was planning on using a 2D physics engine with OGRE to make a side-view game, so all I really need to know is about boolean subtraction of simple polygons (such as a dodecagon) from a complex polygon (such as the 2D flat representation of the level).metaldev wrote: no, the original model (model 1) is a simple model of the object, without any destruction. One of the advantages of the method is that the user can't tell that it is a dynamic object unless you indicate it through other means.
- metaldev
- Orc Shaman
- Posts: 761
- Joined: Thu Mar 17, 2005 11:56 pm
- Location: Boston
- x 15
- Contact:
- betajaen
- OGRE Moderator
- Posts: 3447
- Joined: Mon Jul 18, 2005 4:15 pm
- Location: Wales, UK
- x 58
- Contact:
No. I was referring that one of the developers said it may happen in the future. I commented since the commercial developers usually are working with a major point release before we do, it may be possible that it exists.Los Frijoles wrote:So you're telling me that Aegia PhysX has destructible object features? I know I have the PhysX SDK, but is this included in the free version?
However; it is all speculation and not fact.
- Halifax
- Halfling
- Posts: 49
- Joined: Sun Nov 18, 2007 10:30 pm
- PolyVox
- OGRE Contributor
- Posts: 1316
- Joined: Tue Nov 21, 2006 11:28 am
- Location: Groningen, The Netherlands
- x 18
- Contact:
There are several options being discussed here, so I'll try to summerise (some of) the available options. Although you mention '2D with Ogre" I assume you mean the world is 3D and you just view it from the side? In which case all calculations, etc, still need to be done in 3D. None-the-less, there are 2D and 3D options both with and without a physics engine:
2D, no Physics Engine:
This is the simplest situation you can have, and there are a couple of options.
Both of these are logical extensions of the 2D approaches.
The kind of destruction provided by physics engines is different in that it tends to be designed for destroying objects in the world, rather than destroying the world itself. Given a mesh and a set of stress parameters it will compute fracture points and give you back pieces of the mesh. I would suspect the size of the mesh was relatively limited, so that you couldn't use this approach to build your whole world, but I may be wrong.
Hope that helps
2D, no Physics Engine:
This is the simplest situation you can have, and there are a couple of options.
- Pixel-based environments: This is the approach use by many games such as Worms and Lemmings. The world is simply a 2D image so it is easy to add/remove/change pixels in any way you wish.
- Polygon environments: Here we are talking about 2D polygons which would be drawn with a vector graphics engine such as Cairo or OpenVG. To destroy them you have two options:
- Perform real union/intersection operation to create a new polygon from some old ones.
- Fake the effect by simply rendering a white 'hole' polygon over the other ones.
Both of these are logical extensions of the 2D approaches.
- Voxel-based environments: Voxels are the 3D equivalent of pixels, and so this is the 3D version of the approach used by Worms and Lemmings. Environments can be extremely dynamic, but can suffer from low detail and can be tricky to model. My project is an example of this approach.
- Polygon environments: To add or remove geometry in polygon environments you need to use CSG. As with 2D, you can do it for real (mathematically complex) or fake it (only work in limited situations).
- To perform real CSG you need to be computing the intersection between two or more 3D primitives such as cubes or spheres, then you need to generate new geometry to replace the old. It can be complex but is definitely doable - this approach was used by Red Faction for their Geo-Mod technology. If you are interested in this you should check out Stan Melax's implementation and paper. Also check out the Wikipedia page and external links here.
- Alternatively, if you want to fake the effect you can do so by using the stencil buffer as done by OpenCSG.
The kind of destruction provided by physics engines is different in that it tends to be designed for destroying objects in the world, rather than destroying the world itself. Given a mesh and a set of stress parameters it will compute fracture points and give you back pieces of the mesh. I would suspect the size of the mesh was relatively limited, so that you couldn't use this approach to build your whole world, but I may be wrong.
Hope that helps