PDA

View Full Version : Car destruction



NecroDOME
18-05-2009, 06:06 PM
Hi all,

I wanted to share same ideas I have on cruising a car. When you drive in a virtual wall you would expect a car that it doesn't look the same as before.

How to crush a car in a virtual world?

Idea 1: As I'm using DirectX I could just pick the vertex buffer and displace some vertices as I like. But what if I have 10 cars. I need 10 vertex buffers. If I have 100 cars, I need 100 vertex buffers...

Idea 2: Only use 1 vertex buffer and displace everything in a shader on the video card. What I could do in this case is define some points on the car with a radius of 1 meter and displace everything inside upon crash.
To clarify: For example 2 on the front, near the front lights. When I drive into a wall I move the points back for about 0.2 meters. Now I can calculate in a shader the offset with some random value and it should look like it's crushed in front.
With this I only have to save a few points with a radius and the offset.

I like to hear your idea and what you think of it.

User137
19-05-2009, 10:26 AM
You could for example split car model in body parts so your destructed vertex arrays would be smaller.

Or you don't actually need to have separate vertex arrays at all if only moving front vertices, say only Z-coordinate that moves in collision. Then you would need to either calculate it from math formula or some kind of random table or both. You could also have sort of "weight"-map for car front that would maybe consist of 5 floating point values, so left side of car could get more crushed than right side.. or if you hit a lamppost it would crush the middle section.

I don't know anything about shaders so can't comment that ^^

NecroDOME
19-05-2009, 11:19 AM
I don't want to use more than one vertex buffer, but having vertex weights is something thats worth thinking about.

I also could use a second vertex buffer to define offsets.

chronozphere
19-05-2009, 01:24 PM
To clarify: For example 2 on the front, near the front lights. When I drive into a wall I move the points back for about 0.2 meters. Now I can calculate in a shader the offset with some random value and it should look like it's crushed in front.
With this I only have to save a few points with a radius and the offset.


Maybe it's an idea to let the ammount of displacement fade over distance. If you use a high-poly model, you will see a nice dent instead of some vertices that are suddenly moved backwards. You can also consider to move them slightly along their normal-vector. Maybe add a "collision vector" for displacement, add some randomness... etc. :)

If you want something more advanced, you should try vertex-weights or morphing. :)
Or just implement skeletal-animation without the animation part. If your car hits something, just move a joint.

NecroDOME
19-05-2009, 01:28 PM
Bone animation and weights go good together. Maybe that's worth a try :)

noeska
19-05-2009, 05:39 PM
Have a look at this ati demo: http://developer.amd.com/downloads/Skin_Animation.zip
it shows 1000 independendly deformed characters
So attache a bone structure to your mesh and use that to deform you object and you can handle a lot damaged cars. Will be an effort to correctly setup the bone to the skin for the end result to be looking good.

NecroDOME
19-05-2009, 08:32 PM
thnx Noeska :)

I'm looking for different approaches and see what works well. The advantage with bones is that I also can define parts that are hanging lose. Like an open door or an popped hood.

noeska
20-08-2009, 03:51 PM
Just curious. Have you got something working already?

NecroDOME
21-08-2009, 07:27 PM
Only a small test in a vertex shader. Nothing special...