TUTORIAL: How to Rig and Vertex Animate an object for BZ2.

Moderators: GSH, VSMIT, Red Devil, Commando

User avatar
TheJamsh
Bull Dog
Posts: 689
Joined: Sat Feb 19, 2011 5:49 pm

TUTORIAL: How to Rig and Vertex Animate an object for BZ2.

Post by TheJamsh »

First things first, download and install the MAX Script written by Nielk1 which allows you to export the envelopes into the .xsi file. You can get that here.

Now, open up your model in 3DS Max (you'll need to be using 32-bit in order to make use of the .xsi exporter). In this example, I will use the AAN Sabre Tank model and animate the antenna to sway around in the wind realistically and easily, using multiple bones AND an IK Solver.

This is how the antenna looks in Max. As you can see the Antenna is a single object, and is made up of a series of segments to give it a curved overall shape. Because of this, we'll need to use multiple bones to animate it realistically, as using too few bones will deform the shape of the antenna as it sways, or cause it to pivot around a single point, which isn't what we want. You can also see on the right hand side that the antenna currently has a long list of modifiers, to avoid confusion and complications down the line, collapse any stacks down and ensure that all parts of the model are only left as 'Editable Meshes'. If you think you're going to need to make changes later, save to a new file name.

Image

Image

Now we'll need to set up the animation root and the bones. To do so, simply create a cube primitive and set it's size to 1.0 for L, W and H (or whatever seems appropriate for the model you're using, you'll ideally want to hide it inside the geometry). Rename the cube to hp_animroot__h. Now add an edit mesh modifier, and collapse the stack, you should see something like the image below.

Image

This object will serve as the root object for all of your bone animations. Move it to the centre of the model (the origin in this example), and go to the hierarchy editor. If you don't have one already, create a hp_dummyroot object, and set that as the master parent object (shown below). It's good practice to use a dummyroot object as the origin for the other parts of the mesh anyway.

Image

Now make the hp_animroot__h object a child of the hp_dummyroot object.

Image

Now we need to set up the bones. Before doing so, you'll want to make sure that ALL of your animation controllers will be set to TCB. This is easy enough, simple select the HP_animroot__h object, and navigate to the 'Motion' panel. Under the 'assign controller' sub-window, expand the transform controller, click on the Position controller, and click the assign controller button (the small square with a tick above the controller list). Change this to 'TCB Position', and do the same thing for Rotation and Scale. Each time you do this, press the 'Make Default' button in the assign controller dialogue box, then hit OK for each one.

Image

Now every time you create a new object, it's animation controllers will default to TCB, which is the only one BZ2 supports.

Go back to the create panel, and navigate to 'systems' (the cogs on the far right in 3DS Max 2010). Then click on 'Bones'. You can now navigate to a good location, and draw the bones from start to finish by clicking and dragging. Once you reach the end of the structure, hit the ESC key to add the end bone. In the images below, I'm using the side view to accurately line up the bones with the antenna's segments. You'll have to figure out what works best for your model.

Image

Image

Because you clicked and dragged, the hierarchy for these bones is already set up for us, but we need to make the bone structure a child of the animroot object we created earlier. Do that now in the hierarchy editor.

Image

Now we'll need to set the parameters up. Navigate to the hierarchy panel, and to the IK page. Select each bone individually, and check the 'Bind Orientation' and 'Bind Position' check boxes. For any bone that is NOT going to move, also check the 'Terminator' box. This includes the animroot object.

Image

Now that this is done, we can actually animate. You can choose to animate the bones individually, which will work for some methods and not others. For this example though, we want to use an IK solver. Select the end bone of the structure, then go to Animation > IK Solvers > HI IK Solver, and drag to the second bone in the chain. You can drag to any bone and form a chain, but we want to link to this one in this example. Click on the bone to create the chain.

Image

You can now move the IK chain, and the bones will move in relation to it. Remember that we haven't skinned the antenna yet, so make sure you undo any movement to put it back to the original position.

Select the antenna and add a 'Skin' modifier. Click to Add bones, and add the hp_animroot__h object first. Then repeat this process and add all of the bones. It's important that you add the animroot object first. You may need to edit the envelopes to ensure that the bones only effect the vertices you want them too. The hotter the colour of the vertex, the more affected it will be by the bones movement.

Image

Now that you've rigged the antenna, you can drag the IK solver object, and watch your object deform, flex and bend as you do so. Key in your animations by moving the IK solver as per the usual method.

BZ2 doesn't support IK Objects, so we'll need to 'bake' this animation into the bones themselves, and BZ2 will move those. This is relatively simple. Select the first bone, and navigate to the 'Motion' panel again. This time, click on 'Trajectories'. Set the start and end time to match the length of your animation, and hit 'Collapse'. You bone should now be automatically key-framed according to the IK solvers animation. Repeat this step for all affected bones.

Image

You can now safely delete the IK Solver object, and you animation will remain there in the bones themselves! Test the animation by hitting the 'Play' button. It should also be smoother once the IK solver has been deleted.

Now we can export this animation to use in BZ2. Export the model as an XSI, and be sure to check the 'animation' box, which will export the animation data into the .XSI. Now you'll need to export the 'Envelope' data to that .xsi also, in order for it to work.

Go to MAXScript > Run Script, and select Nielk1's envelope exporter script. You'll now be prompted to select the file you just exported. Do so, and press 'Open'.

That’s it! Now test your vertex animation in-game!


Pro Tip: To ensure the bones are invisible in-game, add the __h suffix to each ones name!
Last edited by TheJamsh on Tue Jul 03, 2012 9:24 pm, edited 1 time in total.
Developer @ Stormtide
viewtopic.php?f=4&t=2350#p40547 << My UE4 Battlezone Project

ModDB - Battlezone II Unofficial Expansion Pack
User avatar
TheJamsh
Bull Dog
Posts: 689
Joined: Sat Feb 19, 2011 5:49 pm

Re: Tutorial: How to Rig and Animate an object for BZ2.

Post by TheJamsh »

Update: Added smaller images. Didn't realise how huge they were.
Developer @ Stormtide
viewtopic.php?f=4&t=2350#p40547 << My UE4 Battlezone Project

ModDB - Battlezone II Unofficial Expansion Pack
User avatar
Zax
Attila
Posts: 1388
Joined: Sat Feb 19, 2011 6:56 am

Re: TUTORIAL: How to Rig and Vertex Animate an object for BZ

Post by Zax »

Video of finished result?
◥▶◀◤ row row, fight the powuh
User avatar
TheJamsh
Bull Dog
Posts: 689
Joined: Sat Feb 19, 2011 5:49 pm

Re: TUTORIAL: How to Rig and Vertex Animate an object for BZ

Post by TheJamsh »

Zax wrote:Video of finished result?
Soon, just rigging the engine fins at the moment which is a tad more finicky, as there's ten in total :S
Developer @ Stormtide
viewtopic.php?f=4&t=2350#p40547 << My UE4 Battlezone Project

ModDB - Battlezone II Unofficial Expansion Pack
User avatar
General BlackDragon
Flying Mauler
Posts: 2408
Joined: Sat Feb 19, 2011 6:37 am
Contact:

Re: TUTORIAL: How to Rig and Vertex Animate an object for BZ

Post by General BlackDragon »

animName4 = "idle"
animFile4 = "YOURXSIANIMATION.xsi"
RunAnimation = "idle"
RunAnimIsLooped = true
Battlezone Classic Public Forums
*****General BlackDragon*****
User avatar
Nielk1
Flying Mauler
Posts: 2991
Joined: Fri Feb 18, 2011 10:35 pm
Contact:

Re: TUTORIAL: How to Rig and Vertex Animate an object for BZ

Post by Nielk1 »

That is odd considering I never needed to use a solver for the fang willow, I just did straight interactive IK.

You can even do ragdoll physics if you want, all you have to do is be sure you bake it down to the bones as TCB translation and rotation.
User avatar
TheJamsh
Bull Dog
Posts: 689
Joined: Sat Feb 19, 2011 5:49 pm

Re: TUTORIAL: How to Rig and Vertex Animate an object for BZ

Post by TheJamsh »

Nielk1 wrote:That is odd considering I never needed to use a solver for the fang willow, I just did straight interactive IK.

You can even do ragdoll physics if you want, all you have to do is be sure you bake it down to the bones as TCB translation and rotation.
It is quite strange, my 3DS Max has been misbehaving a bit recently though. When I used an interactive IK it only moved the top section.

EDIT. I've run into a speedbump as usual. Can't figure out how to align a bone properly with this edge, mainly because the edge's axis don't line up with itself. Anyone able to help? See thread below.

viewtopic.php?f=13&t=1376
Developer @ Stormtide
viewtopic.php?f=4&t=2350#p40547 << My UE4 Battlezone Project

ModDB - Battlezone II Unofficial Expansion Pack
Apollo
Sabre
Posts: 456
Joined: Sat Feb 19, 2011 9:51 pm

Re: TUTORIAL: How to Rig and Vertex Animate an object for BZ

Post by Apollo »

The link to GenerateXSIBoneEnvelopes.zip throuh gamefront.com crashes my IE 8 and recovers then repeats.
Is there a better link that doesn't require jumping throuh hoops?
Activision anet servers for all legacy anet games: Anet Servers
BattleZone Club (Supporting BattleZone 1.4, The Red Odyssey, BattleZone Enhanced, BattleZone 1.5 and Bionite)
BattleZone 1 Community Since 2002
User avatar
TheJamsh
Bull Dog
Posts: 689
Joined: Sat Feb 19, 2011 5:49 pm

Re: TUTORIAL: How to Rig and Vertex Animate an object for BZ

Post by TheJamsh »

Apollo wrote:The link to GenerateXSIBoneEnvelopes.zip throuh gamefront.com crashes my IE 8 and recovers then repeats.
Is there a better link that doesn't require jumping throuh hoops?
That's just where Nielk1 uploaded it, best guess is to switch to a better browser.

BTW, I literally just finished the animations on the tank. Need to get a short video going methinks. Took me forever to work out how to do the engines. Learnt the hard way that the 'Mirror Bones' button is there for a reason...
Developer @ Stormtide
viewtopic.php?f=4&t=2350#p40547 << My UE4 Battlezone Project

ModDB - Battlezone II Unofficial Expansion Pack
User avatar
MrTwosheds
Recycler
Posts: 3059
Joined: Sat Feb 19, 2011 8:37 am
Location: Outer Space
Contact:

Re: TUTORIAL: How to Rig and Vertex Animate an object for BZ

Post by MrTwosheds »

Just imagine the fun I'm having with a 40 bone, 4 flexible legged walker.... :shock:
The Silence continues. The War Of Lies has no end.
User avatar
Zax
Attila
Posts: 1388
Joined: Sat Feb 19, 2011 6:56 am

Re: TUTORIAL: How to Rig and Vertex Animate an object for BZ

Post by Zax »

MrTwosheds wrote:Just imagine the fun I'm having with a 40 bone, 4 flexible legged walker.... :shock:
I watched the commentary on War of the Worlds (new one). They said getting the tripods looking right was a feat in and of itself. So try it with 3 legs :D
◥▶◀◤ row row, fight the powuh
User avatar
Zero Angel
Attila
Posts: 1536
Joined: Mon Feb 21, 2011 12:54 am
Contact:

Re: TUTORIAL: How to Rig and Vertex Animate an object for BZ

Post by Zero Angel »

I bet that tank picks up some sweet radio stations now.
Regulators
Regulate any stealin' of this biometal pool, we're damn good, too
But you can't be any geek off the street
Gotta be handy with the chains if you know what I mean
Earn your keep
User avatar
Nielk1
Flying Mauler
Posts: 2991
Joined: Fri Feb 18, 2011 10:35 pm
Contact:

Re: TUTORIAL: How to Rig and Vertex Animate an object for BZ

Post by Nielk1 »

Down the road I might edit the script. I found the script that Three Rings uses to export their models into XML (the entire model BTW) and I think I can adapt how they handled their skin/physic envelopes to get all around better code.
User avatar
MrTwosheds
Recycler
Posts: 3059
Joined: Sat Feb 19, 2011 8:37 am
Location: Outer Space
Contact:

Re: TUTORIAL: How to Rig and Vertex Animate an object for BZ

Post by MrTwosheds »

So try it with 3 legs
Believe me I thought about it, but making a walk that does not lurch the cockpit about and looks right is just about impossible, Nature got it right, 3 legs is a dumb idea. Its all very well for these movie makers, they don't actually have to drive them.
The Silence continues. The War Of Lies has no end.
User avatar
TheJamsh
Bull Dog
Posts: 689
Joined: Sat Feb 19, 2011 5:49 pm

Re: TUTORIAL: How to Rig and Vertex Animate an object for BZ

Post by TheJamsh »

By the way guys... BAM, here's some BZ2 porn...

http://www.youtube.com/watch?v=YR7UiVND584&hd=1
Developer @ Stormtide
viewtopic.php?f=4&t=2350#p40547 << My UE4 Battlezone Project

ModDB - Battlezone II Unofficial Expansion Pack
Post Reply