Results 1 to 9 of 9

Thread: Car destruction

  1. #1
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Car destruction

    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.
    NecroSOFT - End of line -

  2. #2

    Re: Car destruction

    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 ^^

  3. #3
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Re: Car destruction

    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.
    NecroSOFT - End of line -

  4. #4

    Re: Car destruction

    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.
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  5. #5
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Re: Car destruction

    Bone animation and weights go good together. Maybe that's worth a try
    NecroSOFT - End of line -

  6. #6

    Re: Car destruction

    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.
    http://3das.noeska.com - create adventure games without programming

  7. #7
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Re: Car destruction

    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.
    NecroSOFT - End of line -

  8. #8

    Re: Car destruction

    Just curious. Have you got something working already?
    http://3das.noeska.com - create adventure games without programming

  9. #9
    Legendary Member NecroDOME's Avatar
    Join Date
    Mar 2004
    Location
    The Netherlands, Eindhoven
    Posts
    1,059

    Re: Car destruction

    Only a small test in a vertex shader. Nothing special...
    NecroSOFT - End of line -

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •