2
\$\begingroup\$

I am working on a project in jMonkey, and I managed to create boxes, spheres and such objects, and load textures form image files, but when I converted a Blender file to .j3o and imported it in my game, it shows up with no textures (it's just white).

The object does have textures, and they even show up in the jMonkey SDK. How do I load the textures that are already stored in the object file?

\$\endgroup\$
3
\$\begingroup\$

You should put all the images and other file in your Models/yourModel folder like this pic myModel.

I have a model named main and many images and other files and i put all those in my Models/main folder.

then write this code:

    public class Main extends SimpleApplication {

    public static void main(String[] args) {
        Main app = new Main();
        app.start();
    }

    @Override
    public void simpleInitApp() {

    Spatial model = assetManager.loadModel("Models/main/main.j3o"); 

    Light sun = new DirectionalLight();
    rootNode.addLight(sun);
    rootNode.attachChild(model);
    }

I think it will work.

\$\endgroup\$
  • \$\begingroup\$ I don't use the jMonkey SDK, I use Eclipse. Anyway, I downloaded a blender object from the web, and using the jMonkey sdk I converted it into j3o, and then I copied that file to my eclipse project, but I didn't find any extra texture files or such. \$\endgroup\$ – DLabinac Oct 3 '13 at 12:19
  • \$\begingroup\$ sorry i got same problem in jMonkey SDK also when i load a scene without any texture or other files. \$\endgroup\$ – Moshii Oct 5 '13 at 7:24
1
\$\begingroup\$

Try this:

1) In Blender - select the object's part to wrap with a texture and use the UV Mapping
2) Save the UV map file into the texture in the texture folder of the jme project.
3) Paste the texture on the pieces of the map file
4) In Blender - set the material and the texture as UV mapping.
5) Save the project as blender file (same folder)
6) Convert the blender file info j3o and import it on your scene.

In this video you can see how set the UV mapping, www.youtube.com/watch?v=obB9T3jXlak just remember that the mapping and the blender files must be saved in one of the project assets folders otherwise jme won't be able to see them.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.