I am working on a project and would like to dynamically animate a 3D Studio Max skeletal model, in real-time, using Java3D programmatically.
I have been investigating Cal3D’s API but this is written in C++.
Any help would be appreciated.
I am working on a project and would like to dynamically animate a 3D Studio Max skeletal model, in real-time, using Java3D programmatically.
I have been investigating Cal3D’s API but this is written in C++.
Any help would be appreciated.
I ended writing a fairly complex custom skeletal animation engine myself. I can’t share the code, but I’m happy to point out the resources I used. Perhaps the best one was this tutorial on skeletal animation using OpenGL and the milkshape3D file format:
http://rsn.gamedev.net/tutorials/ms3danim.asp
And to coincide with that, here’s a Java milshape3D loader (although it doesn’t do animation):
http://home.earthlink.net/~kduling/Milkshape/
Finally, I got a lot of good help from Dilvish over at the Magicosm project. Here’s a link to our discussion on their forums:
http://www.sword-and-sorcery.com/ubb/Forum7/HTML/000001.html
Hope all this helps. It’s a lot of work. Good luck!
[quote]I am working on a project and would like to dynamically animate a 3D Studio Max skeletal model, in real-time, using Java3D programmatically.
I have been investigating Cal3D’s API but this is written in C++.
Any help would be appreciated.
[/quote]
You can use transformations and in that case your models must be composed of multiple body parts. You need to join them together so that they instersect in the joints and there are no artifacts showing when they rotate.
Another solution is to use java morphing abilities. More complex, more time consuming but you only have to do one mesh. You then need to create a skeleton of transforms and put it inside the single mesh.
However (someone correct me if i am wrong) there is some data that needs to be attached to each vertex for the vertex to know what tramsfom or what list of transforms affect it and in what percentage.
What do you prefer ? Maybe its better to do both then profile your code to see the advantages and disadvantages.
Actually, you can use a single mesh by creating a GeometryArray and using the setCoordRefFloat() and setNormalRefFloat() methods. I then implemented the GeometryUpdater interface, and used this class to directly change the float arrays used to create the mesh.
I highly reccomend you avoid the morphing technique. It’s much slower than directly changing the vertices manually.
I’ve used the Morph to do some animation, but it is mostly good for
non-skeletal stuff where you want some organic fluidity to the animation.
It is also more memory consumptive if you are morphing between several large meshes. But I have found it quick to prototype with.
I have started experimenting with GeometryArray and GeometryUpdater interface, but if you are after skeletal animation as I was you would find it too inflexible and really hard to manage. So I switch into “body parts” using 1 transformgroup per body part - I guess I have around 36 now. And to make it move I use my Behavior object that seems to work just fine. I took other’s people advise on using threads instead of behavior object but didnt really see any advantage to it. As was said morph is too expensive in terms of memory consumption - better to avoid it .
But to contradict myself right way I admit I am experimenting with morphs and facial animation which I was not able to achieve using my previously mention technique .
My milkshape loader (http://home.earthlink.net/~kduling/Milkshape/index.html)will do animations just as soon as I can figure them out.
The project isn’t dead, but I haven’t really heard much feedback on it lately. It’s sort of slipped to the bottom of the pile. If anyone would care to help with it, please send me mail. My email address is on the page.
I recently hacked together a solution to dynamicly animate a model using skeletal animation and skinning for my project Nevermore (see http://www.saar.se).
I saved both the whole model mesh and all the separate parts of the model in different VRML-files (since I was working in Maya, any format for which there is a loader for Java3D will do). After that I wrote a utility that matched the vertices in all the files representing the parts of the model with the vertices in the mesh. This allowed me to calculate skin weights for each vertex and I could also easily have calculated the connectivity between the different parts if my model had not been so simple to make this unnecessary.
I then created a bone hierarchy where each part of the model was represented by a bone that contained references to those vertices in the full mesh that belonged to the bone and skin weights for each vertex. Each bone also contained a transform that specified the position of the bone. I then animated the model by just changing the transform of each bone. The vertices in the mesh were recalculated and updated by traversing the bone hierarchy in call to GeometryUpdater.
This solution is quite quick to implement and will work fine if you don’t have to export any animations from the modeling software and if you just have to work with really few models.
For my final project for my computer animation course I came up w/ a skeletal animation programatic model (semi-IK Chain thing).
This is not using morphs but I think this is kinda what William is talking about.
check it out at
http://www.parl.clemson.edu/~mspeth/classes/cpsc808/project5/project5.html
Hi there,
The problem I have with this is, does the animation have to be manually entered (i.e. with co-ordinates)?
Is there a way to import animation done in another package such as Maya, 3DStudio, e.t.c?
It feels far more artistic and easy to do it while you can see the results rather than working it out first…
Thanks in advance
Look at the net for NWN Model Loader (windows version from Bioware). It should contain few files which describe a lot of animations for humanoid body - it should be more than enough for testing. It uses separate object for each bone approach - no multiple weights (in basic models, dragon wings use skinning, but you cannot download them from this site).
If you want to look at my implementation, please check out http://nwn-j3d.sf.net - but there is a lot of other things happening there, so I doubt if it will be a very good learning resource.