The model looks ok, but it seems so that only one of the textures is loaded and attached all over the model. I've already read all related topics in this forum, but they are all something different and no hint works.
Edit your post to have the code tag around it "[ code ]" without the spaces. It's hard to read code like you have it, and it spreads out your post very far.
I guess that this has nothing to do with the slashes in the path string. I tried all possible combinations and no one worked.
I debugged through the ColladaImporter an it finds all of the texture files and handle them properly (i think). But there is still only one texture displayed on the model.
I also made a simple cube model and applied simple colors to the surface. SketchUp defines them in the dae-file. But jME renders a white cube…?!
IMO Trying to import Collada is a waste of time. From my talk with Josh, the importer in jME supports a certain "flavor" of the collada format which is only made correctly from the NCSoft exporter, all other exporters are pretty much out in the cold. Just wait till the official release of the mesh.xml importer and use that instead as it is much, much more reliable.
I dunno… I'm doing a little side project with jME 2.0 and needed some models. I went to google's sketchup 3d warehouse and pulled down some files (make sure they are collada) and loaded them in with no issues, (including textures.)
Obviously that doesn't mean all sketchup collada files will load, but the ones I tried did. This one is one of those I tried:
To do it, first I set up a texture locator… (Note that I decided to have things in a data folder in my working directory, but you can set it up other ways too of course.)
try {
SimpleResourceLocator loc = new SimpleResourceLocator(
new File("./data/textures/").toURI());
ResourceLocatorTool.addResourceLocator(
ResourceLocatorTool.TYPE_TEXTURE, loc);
} catch (Exception e) {
e.printStackTrace();
}
Then I loaded in the model like so:
ExtraPluginManager.registerExtraPlugin("GOOGLEEARTH", new GoogleEarthPlugin());
try {
ColladaImporter.load(
new FileInputStream(new File("./data/models/nyt.dae")), "building");
} catch (FileNotFoundException e) {
e.printStackTrace();
}
Spatial building = ColladaImporter.getModel();
building.setModelBound(new BoundingBox());
building.updateModelBound();
The first line registers a plugin to handle the GOOGLECODE tags (some extra info in google collada files that deals with culling.) The rest is all pretty straightforward I would guess. In later code (not shown) I then go on to scale it and center it and a few other things. Since I'm using SimpleGame and this is done during init, I then attach it to my rootNode and it is automatically updated (render states, geometric state, etc.)
I think this was already talked about in some threads, but it happens to often. Did You looked in the DAE File for "blinn", this you should replace with "phong". In the exporter it should be also possible to change this.
a question: The ColladaImporter works ok, as long as I don't use skinning. This Importer is only written for the NCSOft exporter, fine, I can live with that. But why does this importer does't warn me, that it doesn't support my used format? :x
One thing I'd also mention is that just like when exporting skinned models to other formats, I recall our artists at NCsoft had to make sure they did a few things before exporting. Unfortunately I do not know the exact steps, but it was your typical stuff like having a single root bone, baking matrices, etc.
Your code works! But only after I switched to jMonkey 2.0. Until now I worked with 1.0 and it seems, that the old ColladaImporter really can't handle the SketchUp Textures.