Some problems with collada[FIXED]

Hello!



I made a model using DeleD and exported it using Collada Exporter plugin version 2.01.

I can't see nothing on my screen. Also I got that error:

5.06.2009 13:34:18 com.jme.util.resource.ResourceLocatorTool locateResource
WARNING: Unable to locate: system.bmp
5.06.2009 13:34:18 com.jmex.model.collada.ColladaImporter loadTexture
WARNING: Invalid or missing texture: "system.bmp"


The system.bmp is in the same folder with the plapla.dae model.

ColladaLoader.java:

package engine;

import java.io.InputStream;
import com.jme.scene.Node;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import com.jmex.model.collada.ColladaImporter;

public class ColladaLoader{
   public static Node GetModelFromLocation(String Location) {
      InputStream s;
      try {
         s  = new FileInputStream(Location);
      } catch (FileNotFoundException e) {
         throw new RuntimeException(e);
      }
      ColladaImporter.load(s,Location);
      Node model = ColladaImporter.getModel();
      return model;
   }
}



And initgame():

   protected void initGame() {
      scene = new Node("Scene graph node");
      
      Node Tile = ColladaLoader.GetModelFromLocation("tiles/plapla.dae");
        Tile.setLocalTranslation(new Vector3f(2,0,0));
        Tile.setModelBound(new BoundingBox());
        Tile.updateModelBound();

        scene.attachChild(Tile);
      BuildLight();
      scene.updateGeometricState(0.0f, true);
      scene.updateRenderState();
   }



How I fixed:
DeleD collada exporter plugin didn't export my model correctly.. So I exported it as an obj file and later with meshlab to collada.
Also I added that code to fix texturing:

        try {
         ResourceLocatorTool.addResourceLocator(
                 ResourceLocatorTool.TYPE_TEXTURE,
                 new SimpleResourceLocator(setup.class.getResource("/tiles/")));
      } catch (URISyntaxException e) {
         e.printStackTrace();
      }

Try to add a Resourcelocator to point to the directory where the textures are.


            ResourceLocatorTool.addResourceLocator(
                    ResourceLocatorTool.TYPE_TEXTURE,
                    new SimpleResourceLocator(TestMs3dAnt.class.getResource("/tiles/")));

I've added that:

        try {
         ResourceLocatorTool.addResourceLocator(
                 ResourceLocatorTool.TYPE_TEXTURE,
                 new SimpleResourceLocator(setup.class.getResource("/tiles/")));
      } catch (URISyntaxException e) {
         e.printStackTrace();
      }


Now I don't get that texture not found error anymore..
But I still can't see nothing. Maybe there is something wrong with my collada exporter?
MachineHead said:

But I still can't see nothing.


I'm confused  :wink:

no seriously, try:


model.setLightCombineMode(LightCombineMode.Off);



you might not see nothing because the light doesn't light anything  ;) if you see the model then, you have to tweak your light.

I downloaded two random .dae model files from Google-s 3d warehouse. I can see them both…

But why can't I see those DeleD exported models? Maybe there is something wrong with the exporter?

From what I understand, the JME's collada importer doesen't support all the collada features and what I have read from the forums nobody has gotten their collada models/animatons to JME scene besides the person who created the collada test class.



I reccommend using ogrexml or md5. But they also have some gotchas with exporting that you need to know first.

i’d work with the SceneMonitor to see what exactly has been imported into jme.

Hmm… Still I see some bugs with collada… Some textures are still missing… I think I'll move to .jme…

MachineHead said:

I think I'll move to .jme...


Well, you will have to do that anyway to speed up loading. but to get a .jme model you have to import a model in another format first (e.g. md5, ...) and then export it as a .jme model. take a look at ModelLoader.