Importing a model from Google SketchUp

Although i know there are better 3d graphic tools, I created a house for my game in SketchUp pro (which can export the model in .obj). The problem is that textures associated with the .obj file don’t show, it only shows the “white walls”.



This is the simple code:





package Game1;



import com.jme3.app.SimpleApplication;

import com.jme3.font.BitmapText;

import com.jme3.light.DirectionalLight;

import com.jme3.material.Material;

import com.jme3.math.Vector3f;

import com.jme3.scene.Geometry;

import com.jme3.scene.Spatial;



public class Main extends SimpleApplication {



public static void main(String[] args) {



Main app = new Main();

app.start();



}



@Override

public void simpleInitApp() {



Spatial house1 = assetManager.loadModel(“Models/house1.obj”);

house1.scale(5f, 5f, 5f);

rootNode.attachChild(house1);



DirectionalLight sun1 = new DirectionalLight();

sun1.setDirection(new Vector3f(-0.3f, -0.7f, -1.0f));

rootNode.addLight(sun1);



}

}





But isn’t there a tool for importing COLLADA models? (SketchUp can export them as well.) How do I use it?

you need the mtl file in the same directory. Google sketchup is not ideal for models, Anyone here would recommend blender

@javagame said:
you need the mtl file in the same directory. Google sketchup is not ideal for models, Anyone here would recommend blender


I have of course done that. In my assets/Models folder, I have two files (house1.obj, house1.mtl) and a house1 folder with jpg pictures.
And I know that Blender would be better, but for me it looks just too complicated.

I have seen people using this:
ExtraPluginManager.registerExtraPlugin("GOOGLEEARTH", new GoogleEarthPlugin());
, it should import the .dae (COLLADA) file to my game, but I don’t have any ideas where to get the library/package and how to connect it to my project file.

Or do you know about any tutorial on this topic? I have looked on forums, but did not find any helpful posts.

there is no working collada importer for jme3

So is there any working way to import textured models from SketchUp? I dont want to start learning Blender…

@guseppe said:
So is there any working way to import textured models from SketchUp? I dont want to start learning Blender...


If you write the importer yourself then yes, otherwise, no.

Sure, .obj works fine and people also managed to import those from sketchup. So you do something wrong. Thing is you have to understand what you want to do. Do you know all textures are mapped to the right slots and that your uv map is in place? If you feel like asking me “whats that?” then you don’t have sufficient knowledge to import models yet. Go with boxes as placeholders.

Well, I can see the model in the game window, but it is not textured. I have checked that the files in .obj are associated with the right files. But are you saying I have to manually assign the position and everything of textures? If yes, I well really begin with something easier…

the mesh needs a UV buffer so the texture needs to be uv-mapped yeah

Any tutorials on that? (maybe for future)

Theres lots of information about what UV map means, how the buffers are structured etc. But making a UV map in an editor is editor-specific, there might be easy ways to make a uv mapped texture from whatever wrapping type you used for your model though. So maybe you just have to presst Ctrl-Alt-U or something and then it works… Thats why I say you need to understand what you want the model export tool to do and what you want to import.

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:intermediate:multi-media_asset_pipeline

Ok, thanks