I’m not using the SDK because I’m using eclipse for my work and I’m getting really confused switching between two different IDEs. Wanted to make this clear upfront
I created a really simple model in blender with one UV mapped image texture, and now I’m trying to import this into my jme3 game. I search this forum and googled and didn’t really find out how I can get the texture onto my model. I read through the documentation on how to create proper models in blender, how to use the BlenderModelLoader and so on, but in the end I’m kinda confused. How is the texture/material supposed to get onto the model in the game?
I also exported the model in blender to .obj, but in the resulting obj or mtl files there was no reference to the texture file, and there doesn’t seem to be an option in the obj blender exporter to do this. I also put the image file in the exact same folder as the blend file or the resulting obj file.
Any suggestions (besides using the SDK…)?
You can use the SDK to import the model and pre-view it and save it to a j3o-file and then use that in your code. You don’t have to code in the SDK if you find it confusing.
I could check the loading. I managed to load models with textures without problems so either your model has something wrong or you found a bug in the importer that will need to be fixed
The sdk uses only the code present in jme to load the blend files. and export them, no magic there
final Spatial model = this.assetManager.loadModel(toCompile);
final BinaryExporter exp = new BinaryExporter();
final File outName = new File(“wurst.j3o”);
exp.save(model, new FileOutputStream(outName));
And sorry for my late response but I was unable to download the file during the weekend.
Looks like this file host service is only IE dependent and I do not have that browser at home
<cite>@normen said:</cite>
Paths, its all about paths. Thats why the SDK handles the project structure like it does:
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:intermediate:multi-media_asset_pipeline#create_textures_and_materials
https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:external:blender
The whole path thing didn’t do anything for me. After moving all assets into their respective folders the problem still occurs.
So it must be the way the model is made, right? But what should I do differently?
I was talking about nodes in blender.
The material nodes. You had them turned on and the material definition was stored inside the nodes editor in blender.
If you turn it off and define the material and textures in the ‘old way’ you will probably see the textures.
Another thing that you can do is to store the texture in the blend file. This way you can avoid path problems.
The node button is the 4’th button on the right of the material’s name field in the material tab.
Turn it off and then define your material and textures in the traditional way