Help with vehicle damage animation system
by Martin "Founder" Hoover · in Torque Game Engine · 12/01/2003 (3:58 pm) · 12 replies
I decided to design a directional damage animation system for the vehicles in my project. It would work for either collision and/or projectile damage.
Using the damage location and the vehicles position I calculate where on the model the damage took place to call the animation for that section. Right now it is devided into 8 sections, 2 each for the front, rear, left and right sides of the vehicle. (Animations for the top and bottom should probably be added as well.) This works just fine, the sticky part comes with the implementation of the animations.
I am wanting to deform the mesh instead of just a simple texture/decal change. The deformation is the main source of problems. Simply animating the vertices for each section, and exporting them as morph blends will not work because in every frame of such a morph animation the position of every vertice is exported, thus whether or not it is a blend animation it is not able to show 2 sections damaged at the same time (using 2 animation threads). It also multiplies the file size ten fold.
The next two methods I imagined should work, except it will tend to be a major hassle for the modeler to undertake.
Using many dummy nodes I can do linked transforms on selections of vertices, I think this will allow the animations to act as blends, however I imagine this will also make for large file sizes.(I didn't actually try this one)
Using a bone/dummy system and the skin modifier to deform the mesh will create the animations. But this would require many bones in order to attain a decent looking crumpled/damaged area, and it's just not very fun to actually do.
The final method I cam up with is to split the model up into seperate sections, then do simple visibility animations to hide/unhide the normal and damaged meshes. This of course doubles the number of meshes in the file.
Ideally, each damage animation would have 5-10 frames, so that the frame number displayed could be set based on how much damage has been done to that section.(The way the current damage animation is played.)
Of course any of these methods would require extending the number of animation threads available for vehicles. (which hopefully is easy to do since I'm not exactly a programmer)
So my question is, can anyone think of a better/more efficient method to do this?
Right now I am leaning towards using the sectioned model/visibility method, though it would not be practical to have more then 1 frame as it would require many extra meshes in the model. I'll try out using linked xForms tonight and see how labour intensive that method will be, but I would really like to get someone elses perspective on this to see what ideas I have missed.
Using the damage location and the vehicles position I calculate where on the model the damage took place to call the animation for that section. Right now it is devided into 8 sections, 2 each for the front, rear, left and right sides of the vehicle. (Animations for the top and bottom should probably be added as well.) This works just fine, the sticky part comes with the implementation of the animations.
I am wanting to deform the mesh instead of just a simple texture/decal change. The deformation is the main source of problems. Simply animating the vertices for each section, and exporting them as morph blends will not work because in every frame of such a morph animation the position of every vertice is exported, thus whether or not it is a blend animation it is not able to show 2 sections damaged at the same time (using 2 animation threads). It also multiplies the file size ten fold.
The next two methods I imagined should work, except it will tend to be a major hassle for the modeler to undertake.
Using many dummy nodes I can do linked transforms on selections of vertices, I think this will allow the animations to act as blends, however I imagine this will also make for large file sizes.(I didn't actually try this one)
Using a bone/dummy system and the skin modifier to deform the mesh will create the animations. But this would require many bones in order to attain a decent looking crumpled/damaged area, and it's just not very fun to actually do.
The final method I cam up with is to split the model up into seperate sections, then do simple visibility animations to hide/unhide the normal and damaged meshes. This of course doubles the number of meshes in the file.
Ideally, each damage animation would have 5-10 frames, so that the frame number displayed could be set based on how much damage has been done to that section.(The way the current damage animation is played.)
Of course any of these methods would require extending the number of animation threads available for vehicles. (which hopefully is easy to do since I'm not exactly a programmer)
So my question is, can anyone think of a better/more efficient method to do this?
Right now I am leaning towards using the sectioned model/visibility method, though it would not be practical to have more then 1 frame as it would require many extra meshes in the model. I'll try out using linked xForms tonight and see how labour intensive that method will be, but I would really like to get someone elses perspective on this to see what ideas I have missed.
#2
12/02/2003 (2:05 pm)
Well if unlinked morph animations could be exported containing only the animation information for just the vertices that have moved, then the file size would be small, and I imagine the anims could be blended together on multiple threads, and I'd be plenty happy.
#3
12/02/2003 (2:08 pm)
Go for it... You've got the exporter source!
#4
Making several sections, would be, to me, more of a pain in the butt to model as each section would have it's own detail level and all the parts just make working with it a little unweildly.
12/02/2003 (3:08 pm)
I would go with bones and blends myself. The animations will be able to work independently, and the file size will be small.Making several sections, would be, to me, more of a pain in the butt to model as each section would have it's own detail level and all the parts just make working with it a little unweildly.
#5
Study any crash footage shot at normal speed and then slowed down. Impacts happen over a few frames not a few seconds. Then apply the Chuck Jones formula, you only need 3 frams to show anything violent. the before frame, the midway frame and the aftermath frame.
Single frame thru any Roadrunner Coyote cartoon and notice that the impact shots of the Coyote falling off a cliff and hitting the ground are only 3 frames.
Same with the anvil on the head gag and any gag where someone gets hit over the head for that matter, and then remember that those cartoons were done on 2's or 3's which means 12 frames a second or less!
12/02/2003 (3:41 pm)
Honestly you don't need more than 3 frames for anything like damage, 2 would probably be enough for projectiles since the explosion will cover up any animation anyway.Study any crash footage shot at normal speed and then slowed down. Impacts happen over a few frames not a few seconds. Then apply the Chuck Jones formula, you only need 3 frams to show anything violent. the before frame, the midway frame and the aftermath frame.
Single frame thru any Roadrunner Coyote cartoon and notice that the impact shots of the Coyote falling off a cliff and hitting the ground are only 3 frames.
Same with the anvil on the head gag and any gag where someone gets hit over the head for that matter, and then remember that those cartoons were done on 2's or 3's which means 12 frames a second or less!
#6
12/02/2003 (4:10 pm)
The frames are not used to display a moving animation, but rather a damage level. i.e. frame 1 = 10% damage, frame 2 = 20% damage, etc.
#7
04/10/2006 (9:41 am)
Has anyone actually had any success with a deformation system for vehicles in TGE as of yet or is there any work currently in progress that is known?
#8
I do have to say organizing the meshes so you can keep track of all the elements floating around the model's hierarchy is extremely important. If I showed you the object list of our first model (complete with LOD) you'd probably have a heartattack. I'm keeping notes and developing a tutorial on the process while we're working. I'll release it as a resource when we're far enough along.
04/10/2006 (11:27 am)
Yeah, Justin Kovac and I are developing vehicles for a project. The system we're using is similiar to the one described by Joe previously but its not for the faint of heart. Basically we're swapping out clean meshes for damaged meshes once a certain amount of damaged is registered for the part in question. We're not using animations as the swapout is instantanious and code controls all the damage activity. Robert Stewart and Krunal Patel developed the code support and the system works flawlessly. I do have to say organizing the meshes so you can keep track of all the elements floating around the model's hierarchy is extremely important. If I showed you the object list of our first model (complete with LOD) you'd probably have a heartattack. I'm keeping notes and developing a tutorial on the process while we're working. I'll release it as a resource when we're far enough along.
#9
04/10/2006 (12:19 pm)
Wonderful. I look forward to it and thank you for such a prompt response.
#10
09/26/2006 (8:42 pm)
N R Bharathae - Its been over 5 months now and I was just trying to see if you guys got anywhere with this? I am about to try my own attempt, but since you mentioned you were going to release it as a resource I wanted to check with you first before reinventing the wheel.
#11
05/03/2007 (8:36 am)
[bump] Is there any progress about this subject?
#12
I modified my vehicle code extesively to allow for each hitbox to have its own datablock so it could have armor characterisitics as well and to track the different damage states so it would be easier to access from script.
Still finishing up the script part though, although it should work fine since all previousl console tests to check for hitbox area detection have been successful and my mesh changeability works fine.
To help mask the mesh interchange (Although its almost insantaneous) I am using the weapon explosion for projectile based collisions and the soft and hard impact emitters for non-projectile based.
I have not seen any problems with in game performance either. You can find both resources here at GG. The changes to the vehicle code were pretty easy with some help from a couple guys better at this stuff than I am.
As for getting deformation to work, or animations, I couldnt get it to work. Would love to see it if you manage to do it.
Thanks again Tom and N.R.
05/03/2007 (9:30 am)
To be honest I had to go with the hide meshes ability and added the hitbox resource to my vehicles. I also managed to get the system to detect collisions other than projectile based by modifying the onImpact and notifyCollision code to do a rayCast back at my vehicle from the collision point to give me the hitbox involved. I modified my vehicle code extesively to allow for each hitbox to have its own datablock so it could have armor characterisitics as well and to track the different damage states so it would be easier to access from script.
Still finishing up the script part though, although it should work fine since all previousl console tests to check for hitbox area detection have been successful and my mesh changeability works fine.
To help mask the mesh interchange (Although its almost insantaneous) I am using the weapon explosion for projectile based collisions and the soft and hard impact emitters for non-projectile based.
I have not seen any problems with in game performance either. You can find both resources here at GG. The changes to the vehicle code were pretty easy with some help from a couple guys better at this stuff than I am.
As for getting deformation to work, or animations, I couldnt get it to work. Would love to see it if you manage to do it.
Thanks again Tom and N.R.
Associate Kyle Carter
Quite a thorny problem!