Page 1 of 1

question about cities and destroying part of a mesh

Posted: Thu Mar 31, 2005 5:45 pm
by krazyscotsman
I'm not sure if this should be in content creation or in the programming section - so mods please move if necessary.

My group is working on a flight sim that will also fight a real time war (meaning if you do not fly, the war continues without your assistance). Myself, I would like to do the cities as meshes instead of painted tiles. I know we are sacrificing some fps; however, for the sensation of speed, locking targets, etc a real model is more appealing than painted textures. I know by collapsing multiple buildings into a single mesh we can save on the feel rate. However, my concern (and I am not a programmer) is that when a player drops a bomb on a city building, I do not want the entire mesh (city block) to be affected, only the building and maybe surrounding buildings. In 3D Max, you can accomplish this with a bomb and setting fall off amounts. Can this be accomplished in OGRE or by programming? How difficult would it be?

Thanks,
Krazyscotsman

Posted: Thu Mar 31, 2005 5:53 pm
by jacmoe
If you want, you can simply export different levels of destruction from max, and different materials as well.
Drop a bomb, load up a soot material - drop another, and switch the mesh to another ...
:)

If you add some fog, fire and smoke - and make the differences between the meshes small enough - it will probably do the job without heavy programming.
But, you could use a shader or two -> meshdeform, decals, etc.

Posted: Thu Mar 31, 2005 6:25 pm
by krazyscotsman
Wouldn't this cause a lot meshes and swapping to be required? Meaning if you had a block of 5 buildings, you would need 32 meshes to accomodate the combinations of possibilities (building a= damaged building b = not damaged, etc.).

Thanks,
Krazyscotsman

Posted: Fri Apr 01, 2005 2:46 am
by monster
This is kind of why I wanted the StaticGeometry stuff to support a freeze/thaw paradigm;

- Build your city from lots of independent nodes and entities
- Freeze them into static geometry
- When a bomb hits a building;
- Thaw the static geometry
- Delete the exploded building (or replace it with a "rubble" model)
- Re-freeze the geometry

As it is, you could do this manually;

- Build your city from lots of independent nodes and entities
- Freeze them into static geometry
- When a bomb hits a building;
- Delete the static geometry
- Recreate the city as before, but with rubble in place of the exploded building
- Freeze the city into static geometry

In that case you're probably going to get a performance hit when you explode a building and you do all the deleting, creating and re-freezing. So what would probably be better is to do it even more manually;

- Create your entire city as a single node
- Each building is a separate Entity (i.e. mesh) with positions baked into them
- All buildings are attached to the city node
- When a building gets hit;
- Detach that Entity from the city node
- Attach a rubble node with positions baked in as the position of the exploded building

Or, simply create your city manually in a single vertex buffer and update that buffer as buildings get exploded.

Hope some of that makes sense!

Posted: Fri Apr 01, 2005 2:48 am
by semicolon
For Bombing FX, I did create 2 set of mesh. The first one is the base model for general use. The other one is the cracked chunk of the first one with the bone set on each chunk for simulted explosion. When the base model is bombed, I erased the first one and replace the cracked-chunk model at the same position. Adding some particle fx to fake the blow-out fire and some smoke.

That's just an idea to simulate the explosion fx as far as I could figure out. Any ideas are very welcome.

Semicolon

Posted: Fri Apr 01, 2005 5:37 am
by krazyscotsman
semicolon wrote:For Bombing FX, I did create 2 set of mesh. The first one is the base model for general use. The other one is the cracked chunk of the first one with the bone set on each chunk for simulted explosion. When the base model is bombed, I erased the first one and replace the cracked-chunk model at the same position. Adding some particle fx to fake the blow-out fire and some smoke.

That's just an idea to simulate the explosion fx as far as I could figure out. Any ideas are very welcome.

Semicolon
Yeah, I was thinking this as well... myself, I'm concerned that the frame hit will be quite terrible flying over a city scape with moving surface vehicles and swapping buildings. Any idea how bad of a hit it would cause?

Thanks for the responses.
Krazyscotsman

Posted: Fri Apr 01, 2005 10:49 am
by :wumpus:
monster wrote:This is kind of why I wanted the StaticGeometry stuff to support a freeze/thaw paradigm;

- Build your city from lots of independent nodes and entities
- Freeze them into static geometry
- When a bomb hits a building;
- Thaw the static geometry
- Delete the exploded building (or replace it with a "rubble" model)
- Re-freeze the geometry
Isn't it even easier than this? The static geometry keeps the old "before freezing" node structure around, so you can leave out the "thaw" step.

Posted: Fri Apr 01, 2005 3:09 pm
by monster
The static geometry keeps the old "before freezing" node structure around, so you can leave out the "thaw" step.
Does it? Well that's even better then! Sorry, I've never actually looked at it!

Posted: Thu Apr 07, 2005 6:21 am
by CombatWombat
I notice there's no StaticGeometry::removeEntity() to match the StaticGeometry::addEntity(). So it looks like one has to destroy the whole StaticGeometry object to remove entities.

Is there a particular technical reason why a removeEntity() should not be on the StaticGeometry?

(Please don't mistake this post for complaining - I just started using the StaticGeometry class today, and quite simply, it rocks! :))

Thanks,

Mark/CW

Posted: Thu Apr 07, 2005 6:42 am
by RyanN
couldn't a shader that affects the verts create a damage look to a specific mesh object? ie: a shader could manipulate the verts and make cratters in the terrain mesh at a dynamic point. or could always do a OFP mesh noise effect.

Posted: Thu Apr 07, 2005 4:28 pm
by litobyte
Shader would be the best bet.

Look at the ooze.rfx or morph.rfx in RenderMonkey 1.6,
Those are procedural generic morphing, but I guess a physic impact on surface could be calculated somehow :)

Posted: Fri Apr 08, 2005 3:57 am
by arcane
Not wanting to continue this off topic, but PS3.0 shaders would provide an excellent basis for realtime deformations. You could store a very simple (64x64) texture for each building, and using a dependent texture read in the vertex shader, you could deform the mesh.

Of course, it wouldn't fall-back very well to old hardware.

Posted: Fri Apr 08, 2005 4:16 am
by Mr.Bloodworth
Why wouldnt you just make a mesh with an animation of distruction?

as in, Frame 1 = Static. Frame 2-120 = Animation of "Chunks" flying all over. Frame 121 = New static Demolished building.

?

Posted: Fri Apr 08, 2005 4:30 pm
by RoundSparrow
I think that last idea nailed it... seems like the perfect way to do it!

// disclaimer: I have no real experience at doing ANY of this.
/// disclaimer: I do have a lot of experience recognizing good ideas :)

Posted: Fri Apr 08, 2005 5:10 pm
by monster
What kind of animation are you planning to use for the chunks flying all over the place? As I understand it the animation that Ogre supports is skeletal; the number of vertices and polygons in the mesh remains constant and a skeleton defines how that mesh moves when animated. Not sure you could get chunks of masonry flying around the place using that approach. But I could well be wrong.

Also, if all your buildings are animated meshes then performance might be an issue. I thought the original question was how to have a big city (i.e. baked static geometry) and explode bits of it?

Posted: Fri Apr 08, 2005 10:53 pm
by Mr.Bloodworth
monster wrote:What kind of animation are you planning to use for the chunks flying all over the place? As I understand it the animation that Ogre supports is skeletal; the number of vertices and polygons in the mesh remains constant and a skeleton defines how that mesh moves when animated. Not sure you could get chunks of masonry flying around the place using that approach. But I could well be wrong.

Also, if all your buildings are animated meshes then performance might be an issue. I thought the original question was how to have a big city (i.e. baked static geometry) and explode bits of it?
Well, nothing is stopping you from using one bone in each "Chunk".

On the modeling side, yeah it would take a bit of work. Each chunk would have to be made like a piece of a puzzle. I thought that ogre uses parts of a timeline. So you could use some for of code that starts the animation when a certain situation is met. This isn't really an uncommon practice, its currently used.

As far as the "Hit" it would fall under the same factors as every thing else. How many "Chunks" ETC...

I understood the original question. But I think from the start is was the wrong approach. For one, this method doesn't require loading and unloading of anything, the mesh and all animations are already loaded. Its just waiting for something to trigger it. and when the animation is complete, the last frames or whatever are the "Static" mesh of the burning building. lol.

From my understanding this is a flight sim of some sort, So the geo for the buildings would not be that complicated in the first place. most likely just a cube with the correct textures. With the correct view distance. 2 or 3 different buildings (in the method I described) would give you slightly more geo than originally, but keep the diversified building (rotate them, offset them, ETC to make it not so repeated). I don't think it would be that much of a hassle as the way some one else suggested.

Would just fall more on the artiest than the coder.
monster wrote:What kind of animation are you planning to use for the chunks flying all over the place? As I understand it the animation that Ogre supports is skeletal; the number of vertices and polygons in the mesh remains constant and a skeleton defines how that mesh moves when animated.
Think of it like a pre-assimbled puzzle, Now... explode the puzzle from the middle out.

When your looking at the puzzle, its one whole, when it "explodes" it is not.

The number of polys ETC... never change.

I have never seen a shader that will take one pice og geo, chop into pices...and fling it.

Deformation is not the same as "exploding".

Posted: Wed Apr 13, 2005 5:04 pm
by krazyscotsman
Thanks for all the advice... We are wanting to take this sim beyond truly basic models such as a cube. One of the initial loctions will be Nellis AFB in Las Vegas. We want to accurately model the "strip" with the casinos of the era (early 80s) at least as well, but preferrably MUCH better, as Microsoft Flight Simulator 2004. Interesting thought about using bones as a means to destroy the building.

Krazyscotsman

Posted: Wed Apr 13, 2005 8:45 pm
by P
I m maybe wrong cuz i don t know if it s possible, but you can maybe rebuild the chunk which has a destroyed building along multiples frames using a temp mesh and send it to static geo as soon as the processing of this mehs is finished.


And it s maybe not needed if the chunk is small enough ( in the other hand you ll multiply render operations by going to small chunks )

Posted: Wed Apr 13, 2005 9:40 pm
by Mr.Bloodworth
krazyscotsman wrote:Thanks for all the advice... We are wanting to take this sim beyond truly basic models such as a cube. One of the initial loctions will be Nellis AFB in Las Vegas. We want to accurately model the "strip" with the casinos of the era (early 80s) at least as well, but preferrably MUCH better, as Microsoft Flight Simulator 2004. Interesting thought about using bones as a means to destroy the building.

Krazyscotsman
There is allways the particle emiters that could throw chunks of rocks and bricks all over, dosnt change the "building" thoe lol.