I’ve an issue with the TerrainLighting matdef. I documented here : https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:terrain#texture_splatting
and try out to make my own in-code texture splatting. All was working well until I tried to apply a normal map.
and the piece of code (the commented part is active on the right side image) :
Material m = new Material(assetManager, "Common/MatDefs/Terrain/TerrainLighting.j3md"); m.setTexture("AlphaMap", assetManager.loadTexture(alpha)); // texture 1 : the grass Texture t1 = assetManager.loadTexture(tex1); t1.setWrap(WrapMode.Repeat); m.setTexture("DiffuseMap", t1); m.setFloat("DiffuseMap_0_scale", 16f); // texture 2 : the road Texture t2 = assetManager.loadTexture(tex2); t2.setWrap(WrapMode.Repeat); m.setTexture("DiffuseMap_1", t2); m.setFloat("DiffuseMap_1_scale", 8f); // Texture normal = assetManager.loadTexture("textures/env01/groundGrass_n.png"); // normal.setWrap(WrapMode.Repeat); // m.setTexture("NormalMap_1", normal);
Note that there is only a single directionnal light.
The texture is globally lighter, the edges disapeared, and the normal map is quite invisible and doesn’t make any bump effect.
I assume that my normal map is used as a sort of additionnal diffuse map, added in some way to the whole splatted texture, but I can’t figure out why.
Anybody can help?
Thanks in advance !