[SOLVED] My terrain is always lighted, even if there’s no light defined

As the title says above, I have a terrain like in the “HelloTerrain” tutorial and I would like to have it dark, because it should be night in the game.

I have removed all light sources defined, but that changed nothing!

For testing, I added a light to the game, but nothing has changed. Now I think that my game isn’t working correctly, I think that it can’t handle light. But why?!

Here’s my code:



private void generateTerrain() {

mat_terrain = new Material(assetManager,


AbstractHeightMap heightmap = null;

Texture heightMapImage = assetManager.loadTexture(


heightmap = new ImageBasedHeightMap(heightMapImage.getImage());


mat_terrain.setTexture(“Alpha”, assetManager.loadTexture(


Texture grass = assetManager.loadTexture(



mat_terrain.setTexture(“Tex1”, grass);

mat_terrain.setFloat(“Tex1Scale”, 64f);

Texture dirt = assetManager.loadTexture(



mat_terrain.setTexture(“Tex2”, dirt);

mat_terrain.setFloat(“Tex2Scale”, 32f);

Texture rock = assetManager.loadTexture(



mat_terrain.setTexture(“Tex3”, rock);

mat_terrain.setFloat(“Tex3Scale”, 128f);

int patchSize = 65;

terrain = new TerrainQuad(“sosTerrain”, patchSize, 1025, heightmap.getHeightMap());


terrain.setLocalTranslation(0, -100, 0);

terrain.setLocalScale(2.0f, 1.0f, 2.0f);


terrain.setUserData(“type”, “terrain”);


TerrainLodControl control = new TerrainLodControl(terrain, getCamera());

control.setLodCalculator(new DistanceLodCalculator(65, 2.7f));


CollisionShape terrainShape =

CollisionShapeFactory.createMeshShape((Node) terrain);

landscape = new RigidBodyControl(terrainShape, 0);



P.S.: I use jME in eclipse, so don’t wonder about the paths :smiley:

Remove jMonkeyEngine3.jar from the classpath.

@normen said:
Remove jMonkeyEngine3.jar from the classpath.

Hmm, I would, but there's no jMonkeyEngine3.jar on the classpath. Do you mean "Java Build Path", or what?
But thanks for your very fast answer :/

Note: Here's the list of libs I have in the build path:

- eventbus.jar
- j-ogg-oggd.jar
- j-ogg-vorbisd.jar
- jbullet.jar
- jinput.jar
- jME3-blender.jar
- jME3-core.jar
- jME3-desktop.jar
- jME3-effects.jar
- jME3-jbullet.jar
- jME3-jogg.jar
- jME3-lwjgl-natives.jar
- jME3-lwjgl.jar
- jME3-networking.jar
- jME3-niftygui.jar
- jME3-plugins.jar
- jME3-terrain.jar
- jME3-testdata.jar
- lwjgl.jar
- nifty-default-controls.jar
- nifty-examples.jar
- nifty-style-black.jar
- nifty.jar
- stack-alloc.jar
- vecmath.jar
- xmlpull-xpp3.jar

you use the unshaded terrain material. So lights don’t affect the terrain at all.



mat_terrain = new Material(assetManager, “Common/MatDefs/Terrain/TerrainLighting.j3md”);


instead of


mat_terrain = new Material(assetManager, “Common/MatDefs/Terrain/Terrain.j3md”);


@nehon said:
you use the unshaded terrain material. So lights don't affect the terrain at all.

mat_terrain = new Material(assetManager, "Common/MatDefs/Terrain/TerrainLighting.j3md");
instead of
mat_terrain = new Material(assetManager, "Common/MatDefs/Terrain/Terrain.j3md");

WOW! Thanks! Got it working!

...next time, I search a little bit more...
1 Like