Texture of my model isn't shown

Hello everyone,



I’m new here and I’m not sure if this is the right forum to ask my question so please move my post if neccessary. :smiley:



I created a box in Blender and I put a UV-Texture on it. It is just a simple wooden texture. After that I used the ogre mesh exporter to export my model in a ogre mesh file. Everything worked fine and the texture got copied. After I tried to load my model in jMonkeyEngine I just see a dark grey cube. Now I would like to know why.



Here is my jMonkeyEngine code:

package de.rene.jme3.hellomodel;



import com.jme3.app.SimpleApplication;

import com.jme3.light.DirectionalLight;

import com.jme3.math.Vector3f;

import com.jme3.scene.Spatial;



/**

*

  • @author rene

    */

    public class HelloModel extends SimpleApplication {



    /

    *

    */

    public static void main(String[] args) {

    new HelloModel().start();

    }



    /


    *

    */

    @Override

    public void simpleInitApp() {

    // Ein Licht hinzufΓΌgen

    DirectionalLight sun = new DirectionalLight();

    sun.setDirection(new Vector3f(-0.1f, -0.7f, -1.0f));

    rootNode.addLight(sun);



    // Das Model laden

    Spatial sceneModel = assetManager.loadModel(β€œModels/Cube/Cube.mesh.j3o”);

    rootNode.attachChild(sceneModel);

    }



    }




    Where is the problem? Thanks in advance.

It could be several things but with your code theres nothing wrong. If the texture isnt displayed in the first place its also not referenced properly in the j3o file. Does the ogre material file have the same name as the mesh or scene file? Did you really apply the texture in blender in a way so that it can be exported? Procedural textures cannot be exported for example, see the help of the ogre exporter for more info.

Cheers,

Normen

I am having the same problem. I exported to β€œModels/ogre/” under jme3. Here are the files: (please note I have replaced the greater than/lessthan brackets with {} for the code to show)



boxFigure.scene:





{scene formatVersion=β€œ1.0.0”}

{nodes}

{node name=β€œmyEmpty”}//an empty locator with the main mesh

{position x=β€œ0.020647” y=β€œ0.024404” z=β€œ0.029551”/}

{quaternion x=β€œ0.000000” y=β€œ0.000000” z="-0.000000" w=β€œ1.000000”/}

{scale x=β€œ1.000000” y=β€œ1.000000” z=β€œ1.000000”/}

{userData}

{property type=β€œSTRING” name=β€œmyEmpty” data=β€œFred”/}

{/userData}

{/node}

{node name=β€œCube”}//the main mesh

{position x=β€œ0.000000” y=β€œ1.056420” z="-0.000000"/}

{quaternion x=β€œ0.496272” y="-0.503722" z=β€œ0.498224” w=β€œ0.501748”/}

{scale x=β€œ1.000000” y=β€œ1.000000” z=β€œ1.000000”/}

{entity name=β€œCube” meshFile=β€œCube.mesh”/}

{/node}

{/nodes}

{externals}

{item type=β€œmaterial”}

{file name=β€œScene.material”/}

{/item}

{/externals}

{environment}

{colourAmbient r=β€œ0.000000” g=β€œ0.000000” b=β€œ0.000000”/}

{colourBackground r=β€œ0.056563” g=β€œ0.220815” b=β€œ0.400000”/}

{/environment}

{/scene}









Scene.material:

material Models/ogre/boxFigure.jpg

{

technique

{

pass

{

diffuse 0.800000 0.800000 0.800000

specular 1.000000 1.000000 1.000000 8.250000

texture_unit

{

texture boxFigure.jpg

}

}

}

}




and Cube.mesh.xml:

{mesh}

{submeshes}

{submesh material=β€œboxFigure/SOLID/TEX/boxFigure.jpg” usesharedvertices=β€œfalse”}

{faces count=β€œ36”}

{face v1=β€œ0” v2=β€œ1” v3=β€œ2”/}

{face v1=β€œ0” v2=β€œ2” v3=β€œ3”/}

{face v1=β€œ4” v2=β€œ5” v3=β€œ7”/}

{face v1=β€œ5” v2=β€œ6” v3=β€œ7”/}

{face v1=β€œ8” v2=β€œ9” v3=β€œ11”/}

{face v1=β€œ9” v2=β€œ10” v3=β€œ11”/}

{face v1=β€œ12” v2=β€œ13” v3=β€œ15”/}

{face v1=β€œ13” v2=β€œ14” v3=β€œ15”/}

{face v1=β€œ16” v2=β€œ17” v3=β€œ18”/}

{face v1=β€œ16” v2=β€œ18” v3=β€œ19”/}

{face v1=β€œ20” v2=β€œ21” v3=β€œ22”/}

{face v1=β€œ20” v2=β€œ22” v3=β€œ23”/}

{face v1=β€œ24” v2=β€œ25” v3=β€œ27”/}

{face v1=β€œ25” v2=β€œ26” v3=β€œ27”/}

{face v1=β€œ28” v2=β€œ29” v3=β€œ30”/}

{face v1=β€œ28” v2=β€œ30” v3=β€œ31”/}

{face v1=β€œ32” v2=β€œ33” v3=β€œ35”/}

{face v1=β€œ33” v2=β€œ34” v3=β€œ35”/}

{face v1=β€œ36” v2=β€œ37” v3=β€œ39”/}

{face v1=β€œ37” v2=β€œ38” v3=β€œ39”/}

{face v1=β€œ40” v2=β€œ41” v3=β€œ42”/}

{face v1=β€œ40” v2=β€œ42” v3=β€œ43”/}

{face v1=β€œ44” v2=β€œ45” v3=β€œ46”/}

{face v1=β€œ44” v2=β€œ46” v3=β€œ47”/}

{face v1=β€œ48” v2=β€œ49” v3=β€œ50”/}

{face v1=β€œ48” v2=β€œ50” v3=β€œ51”/}

{face v1=β€œ52” v2=β€œ53” v3=β€œ55”/}

{face v1=β€œ53” v2=β€œ54” v3=β€œ55”/}

{face v1=β€œ56” v2=β€œ57” v3=β€œ58”/}

{face v1=β€œ56” v2=β€œ58” v3=β€œ59”/}

{face v1=β€œ60” v2=β€œ61” v3=β€œ62”/}

{face v1=β€œ60” v2=β€œ62” v3=β€œ63”/}

{face v1=β€œ64” v2=β€œ65” v3=β€œ66”/}

{face v1=β€œ64” v2=β€œ66” v3=β€œ67”/}

{face v1=β€œ68” v2=β€œ69” v3=β€œ71”/}

{face v1=β€œ69” v2=β€œ70” v3=β€œ71”/}

{/faces}

{geometry vertexcount=β€œ72”}

{vertexbuffer positions=β€œtrue” normals=β€œtrue” texture_coords=β€œ1”}

{vertex}

{position x=β€œ1.000000” y="-1.000000" z="-1.000000"/}

{normal x=β€œ0.000000” y="-1.000000" z=β€œ0.000000”/}

{texcoord u=β€œ0.220934” v=β€œ0.415486”/}

{/vertex}

{vertex}

{position x=β€œ1.000000” y="-1.000000" z=β€œ1.000000”/}

{normal x=β€œ0.000000” y="-1.000000" z=β€œ0.000000”/}

{texcoord u=β€œ0.252677” v=β€œ0.200691”/}

{/vertex}

{vertex}

{position x="-1.000000" y="-1.000000" z=β€œ1.000000”/}

{normal x=β€œ0.000000” y="-1.000000" z=β€œ0.000000”/}

{texcoord u=β€œ0.031742” v=β€œ0.170456”/}

{/vertex}

{vertex}

{position x="-1.000000" y="-1.000000" z="-1.000000"/}

{normal x=β€œ0.000000” y="-1.000000" z=β€œ0.000000”/}

{texcoord u=β€œ0.000000” v=β€œ0.385251”/}

{/vertex}

{vertex}

etc



I have no idea why the exporter decides to reference boxFigure.jpg as boxFigure/SOLID/TEX/boxFigure.jpg, but I have tried fixing the path from Models to no avail. I have no problem converting boxFigure.scene to a j3o, but when I open it using code like the above I get a red figure with no textures. Please help this is driving me nuts.

i think the scene.material needs to be renamed boxFigure.material, or something like that



look into the log when you convert the file to j3o, it should throw a warning about it.

Thankyou nehon… I renamed all the files boxFigure.etc and is now working as it ought. Pretty obscure fix… no wonder there has been so much swearing about my workspace.

Ohh ok. In my scene file there was another material file referenced. Now it is working. Thanks. :smiley: