NormalMap = undefined if AlphaMap is not set. Bug or intended?

I’ve noted that yesterday and although I haven’t looked into it, this seems wrong to me.

In short, if first line is commented, I get the error, otherwise it works fine.

[java]
terMat.setTexture(“AlphaMap”, alpha);
Texture normal = assetManager.loadTexture(“Textures/Terrain/normalmap.png”);
terMat.setTexture(“NormalMap”, normal);
[/java]

Just for those who might not look at the section of the post… this is the terrain material, right?

Yes.

@madjack said: I've noted that yesterday and although I haven't looked into it, this seems wrong to me.

In short, if first line is commented, I get the error, otherwise it works fine.

[java]
terMat.setTexture(“AlphaMap”, alpha);
Texture normal = assetManager.loadTexture(“Textures/Terrain/normalmap.png”);
terMat.setTexture(“NormalMap”, normal);
[/java]

Which shader? If it’s TerrainLighting.j3md, the frag shader requires a minimum of one alpha map. If your not using Triplanar mapping…calculateNormal is called, and the first couple lines of calculateNormal:

[java]
vec3 calculateNormal(in vec2 texCoord) {
vec3 normal = vec3(0,0,1);
vec3 n = vec3(0,0,0);

vec4 alphaBlend = texture2D( m_AlphaMap, texCoord.xy );

[/java]

Assume there is at least one alpha map.