Newbie troubles - missing textures, failing lights

Hello everyone!

I’m just getting started with this engine; I’m running the latest JME3 from a few days ago.

I’ve gone through the tutorials without trouble, but now that I am doing my own test project I am running into all kinds of trouble. Hopefully these can be cleared up easily by someone more knowledgeable :slight_smile:

Anyway, I have a few serious problems at the moment:

  1. Models I have made in Blender and exported to Ogre XML format show up, but their textures do not. Even after adding a UV Map (at first I didn’t realize Ogre needed that), the textures just don’t show up when running my game. The files are exported and available.
  2. For some reason, I have constant light on my floor model but nowhere else. The lights that I have actually added are apparently ignored. I added a tochlight (PointLight that follows me) as well as a sun (DirectionalLight) - but neither show up. Even removing both, I expected to see pure darkness - but it’s still the same.
  3. The texture I applied to my floor is stretched instead of tiled. Is there an easy way to tile it so it doesn’t look all weird and blurry?

    Does anyone have ideas on what I am doing wrong?
  1. The mesh.xml or scene file you import has to have the same name as the material file that is exported with the meshes.
  2. You probably attached the light to your spatial because you want to move it with your spatial. That does not work, you have to attach the light to the topmost node as it will only affect Spatials that are subnodes of that node.
  3. Texture2D.setWrap(WrapMode.Repeat);



Thanks for your quick reply!

Unfortunately, that does not solve any of my problems…

  1. The files are named UVTest.mesh.xml and UVTest.material. I found out the naming clash thing the first time I tried to convert it to a JME binary and have been making sure they are named the same ever since.
  2. I attach both lights to the rootNode using rootNode.addLight(). I just update the position of the “torch” in simpleUpdate.
  3. I am already calling myTexture.setWrap(WrapMode.Repeat) but it has no effect.

    The plot thickens! Why doesn’t any of this work?

As an update, I see that my lights are working when I move close to my untextured model - but they are both completely overshadowed by the existing bright light of unknown origin.

Is it because I am using SimpleTextured.j3md for the floor? If so, what else should I be using?

In case it helps, here is the entire source code for the class:


package ix.gamepoc;


import com.jme3.asset.TextureKey;

import com.jme3.bullet.collision.shapes.BoxCollisionShape;

import com.jme3.bullet.collision.shapes.CapsuleCollisionShape;

import com.jme3.bullet.collision.shapes.CompoundCollisionShape;

import com.jme3.bullet.nodes.PhysicsCharacterNode;

import com.jme3.bullet.nodes.PhysicsNode;

import com.jme3.bullet.util.CollisionShapeFactory;

import com.jme3.input.KeyInput;

import com.jme3.input.controls.ActionListener;

import com.jme3.input.controls.KeyTrigger;

import com.jme3.light.DirectionalLight;

import com.jme3.light.PointLight;

import com.jme3.material.Material;

import com.jme3.math.ColorRGBA;

import com.jme3.math.Vector3f;

import com.jme3.renderer.RenderManager;

import com.jme3.scene.Geometry;

import com.jme3.scene.Node;

import com.jme3.scene.Spatial;

import com.jme3.scene.shape.Box;

import com.jme3.system.AppSettings;

import com.jme3.texture.Texture;

import com.jme3.texture.Texture.WrapMode;

