Failed to compile fragment shader in engine version 1.58.2

Hi all!

I have an issue with shaders after the engine was updated to version 1.58.2

Could someone help me?

Have you check that they work with 1.57?

Can you share the shader code that is causing the error please?

It’s not working on 1.57 neither

The shader code

uniform sampler2D texture_normalMap;
uniform float material_bumpiness;

void getNormal() {
    vec3 normalMap = mix(unpackNormal(texture2D(texture_normalMap, $UV)), unpackNormal(texture2D(blendNormalMap, $UV)), blendWeight);
    normalMap = normalize(mix(vec3(0.0, 0.0, 1.0), normalMap, material_bumpiness));
    dNormalMap = addNormalDetail(normalMap);
    dNormalW = dTBN * dNormalMap;

@Gustav_Sterbrant - any thoughts on this? There were some change to $UV … should two of those work in a chunk?

Hello @Volodymyr_Protskyi!

I had some time trying to recreate this and found that the issue you are getting is because you are assuming the chunk has textures, so if the material doesn’t have a normal map applied, it won’t work. If you have a look at normalMap.js, you’ll see that is has guards against this with the #ifdef MAPTEXTURE.

If you add these to your chunk, you’ll see these issues go away :slightly_smiling_face:

Now, there is another issue that you will encounter later. You have a detail normal map, but the $UV will generate only one UV parameter based on a bunch of different factors per chunk. Have a look at diffuse.js to see how we deal with detail albedo maps.