     normal = -normal;
   }
 
-  if (enableNormalMap) {
+  if (flag_normalMap) {
     vec3 normalScale = vec3(Material.normalScale, Material.normalScale, 1.);
     surface.normal = TangentMatrix * (normalize(getPixel(NormalTexture, UV).rgb * 2. - 1.) * normalScale);
   } else {

void main() {
  PixelColor[0] = lovrmain();

  if (enableGlow) {
    PixelColor[0].rgb += getPixel(GlowTexture, UV).rgb * Material.glow.rgb * Material.glow.a;
  }

  if (enableAlphaCutoff && PixelColor[0].a <= Material.alphaCutoff) {
    discard;
  }
}

  surface.reflection = reflect(-surface.view, normal);

  vec4 color = Color;
  if (flag_colorTexture) color *= getPixel(ColorTexture, UV);

  float metallic = Material.metalness;
  if (flag_metalnessTexture) metallic *= getPixel(MetalnessTexture, UV).b;

  surface.f0 = mix(vec3(.04), color.rgb, metallic);
  surface.diffuse = mix(color.rgb, vec3(0.), metallic);

  surface.emissive = Material.glow.rgb * Material.glow.a;
  if (flag_glow && flag_glowTexture) surface.emissive *= getPixel(GlowTexture, UV).rgb;

  float roughness = Material.roughness;
  if (flag_roughnessTexture) roughness *= getPixel(RoughnessTexture, UV).g;
  roughness = max(roughness, .05);
  surface.roughness2 = roughness * roughness;

  surface.occlusion = 1.;
  if (flag_occlusionTexture) surface.occlusion *= getPixel(OcclusionTexture, UV).r * Material.occlusionStrength;

  surface.clearcoat = Material.clearcoat;
  if (flag_clearcoatTexture) surface.clearcoat *= getPixel(ClearcoatTexture, UV).r;

  surface.clearcoatRoughness = Material.clearcoatRoughness;