public class Main extends SimpleBulletApplication implements ActionListener {

public static void main(String[] args) {

Main app = new Main();

// TODO: Allow customization

app.showSettings = false;

app.settings = new AppSettings(true);

app.settings.setResolution(1280, 720);




private PhysicsCharacterNode player;

private Vector3f walkDirection = new Vector3f();

private boolean left = false, right = false, up = false, down = false;

private PointLight torchLight;

public void simpleInitApp() {







private void initLights() {

DirectionalLight sun = new DirectionalLight();



torchLight = new PointLight();





private Material loadSimpleTexturedMaterial(String path) {

Material result = new Material(assetManager, “Common/MatDefs/Misc/SimpleTextured.j3md”);

TextureKey textureKey = new TextureKey(path);


Texture texture = assetManager.loadTexture(textureKey);


result.setTexture(“m_ColorMap”, texture);

return result;


private void initFloor() {

Material material = loadSimpleTexturedMaterial(“Textures/BrickWall.jpg”);

Vector3f size = new Vector3f(500f, 2.5f, 500f);

Box floorBox = new Box(Vector3f.ZERO, size.getX(), size.getY(), size.getZ());

Geometry floor = new Geometry(“floor”, floorBox);


PhysicsNode floorNode = new PhysicsNode(floor, new BoxCollisionShape(size), 0);

floorNode.setLocalTranslation(0, -2.5f, 0);




private void initModels() {

Spatial globe = assetManager.loadModel("/Models/UVTest.mesh.xml");

globe.setLocalTranslation(0, 5, -50);

CompoundCollisionShape sceneShape = CollisionShapeFactory.createMeshCompoundShape((Node) globe);

PhysicsNode landscape = new PhysicsNode(globe, sceneShape, 0);




private void initPlayer() {

player = new PhysicsCharacterNode(new CapsuleCollisionShape(1.5f, 6f, 1), .05f);




player.setLocalTranslation(new Vector3f(10, 10, 10));





private void initKeys() {

inputManager.addMapping(“Lefts”, new KeyTrigger(KeyInput.KEY_A));

inputManager.addMapping(“Rights”, new KeyTrigger(KeyInput.KEY_D));

inputManager.addMapping(“Ups”, new KeyTrigger(KeyInput.KEY_W));

inputManager.addMapping(“Downs”, new KeyTrigger(KeyInput.KEY_S));

inputManager.addMapping(“Jumps”, new KeyTrigger(KeyInput.KEY_SPACE));

inputManager.addListener(this, “Lefts”);

inputManager.addListener(this, “Rights”);

inputManager.addListener(this, “Ups”);

inputManager.addListener(this, “Downs”);

inputManager.addListener(this, “Jumps”);


public void onAction(String binding, boolean value, float tpf) {

if (binding.equals(“Lefts”)) {

left = value;

} else if (binding.equals(“Rights”)) {

right = value;

} else if (binding.equals(“Ups”)) {

up = value;

} else if (binding.equals(“Downs”)) {

down = value;

} else if (binding.equals(“Jumps”)) {





public void simpleUpdate(float tpf) {

Vector3f camDir = cam.getDirection().clone().multLocal(0.6f);

Vector3f camLeft = cam.getLeft().clone().multLocal(0.4f);

walkDirection.set(0, 0, 0);

if (left) {



if (right) {



if (up) {



if (down) {








public void simpleRender(RenderManager rm) {

//TODO: add render code





I’ve managed to get the texture to show up for my globe. The problem was with the Ogre Exporter from Blend. Nothing wrong with the most important file (*.mesh.xml) but the material file contained a couple of lines that prevented the texture from showing up.

I removed the following lines from my UVTest.material file:

(under texture_unit:)

colour_op modulate

(under second pass:)

ambient 0.0 0.0 0.0

diffuse 0.0 0.0 0.0

Why these lines were added beats the heck out of me, but fixing or creating the material file is easy enough so I’m not going to worry about it.

I am left with the problem of tiling and excessive lighting of the texture on the floor.

Any ideas?

To illustrate the problem, here is what I am seeing in game:

That floor is supposed to be dark outside of my torch range and tiled. The source image is the brick wall from the HelloMaterial tutorial. Doesn’t look like bricks right now :slight_smile:

you should use the lighting.j3md material definition, it supports…well… lightings :stuck_out_tongue:

attach the textures with the m_DiffuseMap parameter or the material like that

result.setTexture(“m_DiffuseMap”, texture);

I recommend making your own material instead of using the .material file

be aware that with 2 lights there will be 2 render pass (see TestManyLights for more informations)

This is kinda strange, where did you get the ogreXML exporter for blender from? Did you install the one that comes with jMP? Are you sure you are only using compatible material settings (see ogrexml exporter help-button)?



nehon said:
you should use the lighting.j3md material definition, it supports...well.. lightings :p
attach the textures with the m_DiffuseMap parameter or the material like that
result.setTexture("m_DiffuseMap", texture);

I actually tried that already, and that just made the floor bright white. Does it only work if you also create a "normal" map? (I'll have to learn how to do that, but I can try that next)

nehon said:
be aware that with 2 lights there will be 2 render pass (see TestManyLights for more informations)

What does that mean in layman's terms? It will be a bit slower?
Anyway, I don't actually intend to keep the second one - I just want the torch light (once I get that working).
normen said:
This is kinda strange, where did you get the ogreXML exporter for blender from? Did you install the one that comes with jMP? Are you sure you are only using compatible material settings (see ogrexml exporter help-button)?


I am not sure if I am using compatible settings or not (there's so many!). Right now I'm just following the "Noob to Pro" book, going through all of the exercises.

Where did I get the Ogre Exporter? I don't actually remember. It was probably either through a direct link in one of the JME tutorials, or I just went to the Blender site and got the latest. Yesterday I tried one that was linked in an older JME 2 tutorial, but there was no difference in behavior.

Anyway, thank you both for answering!
My search continues...

I still haven’t gotten the textures to repeat.

Does anyone have a working example of a texture repeating over a larger surface (like a tiled floor)?


Thanks, but as I mentioned before I am already setting that - and it doesn’t make any difference.

It just so happens that I’ve been messing around with lighting recently myself. I had most of the same problems (minus the texture tiling), but I solved it by looking at this tutorial: Materials Tutorial.

I just copied the code for the lights and the shiny rock, and removed the unnecessary stuff like bump mapping and that spherical projection bit. Basically, this is the minimum to get lighted materials. Only diffuse map (jMonkey logo):


DirectionalLight sun = new DirectionalLight();

sun.setDirection(new Vector3f(.5f, -1, .5f));


Material monkey = new Material(assetManager, “Common/MatDefs/Light/Lighting.j3md”);

monkey.setTexture(“m_DiffuseMap”, assetManager.loadTexture(“Interface/Logo/Monkey.jpg”));

monkey.setFloat(“m_Shininess”, 10);


I think you were forgetting the m_Shininess, which for some reason is necessary for it to display. Just use the setMaterial(monkey) on whatever you want lit. Obviously, you might want to use your actual materials, but this is just the bare minimum.

Also, I thought about how I solved a lot of this kind of problem, and most of it was just looking at the examples that come with jME. If I remember correctly, the FancyCar example has some tiled textures, so it might behoove you to spend some time looking at the code. Besides, some of the examples are pretty fun!

Thanks for weighing in. I have indeed gone through the example code a lot, but the problem appears to be with the model as exported from Blender. A topic which isn’t covered a lot anywhere - probably because it is assumed that you know what is needed and how to get Blender to export that.

Anyway, I don’t have any problems with the lighting after switching to the Lighting material definition. My major problem was with getting the textures to tile.

I have now managed to fix it for the floor. The solution was all in Blender: first I had to apply the texture to the floor surface (a plane) and then I also had to create a UV Mapping. To get it to tile in Blender, you simply scale up the UV mapping outline so that it is bigger than the image you are mapping it to. Blender will then tile it automatically.

Once I did that, the Ogre Exporter started adding <texcoord> nodes to the geometry - which is apparently needed for it to show up.

My only gripe with all of this is that JME silently fails to do what I am asking it to do. There is not even a warning in the log. That makes it very hard to troubleshoot as you have no idea what to search for. But I don’t know if it’s possible for it to give more information.

Thanks everyone for your suggestions.

I now consider this particular issue solved :slight_smile: