Problems with dae model

I have this Maya model:





But when im imorting it with this little application:


import com.jme.app.AbstractGame.ConfigShowMode;
import com.jme.app.SimpleGame;
import com.jme.bounding.BoundingBox;
import com.jme.math.Vector3f;
import com.jme.scene.Node;
import com.jmex.model.collada.ColladaImporter;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;


public  class Model extends SimpleGame  {

    protected void simpleInitGame() {
        playerModel();
        playerModel().setModelBound(new BoundingBox());
        playerModel().updateModelBound();
        playerModel().setLocalTranslation(new Vector3f(2,0,0));
        rootNode.attachChild(playerModel());

        rootNode.updateRenderState();

    }
   
    public static Node playerModel() { 

        InputStream source;

      try {
         source  = new FileInputStream("data/model/lort.dae");
      } catch (FileNotFoundException e) {
         throw new RuntimeException(e);
      }

      ColladaImporter.load(source,"data/model/lort.dae");

      return ColladaImporter.getModel();
   
         }
   
    public static void main(String[] args) throws Exception {

        Model app = new Model();
        // We will load our own "fantastic" Flag Rush logo. Yes, I'm an artist.
        app.setConfigShowMode(ConfigShowMode.AlwaysShow, Model.class.getClassLoader().getResource("Test"));
       
        app.start();
}
}



I get this :



Thank you..

Press 'L' to turn lighting on when running.

Ehm, when i turned the light on my model just became white…


I have another problem.







As you can se there is shadow on the sphere, but why isnt there shadows on the box? If i try makin a box like normal (without importing it) there is shadows on it.



Anyone have the same problem?



Thank you

Looks like you need to set a smooth ShadeState is all…

paxkalle@gmail.com said:

I get this :



Thank you..


Looks like vertex coloring, but kinda messed up. Lighting doesn't use vertex colors and that is why it turns white on you when you turn on the light. You can try setting the color of your object by finding the geometry object and using setDefaultColor(<color>) to rectify your black/brown coloring mixup.

But before you go and do that there are a couple other things I think you should fix up first, that are probably causing your problems.


protected void simpleInitGame() {

// Loads model, but doesn't save the reference
        playerModel();
// Loads another model, sets a bounding volume
        playerModel().setModelBound(new BoundingBox());
// Loads another model...
        playerModel().updateModelBound();
// loads...
        playerModel().setLocalTranslation(new Vector3f(2,0,0));
// Load another model and attaches it to the root node
        rootNode.attachChild(playerModel());

        rootNode.updateRenderState();
}


You have written a method playerModel() which whenever called, will load your collada model and return a reference to its parent node. In your initialization, you are repeatedly calling this method, but never keeping the reference to your loaded model.

I suggest this instead...


protected void simpleInitGame() {

        Node player = playerModel();
        player.setModelBound(new BoundingBox());
        player.updateModelBound();
        player.setLocalTranslation(new Vector3f(2,0,0));

        rootNode.attachChild(player);

        rootNode.updateRenderState();
}