Failed to apply normal map to terrain material

Hi everybody,

I’ve an issue with the TerrainLighting matdef. I documented here :
and try out to make my own in-code texture splatting. All was working well until I tried to apply a normal map.

Here is a before/after :

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);
        m.setTexture("DiffuseMap", t1);
        m.setFloat("DiffuseMap_0_scale", 16f);

        // texture 2 : the road
        Texture t2 = assetManager.loadTexture(tex2);
        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 !


here is the normal map itself :

sorry for the bad links


the normal map

I’ve found out myself what was the problem : I wasn’t generating the tangent and binormal.