|  | Blitz3D Newbies: Max -> .B3D Export and animation
by TigerZ (Hau Nghiep Phan) 
 
 
Introduction:
 ***Note: I hear Ultimate Unwrap is a much easier to export into .B3d, but at the time I wrote this tutorial, it wasnt supported. To my understanding, Ultimate Unwrap has its own plugin for MAX to export into its own format, and then import it into UU, the main benifit is that it supports blending of weight, but remember that the .B3d still doesnt support weight vertices.***
If youre doing a game that requires character animation or anything like that, this tutorial is right for you. Altough once Rob finishes his B3D export for Max, this tutorial will pretty much become obsolete, but its the best alternative for now. Ill also be assuming that you have a basic concept of 3D studio Max.
Heres an overview of the steps: 
1.	from Max, assign vertices to bones, export model and animation to SMD file format
2.	from MilkShape3D, import model, animation and export to B3D format
3.	from Blitz3D, load and animate
 
Required:
Step 1 
This part is very crucial, and it seems to have puzzled many people so Ill try and make it as painless as possible. 
In 3D Studio Max, select the Mesh model
This will provide a very quick and dirty vertex assignment, but if you need to adjust vertices in a more precise way, here are the steps:
After doing the above steps,A. Click the MODIFY tab
B. Select PHYSIQUE
C. Click ATTACH TO NODE
D. Click on the Central pivot of the Biped Character
E. Select NO BLENDING, this is very important
F. Click on INITIALIZE
  
Your model should now be B3D file readyA. While having PHYSIQUE as the current modifier, open the PHYSIQUE tree, (by clicking on that + sign) select VERTEX
B. Make sure that theres NO BLENDING
C. You can now start assigning vertices to the right bone, and yes, they are RED colored, but it doesnt really matter as long as theres no blending.
  
A. In 3D Studio Max, click on FILES, then EXPORT, in the SAVE AS TYPE, select VALVE SMD, give it a name (Body_Mesh.smd) and SAVE.
B. A window will then appear, select REFERENCE FRAME, and click OK.
C. Redo Step A, but now give it another name for the file (Body_Animation.smd), and when the window appears, select SKELETAL ANIMATION.
TIP: You dont have to use the same skeleton to animate your character; you can actually have another skeleton without a model and vertex assignment on it. But the skeletons BONES NAME should be the same else it wont work.
 
Step 2 
This part is easy, but very important you can now close 3D studio Max.
	In MilkShape3D
A. Click on FILES, then IMPORT, then HALF-LIFE SMD, select the Body_Mesh.smd file (or the model reference), and click OK on the window that appears.
B. Redo Step A, but now import the Body_Animation.smd file (or the animation reference), say NO to the window that appears.
NOTE: If it ever says that you have imported too many frames, just say NO to the prompt, and I *think* that it solves the problem.
C. You can now check if the animation model was imported properly, in the lower right window of MilkShape3D, click on ANIM, you can now play the animation to see if it works or not.
D. Click on FILES, the EXPORT, then Blitz Basic 3D, give it a name (Body.b3d), and voila, your model is now ready!
 
Step 3 
This part is the final step, its easy, but you should know that all frames that where imported into MilkShape3D are now offset by 2 Frames, so if your animation goes from 0 to 100, in the B3D file format, it would be 2 to 102, remember this, its VERY important.
In Blitz Basic 3D
	The full code for that section which is in the GAME LOOP:A. Load the mesh and extract each animation sequence
 
NOTE: You dont have to extract each animation sequence in a sequential way, you could extract frames 100 to 200 for animation sequence 1, and have frames 0 to 100 for animation sequence 2.
B. If you want the character to have an IDLE loop at the start, do this BEFORE the game loop
This statement will loop the animation, animating at 0.5 speed, for sequence 2 (the IDLE animation), and have a transition value of 4.
C. To have the character change his animation while the game runs, youll need something like this:
This checks to see if the animation is already animating, if it is, then dont reanimate it again, or youll have a weird loop happening.
 The value moved will tell which animation sequence is going to be run. So if you change the value 'moved' to 15, the character will jump.
 This will prevent the animation to be replayed again from the start.
 Check if the character is animating, if its not animating, the go to IDLE state.
 
 
Conclusion:
Phew! I hope I didnt confuse you or anything, the code itself isnt really hard to understand, but again, I could be the one thats writing it bad :P. Anyway I hope I cleared up some stuffs about Skeletal Animation using B3D.
 For a printable copy of this article, please click HERE.
 
   
 
 |