Bone(Skeleton) Skin Animation with 3ds

Hi everyone

I try to create an animation with an 3ds model. For this purpose I wrote my own class. Worked fine until i tried to set up my skeleton.

I cannot use setSkin() with the 3ds model node. Any ideas?


package game.bin.importer;


import com.jme.animation.SkinNode;
import com.jme.bounding.BoundingBox;
import com.jme.image.Texture;
import com.jme.math.FastMath;
import com.jme.math.Quaternion;
import com.jme.math.Vector3f;
import com.jme.scene.Node;
import com.jme.scene.shape.Box;
import com.jme.scene.state.TextureState;
import com.jme.system.DisplaySystem;
import com.jme.util.TextureManager;
import com.jme.util.export.binary.BinaryImporter;
import com.jmex.model.converters.MaxToJme;

public class Mesh extends Node{
   private DisplaySystem display = null;
   private URL model_path = null;
   private URL texture_path = null;
   private Node model = null;
   private TextureState ts = null;
   private SkinNode model_skin;
   public Mesh(DisplaySystem display, String meshpath, String texturepath){
      this.display = display;
      texture_path = Mesh.class.getClassLoader().getResource(texturepath);
      model_path = Mesh.class.getClassLoader().getResource(meshpath);
      model_skin = new SkinNode("test skin");
      model_skin.setSkin(loadMesh(model_path)); ////!!!!!!
   public Node loadMesh(URL modelToLoad){
        try {
            MaxToJme C1 = new MaxToJme();
            ByteArrayOutputStream BO = new ByteArrayOutputStream();
            C1.convert(new BufferedInputStream(modelToLoad.openStream()), BO);
            model = (Node)BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray()));
            model.setLocalTranslation(new Vector3f(0,0,0));
            model.setModelBound(new BoundingBox());
            Quaternion temp = new Quaternion();
            temp.fromAngleAxis(FastMath.PI / 2, new Vector3f(-1, 0, 0));
            return model;
        } catch (IOException e) {
            //logger.log(Level.SEVERE, "Failed to load Max file", e);
        return null;
   public TextureState loadTexture(URL textureToLoad){
        TextureState ts=display.getRenderer().createTextureState();
        ts.setTexture(TextureManager.loadTexture(texture_path ,Texture.MM_LINEAR,Texture.FM_LINEAR));
      return ts;
   public void rotate(float x, float y, float z){
      Quaternion temp = new Quaternion();
      temp.fromAngleAxis(x, new Vector3f(1, 0, 0));

not sure what u are trying to do but 3ds doesn't support skinning, try md5 or collada, md5 is the best working solution at this point though.

if u are trying to programatically skin and animate your model though u need somebody elses help :smiley:

There is no way?! Hard to believe

In other programms I have no problems with skinning 3ds models.

I don't like collada.

Md5 is a way, but I prefere 3ds, because I want to create a skeleton inside jme and connect the model afterwards with the skeleton. I can't imagine that 3ds is a problem and collada not!

Jme convert 3ds to jme, so why is their a problem?

I want to create an animation(human) with 3ds, for example moving a arm. But without skinning, this is impossible, right?

sorry for not being clear, I mean 'I' can't help


your questions aren't clear.  :? :slight_smile:

Where would you like to create the animations?

I try to create an animation with an 3ds model

can't imagine that 3ds is a problem and collada not!

Sounds like you want to import a .3ds model with animations created in 3DS MAX??!!
So "rigging" (create the model, apply a skin-modifier and bones to it, and set the weights-values) is done in 3DS MAX.
But skin and weights are the features which .3ds doesn't support for export. Collada does support it, at least in the specification. But it seems like no one here has achived to get a collada modell with weights and bones into jme, except the NC-Soft guys with their own exporter, which sadly isn't available :(. MD5 does support skin and weights as well, and the md5 importer for jme works quite fine. So animate your model in 3DS MAX, use "der_ton's" md5 exporter and you will get it into jme.

because I want to create a skeleton inside jme and connect the model afterwards with the skeleton

can't imagine that 3ds is a problem and collada not!

Sounds like you don't want to create animations in 3DS MAX.
So you just want to import a static mesh???!! And create everything else in jme??!!
Then you can use .3ds, .obj, .dae...
As you would only like to import a model - All you get is a geometrical representation of the model within jme. It's just a simple modelmimport.

As i get it ;) you would like to create the bones and the skin information (weights-table) for the animation within jme.

For Boneanimaition you need a mesh (the model), a skin and some bones. The skin is the, weight-information for every Vertex and bone, describing how much a bone influences a vertex. So it "links" the mesh with the bones. These are normally set in a modelling tool.

But I don't know if it is possible / meaningfull to do this within jme.

We .. emp..  thought about importing a "rigged" model into jme, and than try to modify the bones manually/programmatically afterwards.  So the goal is, to be able to link the imported bones to a physical ragdoll.
Which makes it unnecessary to animate the modell in 3DS MAX, getting physical movement instead. But we haven't achieved this ... yet }:-@. MD5 seems to be the prob here, but we have to further digg in... (gell HellG ;) )..

Thanks .:emp…imm0|82:.

Your answer helped me a lot.

Last question.

How can I modify a Vertex of a 3ds Model or to make a small change, like deforming it?

>>model_skin = new SkinNode("test skin");

>>model_skin.setSkin(loadMesh(model_path)); ////!!!


Ummm… In your code, model_path was null I believe, remember, this is in the constructor, so it is run after loadMesh(). That may help…

That's not the case.

model_path is set in the constructor, when I call the class (from an other class).

That's working fine.