Very basic Blender scene not rendering texture/shading in JMonkey?

I’m having some incredibly basic issues with the JMonkey Engine and it’s becoming frustrating so please bear with me. (perhaps the HelloCollision tutorial should show you how to import scenes properly instead of cheating and using an entirely created world from a .zip file, or maybe just add a HelloScene tutorial)

So I used the HelloCollision tutorial and code and everything. My original goal was to try and replace the town and all of the .zip file contents with my own scene from Blender. I made a floor and 4 walls in blender and gave them a basic material and cloud texture so it would be something other than gray.

Following the instructions from:

When he got to the code part, I skipped this as I am already using the code from the Collision tutorial. I replaced the lines of code importing the .zip files:
[java]// We load the scene from the zip file and adjust its size.
assetManager.registerLocator(“town.zip”, ZipLocator.class);
sceneModel = assetManager.loadModel(“main.scene”);
sceneModel.setLocalScale(2f);[/java]

With the following lines:
[java]// We load the scene from Blender files.
sceneModel = assetManager.loadModel(“Scenes/MyScene/Scene.j3o”);
sceneModel.setLocalScale(20f);[/java]

When the scene loads, I am standing on the contents like I expected, but everything is solid white. Nothing has any texture, there is no shading or depth to anything it’s just a solid sheet of white anywhere that a part of the scene is visible, like a white silhouette.

I removed the lines of code that added light, and it had no affect on the scene. I’m thinking this has something to do with lighting issues? I can’t be certain and I have no way to test that theory, but I don’t know whats wrong. All I want to do is put a flat square with texture (that I MADE) in the world and walk on it and this is turning out to be an impossible task.

Might this be a texture issue or is this likely a lighting issue? If you need more info please let me know. I’m using the latest version of JME just downloaded a week ago.

I would like to add that I have the Scene.j3o file as well as the object.mesh.xml and object.material files in with the Scene.j3o

And Blender doesn’t seem to export the object names so even though I have “Floor” “NorthWall” “SouthWall” etc. in Blender it exports them all as “Plain.001.mesh.xml” and its associated with “Material.001.material”

When you say you replaces the texture with a cloud texture do you mean you used the blender cloud shader or did you create a cloud.jpg file and set it as the diffuse channel? Blenders internal shaders don’t translate to JME.

Well I was using the Blender default cloud. I changed it to a .jpg but that isn’t really helping.

Depending on when I export it (doing nothing differently that I’m aware of) half the times I get solid red objects, the other half I get un-rendered gray walls and only when I look toward the sky does the wall begin to show a resemblance to the texture. Although the texture is completely different from the way it was arranged in Blender.

Thanks for the tip though, I didn’t realize blender default textures didn’t work. Unfortunately, that hasn’t made this any more simple.

Try opening up the j3o in the scene composer and see what material is applied to the geometry. It also may be helpful to give a screenshot from what you are seeing.

The objects are red by default (not sure why) and the texture only loads on some of the surfaces, some of the time (ie when you’re directly facing the object). The only object in the entire scene that doesnt have the same texture is the sphere, and i expected it to be solid white, so thats not a big deal.

@leigero said: And Blender doesn't seem to export the object names so even though I have "Floor" "NorthWall" "SouthWall" etc. in Blender it exports them all as "Plain.001.mesh.xml" and its associated with "Material.001.material"

The Ogre3D exporter uses the mesh name, not the object name, this one …

If you share your blender file I will have a quick look at it for you.

@thetoucher said: The Ogre3D exporter uses the mesh name, not the object name, this one ...

Thanks for the tip. If your scene has more than say, 10 items, is there an easy way to rename the texture files to match the mesh files? Renaming them all manually and knowing what texture goes with what mesh is rather daunting.

I don’t think I have permission to attach files so I uploaded the .blend to my website, its the best I could do. If it helps maybe I can upload a .zip file of my entire JMonkey project?

www.leigero.com/images/Scene.blend

Looks like you don’t have any UV mapping on your models (setup in Blender).

I added a super basic UV mapping to your floor (Plane), by selecting it, pressing tab to go into Edit Mode, pressing A to select all vertices , pressing U to bring up the UV Mapping menu and selecting Unwrap. I then exported using the Ogre3D exporter, moved all the exported files to the assets/Scenes/MyScene folder, then in the SDK double clicked on the Scene.scene file to create the Scene.j3o… and when I ran the project, the floor now had a visible texture.

my export settings look like this:

I don’t know about renaming texture files, I didn’t need to rename anything to get this working.

You are a saint. I can’t believe UV mapping is the only thing causing all that trouble >.> Lesson learned.

@leigero said: You are a saint. I can't believe UV mapping is the only thing causing all that trouble >.> Lesson learned.

Moral of the story I guess is that without texture coordinates your meshes won’t know where the textures should be.