Newb question: animated model in .obj format?

I'm using jme in Linux and I was wondering what program is my best bet for animation?

I used wings3d to make a model and texture it. I tried exporting it to .obj and importing it to Art of illusion (3d modeler written in java) and making a simple animation but it doesnt work.

Is the animation written in the .obj file? I looked and it didnt look like it was there.

I found the animation tutorials that come with jme but they use md2 or ms3d.

Is there any code I need to add after loading a model to start the animation?

:?

Sorry no luck with animations and .obj as the format simply doesn't support animations.



There are some other threads around discussing this in the forums, so maybe You should take the time and serach for animation for the basics.



Ok, quick answer: wings doesn't suppoert animation but is strong at modelling, art of illusion is not bad and in java and all but doesn't support exporting animations.

Your best free bet would be blender which can import .obj and has animating and quite good export capabilities. There's a blender -> jme xml exporter which supports keyframed animation but is not confirmed to work with the latest 2.40 blender release (Youre welcome to try and report :slight_smile: or export to md2 which jme can import, maybe there's even a milkshape exporter for blender ?

thanks for the reply winkman :wink:

Im going to try exporting an md2 and jme/xml from blender with animation and see what happens, ill post the results later.

i belive you can import a milkshape joint controller and set it to the obj model.

well i tried md2 export script and it said to use blender 2.40 so i downloaded 2.40 and it came with md2 export script built in, problem is it didnt work.

I can export .obj still but when I try to export a simple cube to md2 it gives an error and says check console

I cant find the damn console though.

edit: I found a program called "misfit model 3d" that runs in linux and exports md2. hope it works.

edit again: that was a lucky find cause I had an md2 with animation(no texture) running in jme in like 5 minutes! :smiley: SOOO easy compared to blender.

so if youre a total newb to 3d and you want an animated model…

edit again: texturing seems messed up in mm3d when import to jme. textures dont map correctly.

ok I have md2 file made in wings3d(looks like a dice) I can load in into blender or other modeling tool and the texture is mapped perfectly to the cube but when I load into JME the texture is way off. When I loaded the same model as .obj the texture was fine.

so is the problem with the way jme loads md2 or in my code?  :?

edit: this post seems to discuss the same problem.  http://www.jmonkeyengine.com/jmeforum/index.php?topic=847.0 

public class HelloMD2 extends SimpleGame{
 
    public static void main(String[] args) {
     
        HelloMD2 app=new HelloMD2();
        app.setDialogBehaviour(HelloMD2.FIRSTRUN_OR_NOCONFIGFILE_SHOW_PROPS_DIALOG);
        app.start();
    }
    protected void simpleInitGame() {

        Md2ToJme converter=new Md2ToJme();
        ByteArrayOutputStream BO=new ByteArrayOutputStream();

        URL textu=HelloMD2.class.getClassLoader().getResource("dice.bmp");
        URL freak=HelloMD2.class.getClassLoader().getResource("dice.md2");
        Node dice=null;
        try {     
            converter.convert(freak.openStream(),BO);         
        } catch (IOException e) {
            System.out.println("damn exceptions:" + e.getMessage());
        }
        JmeBinaryReader jbr=new JmeBinaryReader();
        try {       
            dice=jbr.loadBinaryFormat(new ByteArrayInputStream(BO.toByteArray()));      
        } catch (IOException e) {
            System.out.println("damn exceptions:" + e.getMessage());
        }

        TextureState ts = display.getRenderer().createTextureState();
        ts.setTexture(
        TextureManager.loadTexture(
            textu,
            Texture.MM_LINEAR,
            Texture.FM_LINEAR));
        dice.setRenderState(ts);
        dice.setLocalTranslation(new Vector3f(0,0,-20));
        dice.setLocalScale(15f);
        rootNode.attachChild(dice);
     }
    protected void simpleUpdate(){
       
    }
 }

Sorry, i don't know about md2 but i tested the blender exporter on blender 2.40 and my results are:

It's working ! - for my simple test-scene and on windows at least

I was able to export a model with keyframe (morph target) animation and texture.



The animation gave me only around 100 fps having 128 vertices 48 faces and 17 keyframes however ???

…have to test the performance on a more crowded scene…

EDIT: ok, not so bad, i still get around 30 fps with 125 of them at the same time :slight_smile:





You have to start blender from a command prompt in windows - this is the mentioned console



if You want to give blender another try then be prepared to use the help extensively !

You might want to go through some tutorials on texturing (the exporter needs an uv mapped texture in slot 0 on the first material of the selected model)

and animation (not that easy and overhauled in 2.40) so i recommend using the docs from:

when you say the blender exporter, are you referring to the xml exporter?

edit: I tried the blender xml exporter and got a properly textured model :smiley: :smiley:

the key was putting the texture in slot 0(thx winkman) I was using a UV mapping tutorial that didnt mention that. now im going to try a simple animation.

edit2: I tried a simple animation and it worked! very nice. now I just have learn blender :wink:

Yeah, i meant the blender->jme xml exporter made by hevee.

To speed up model loading in serious applications You should load them once and convert to binary format for further use.



…and yeah again, blender is not easy to get to speed with (i am still not very comfortable with most areas) but fortunately there are tutorials covering most aspects :slight_smile:

what i'm still pondering over is the best way to stick some addons to the animated models (sunglasses, backbags, handys and yeah the occassional flamethrower of course)

so is the xml exporter supposed to export skelatal animation? I tried and it didnt work.

Well, no the button has written skeletal on it, but i think heevee gave it up for morph target animation (keyframes using keyframe controllers in jme) which are written when You activate export skeletal animations.

Bone animation (like that importet from Milkshape and using joint-meshes and joint-controllers) shouldn't be to hard to add but that phyton strangles me with it's setup, intents and syntax so far.

That would be the two animation options supported by jme by now to my knowledge.

ok then, im not sure if im correctly understanding this:

the .xml exporter supports morph target animation which means I can only cange the location rotation and size of the entire object?

I cant bend an arm with bones or manipulate individual verticies?

is this correct?

I am trying to animate walking man using linux.

So am I correct that there is no current solution for this, only animate with milkshape?

sorry for so many newb questions :roll:



edit: I was able to get (individual vertex) animation working using relative vertex keys; I used this tutorial page 74.  :smiley:www.cs.waikato.ac.nz/~masood/teaching/304a/blender/BlenderTutorialPart3_.pdf

click “skeletal animations” when exporting.

This works but probably hard way to animate walking, skeleton would be better.This technique seems to be for things like facial movements but im going to use it, as skeletal is not supported as of yet.

If anyone has easier way to animate let me know.




The blender xml exporter supports atm afaik:


  1. morp-target animation -> done in jme with KeyframeController,
no weighting is currently supportet in jme so this could look worse than morph target


im not sure what weighting is, but I assumed the demo models were done with bone animation and they look awesome.

ah yes walk animating the models in blender is exactly the same ! You use an armature and pose it into keyframes.


im not sure if you mean you can use the two together cause I tried that.
I tried to use an armature(bone) to move a leg on my model and then record the vertex positions but it didnt work, with skeletal in blender you are in pose mode and with morph target you are in edit mode and the poses dont show up so I couldnt use bones at all.

Weighting = “Matrix palette skinning”



http://en.wikipedia.org/wiki/Skeletal_animation

vertex weighting is useful for allowing smooth deform in single peice mesh at present ms3d/jme support 1 vertex to 1 bone, not bad for boxy HL1 models or if you don't mind splitting your mesh to avoid the otherwise jagged look you would get without weights, vertex weighting allow you to produce a nice organic feel to your characters,

md3, md2, 3ds and such are not skelatal but I know some plugins for max that allow the export of weighted meshes to those formats but they are relatively old formats so these tools are often not maintained. try google

thanks for the replies :slight_smile: I am understanding more now.

the wikipedia link helped. I found this statment under "per-vertex animation"

Not all per-vertex animation has to be done by actually editting vertex positions. It is also possible to take vertex positions found in skeletal animation and then use those rendered as per-vertex animation.

does anyone use this technique in blender? I tried and it didnt work.

I'm just beginning to think about this:



Which way would give less performance:

a)

Make poses of a character with a real bones-system (not like milkshape, but with VW) and then interpolate with keyframe-animation.

b)

Implement a bone-sceletal animation with VW and define the animation using a path of transformations.



I think, the first way might consume more memory while the second might eventually be less performant.

That would be a classical time-memory-tradeoff.

Weighting in this context means defining which bone influences which vertexes how much. Eg. a vertex on the knee will most probably be influenced by changes on the bones of the upper and lower leg and weighting defines which bone has how much influence)



blender (2.40) visualizes this pretty good with his bone envelopes. All vertices in the envelope will get influenced but according to the distance to the bone (and multiple envelopes can contain the same vertex of course)

mud2005: