Terrain texture not showing, black

Hi,



I am a computer science student and I recently stumbled on jME and have been working with it for the past few days. The tutorials and forum here are great and I have been able to resolve most of my issues by reading although I ran into an issue with a modified example from one of the tutorials.



I have created a terrain model in 3DS Max using my own height map. I used blended materials to create a texture for terrain and then exported it as .OBJ and .MTL from 3DS Max.



Here is a pic







As you can see it is a fairly crappy example of an island but it should show using the test code from HelloModelLoading. I have loaded other models I exported to .OBJ from 3DS Max and I am able to see the model plus textures. . When I load this terrain it does load the geometry but it is completely black. The only way I am able to detect it is even there is by hitting ‘B’ to show the bounding regions.



So again it is loading but completely black. I dont know enough about graphics to start troubleshooting the creation of my model or something that I am missing with jME. Any help would be appreciated such as pointing me to some reading material, etc.



Thanks,

Chris

are you calling update render state after the model has loaded?

Yes, I have tried calling updateRenderState() on the node I create for the Spatial and on rootNode. Its odd since I can load other models with textures from an .OBJ file and am able to see them. The difference here is that Island model is just one plane whereas the other models I have loaded successfully are complex models with multiple subdivisions (I guess thats what you call them).



Here is the code, very short and simple.



protected void simpleInitGame()
{
        //////////////////////////////////
   // Load Island
      
   // Point to a URL of my model
        URL model = HelloModelLoading.class.getClassLoader().getResource("jmetest/data/model/SandyIsland.obj");
       
        FormatConverter converter = new ObjToJme();
       
        converter.setProperty("mtllib", model);
       
        ByteArrayOutputStream BO = new ByteArrayOutputStream();
       
        try
        {
           Node islandNode = new Node();
           
           converter.convert(model.openStream(), BO);
           islandNode.attachChild((Spatial)BinaryImporter.getInstance().load(new ByteArrayInputStream(BO.toByteArray())));
 
           islandNode.setLocalTranslation(50, -3, 20);
           
           islandNode.setModelBound(new BoundingSphere());
           islandNode.updateModelBound();

            islandNode.updateRenderState();
 
            rootNode.attachChild(islandNode);
           
        } catch (IOException e)
        {   // Just in case anything happens
 
            System.out.println("Damn exceptions!" + e);
            e.printStackTrace();
            System.exit(0);
        }
      
      //////////////////////////////////
    }    



Thanks for your help.
Chris

But you are really sure it is there? Maybe place something not black behind or inside the black model. Might be possible that there is a bounding-box although the model is not loaded properly… Maybe you can provide a link to your model so we could have a look?

Appreciate the reply.



I went ahead and adapted the TestQuadWater example to provide a clear picture that the model geometry is indeed loading but not the texture.







I call this work of art, “Mystery Island” heh. I am able to open the .OBJ file in 3DS Max with the texture showing.



I have uploaded the files so you may have a look if its necessary.



SandyIsland.obj (652 KB)

SandyIsland.mtl (491 B)



Thanks for all the help.

Chris

looking good  :slight_smile:

there seems to be nothing wrong with the mesh that is imported from the obj file…

the normals are correct, texture coordinates are present…

i was able to render this with lighting and texture…

i didn't check the mtl file with the obj import but maybe you could import the obj and then attach the texture state to it after?

Are you use ResourceLocatorTool?


ResourceLocatorTool.addResourceLocator(ResourceLocatorTool.TYPE_TEXTURE, new SimpleResourceLocator(new File("data/").toURI()));

Hi,



Thanks again to everyone that helped me figure this out. I eventually realized that the models I was using before this island were ones with textures in jpeg format and by default 3DS Max spits out .TGA files. I exported the texture again from 3DS Max but in .JPG format and changed the .MTL file to get it to work! So I dont think jME supports .TGA texture files?







The island complete with battleship!



Thanks for all your help.

Chris

how do you create that water effect?



is there any tutorial teaching how to create water?

Hi Aqua Costa,



in the source code there are several example. Have a look in your source code in the

package:



jmetest.effects.water

nice job  :wink:

ttrocha said:

Hi Aqua Costa,

in the source code there are several example. Have a look in your source code in the
package:

jmetest.effects.water



Thanks a lot