View Full Version : OT: Destructable landscape.

12-16-2002, 06:58 AM
I know this is OT but, i was curious if any one knew of any help topics, or tutorials on a destructable style map, (Dynamicaly of course).

12-16-2002, 07:10 AM
If you're using some sort of image to create landscape all you need is to color given pixel darker, the next frame it'll be lower http://www.opengl.org/discussion_boards/ubb/smile.gif

12-16-2002, 07:30 AM
That is a good idea, (Kind of like dynamic burns or dark mapping) but im actualy looking for a way to actualy create and remove new verts and polys to actualy deform hte landscape.

12-16-2002, 08:56 AM
Start lobbying for proper displacement mapping.

12-16-2002, 09:24 AM
Pardon my stupidity but. HUH? what is that?

12-16-2002, 09:34 AM

Displacement mapping is basically the same technique that has been used by programmers for eons under the name 'height mapping'.

Real hardware support for that would be cool ... do deform the landscape you could simply update a region of the displacement map and let the hardware do the rest.

GFfx can to my knowledge only do a kludgy emulation of 'presampled' displacement mapping, or in other words height mapping with a fixed grid ... which is a two pass operation with temporary data (puke!).

R300 capabilities remain to be seen, but I suspect the same thing.

I just realize that this DM thing may be a bit off topic, so ...
Without DM, do some basic (non-hw-)height mapping and move vertices around for deformation. That's a well enough understood process and it should be fairly easy to find tutorials on the subject http://www.opengl.org/discussion_boards/ubb/smile.gif

12-16-2002, 12:03 PM
It's the same for the R300.

12-16-2002, 12:12 PM
It sounds to me that he's more interested in doing stuff like red faction. This is basically just a CSG subtract, with clever texturing for the holes you create. The CSG literature is where I'd start looking for anything besides putting some divets and craters in a terrain mesh.

12-16-2002, 04:15 PM
Originally posted by zeckensack:

Holy poop on a stick! That's some pretty landscaping. Gonna have to read that paper tonight.

12-16-2002, 04:27 PM
If you're interested in CLOD with dynamic hight maps then ROAM-like algos might be interesting since they support quick recalculations of the precomputed error metrics.

12-16-2002, 05:41 PM
Originally posted by dabeav:
I know this is OT but, i was curious if any one knew of any help topics, or tutorials on a destructable style map, (Dynamicaly of course).

I'm surprised nobody mentioned blowing holes in the landscape. You cant do cavern like holes with DM. You cant do hang over rocks either. Otherwise, it's pretty straightforward.


12-16-2002, 07:08 PM
Well my original idea was to (blow holes) into the landscape. But the algorithm to breakapart polys on a per frame basis into large holes, is proving to be more hassle then its worth. I think i will simply go with a push the existing verts around algorithm, and simply multitexture the ones that have been moved with another texture. Thanx everyone.

12-16-2002, 10:52 PM

You could also keep your landscape in some nice volumetric format where it is easy to subtract holes, and then use marching cubes to retriangulate the part that has changed. It should be pretty straightforward, if you can fit it in the memory.

One thing though, the marching cubes algo is patented, so I'm not sure if you are allowed to use that, at least in a commercial app. Doesn't seem to bother lots of other people anyways.


12-17-2002, 02:13 AM
I've always wondered how Red-Faction does the destructable buildings and such. What is CSG subtraction and where could i find more info about it?


12-17-2002, 09:48 AM

12-17-2002, 01:39 PM
Check this out:

12-17-2002, 11:52 PM
Just out of interest people, surely displacement mapping of a landscape (by the GPU) makes collision detection\motion path planning much more difficult?

You would need to keep a copy of the displacement map in system memory and reconstruct the geometry around the bollides in order to perform these calculations.

I'm not sure its such a good idea for landscaping.

12-17-2002, 11:58 PM
Everything depends on what kind of collision test you're using & where you are doing displacement stuff GPU| |CPU.

12-18-2002, 12:54 AM
You have to do exactly the same thing without displacement mapping. Keep a height map in system memory. But that's no big deal, you only have to reference four points or so, lerp position, lerp normal, voilá.

Hardware DM is only good for rendering, you can potentially eliminate lod calculations and all the hassle that comes with it ('stitching', anyone?).

Of course there's no win for physics, that's not the purpose of displacement mapping. Neither is it the purpose of vertex shaders or anything else modern graphics chips do for that matter.

12-18-2002, 02:32 AM
I had completely different idea on how to make destructable world, however i didn't test it and as usually new methods have many drawbacks.
It allows to keep your level like usually static, with BSP, PVS, whatever you use unchanged. At same time you can cut out say spheres out of your geometry, without any CSG http://www.opengl.org/discussion_boards/ubb/smile.gif complicated math.
When a bomb explodes at some point you would only save what sphere should be cut out.

Ok, ok how http://www.opengl.org/discussion_boards/ubb/smile.gif?
Actually it would be CSG, but using some kind of trick with stencil buffer. Similar to how shadow volumes with stencil buffer algorithms don't depend o how complex visual result would be. It depends only on input's geometry complexity, not output's.
There's a demonstration of CSG using stencil buffer on Delphi3D site (stencilcsg.zip) http://www.delphi3d.net/listfiles.php?category=6

Using this technique you could draw your levels like usually adding/subtracting what you want on the fly!

What do you think about that?

12-18-2002, 04:02 AM
Well, here's my five cents.

I don't think that stencil csg is the way to go for the destructable enviroment. Doesn't it get very slow when there are several cutting objects? Besides having the scene in the original bsp-tree doesn't help much since the visibility info gets out-of-date when you make holes in the walls.

Personally, i would forget about the csg stuff altogether.

If you want realisticly destructable enviroment, you should construct your scene from elements instead of triangle meshes. By elements I mean metal pipes, steel plates, wood panels and stuff like that. Kind of like the real world, you know. Elements would of couse have all kinds of parameters like texture and dimensions, and could be grouped together. A wall element, for example, could consist of two wood panels with some pipes an supporting structures in between. Of course with some ad-hoc visibility info so the internal structures wouldn't be drawn unless necessary.

The elements would also have individual ways to break up. Wood panes would break into pieces easily, but heavier wood structures would take a lot more to be moved. Pipes wouldn't go to pieces, but would bend and break in some places with smoke coming out of the open heads of course.

Now a shotgun shot at the wall element would only create a hole in the outer panel, but a rocket would leave a big hole with some pipes and stuff sticking out.

Another advantage of an element-based world is easy organisation of level of detail, which is a practical requirement with destructable enviroment, since you can no longer control the visibility conditions.

Of course, if you already have your own pet q3 map viewer, you will be better off with csg. But I Would seriously consider this kind of design if I was to create a new engine with destructable enviroment.


12-18-2002, 06:57 AM
Landscape from objects, hmmm... GFX will be too slow.

12-18-2002, 08:01 AM
I agree, that would be MANY TO MANY polys for a good render pass.

12-18-2002, 11:26 PM
Lanscape from objects?

No, the point is, you can just make a landscape element and have break any way you want. In practice make it a heightfield, with the heightmap being its property, and modify this map to make holes. That's the beauty of the system.

Starting to get it?

I know such system may be impossible with current hardware, but that's definetly not obivous. After all, it's basically just a scenegraph.