     data.worldNormal =
         mat3(tw, bw, nw) *
         normalize((texture(sampler2DArray(textureArray, textureSampler),
-                           vec3(uv * normalMapScale, mat.normalIndex))
+                           vec3(uv * mat.normalMapScale, normalMapLayerIndex))
                        .rgb) *
                       2.0 -
                   1.0)

  if (_hasMap(diffuseMapLayerIndex)) {
    data.materialDiffuse =
        texture(sampler2DArray(textureArray, textureSampler),
                vec3(uv * diffuseMapScale, diffuseMapLayerIndex))
            .rgb +
        vec3(mat.diffuse);
  } else {

    data.materialRoughness = mat.roughness;
  }

  data.materialSpecular = mat.specular;

  const vec3 p0 = v0.position.xyz, p1 = v1.position.xyz, p2 = v2.position.xyz;

  vec3 localPos = _blerp(attribs.xy, p0.xyz, p1.xyz, p2.xyz);
