Collada importing and textures

Hi again… when I exported the file that my classmate sent to me using sketchup… it ended up as a dae but also had a separate folder for textures… I tried to follow the same code as in the jmetest.renderer.loader.TestMd3WriteLoading.java regarding Textures… but I ended up coloring the whole model with the texture instead of only the portion where it was colored previously… how do I do this?



p.s. the files are attached herewith…thanks in advance for any help… :smiley:

hmmm… thanks for the quick reply sbook… but I think that's a little too out of my league… I've no problem exporting the models… actually what I meant was it renders in the scene with the colors but not with the textures that Sketch-up's Collada exporter generated in a separate folder… here's my code and a couple of screenshots…



package trials;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;

import javax.swing.JFileChooser;

import com.jme.app.SimpleGame;
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.Spatial;
import com.jme.scene.state.MaterialState;
import com.jme.scene.state.TextureState;
import com.jme.system.DisplaySystem;
import com.jme.util.TextureManager;
import com.jme.util.export.xml.XMLExporter;
import com.jme.util.export.xml.XMLImporter;
import com.jmex.model.ModelFormatException;
import com.jmex.model.collada.ColladaImporter;
import com.jmex.model.ogrexml.Material;
import com.jmex.model.ogrexml.MaterialLoader;
import com.jmex.model.ogrexml.OgreLoader;
import com.jmex.model.ogrexml.SceneLoader;
import com.jmex.model.util.ModelLoader;
import com.mysql.jdbc.Blob;
import com.mysql.jdbc.Connection;
import com.mysql.jdbc.Statement;


public class loadTrial extends SimpleGame{
   
   public void simpleInitGame(){
      try {
      File fileToLoad = new File("C:\Users\Tavas\Desktop\class room.dae");
      URI uri = fileToLoad.toURI();
      URL modelURL = uri.toURL();
      
      InputStream source = modelURL.openStream();
      ColladaImporter.load(source, "loadedModel");
      Spatial spatial = ColladaImporter.getModel();
      
      rootNode.attachChild(spatial);
      rootNode.getChild("loadedModel").setLocalRotation(new Quaternion().fromAngleAxis(-90 * FastMath.DEG_TO_RAD, Vector3f.UNIT_X));
      rootNode.updateRenderState();
      } catch (IOException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }
   }
   public static void main(String args[]){
      new loadTrial().start();
   }
}



Here's the screen shot in sketch-up...


Here's what JME renders in my scene

I took a look at the file and there's something extremely strange about that mesh.  Importing it into Maya resulted in a blank model.  The asset manager picked up the texture though, so I tried to apply it to the model… Only the floor and podium would accept the texture, everything else seemed to be stuck at their default color :frowning:

well I think that would be the correct appearance of the model… since only the floor and the podium had been colored by textures that aren't in the default color picker of  sketch-up… how do I import it to JME then? Do I have to import it to Maya and then export it again using Maya's exporter?.. I have no Maya software… I only have here is 3DSMAX, SketchUp and Blender