attempt to not apply normal mapping on clouds

This commit is contained in:
Eikthyrnir 2024-01-14 21:14:38 +01:00
parent e4d425a915
commit 49865aa158

View File

@ -64,16 +64,16 @@ void main()
vec3 cloudColor = texture2D(clouds, vertexTexCoordOut).rgb; vec3 cloudColor = texture2D(clouds, vertexTexCoordOut).rgb;
//disabled to prevent riffled clouds //disabled to prevent riffled clouds
//textureColor = mix(vec3(1), textureColor, cloudColor.r); textureColor = mix(vec3(1), textureColor, cloudColor.r);
normalizedVertexNormal = vec3(0, 0, 1);
if (cloudColor.r < 1) {
//get normal from normal sampler
vec3 samplerNormal = texture2D(normalSampler, vertexTexCoordOut).xyz;
samplerNormal = 2 * samplerNormal - 1;//since sampler has values from [0, 1], but we want [-1, 1]
normalizedVertexNormal = normalize(samplerNormal);// to avoid potential precision problems in sampler texture
}
//get normal from normal sampler
vec3 samplerNormal = texture2D(normalSampler, vertexTexCoordOut).xyz;
samplerNormal = 2 * samplerNormal - 1;//since sampler has values from [0, 1], but we want [-1, 1]
normalizedVertexNormal = normalize(samplerNormal);// to avoid potential precision problems in sampler texture
//Debug
//normalizedVertexNormal = vec3(0, 0, 1);
outColor = calcPointLight(textureColor, sunPos, sunLightDirTS, sunColor, sunLightExp); outColor = calcPointLight(textureColor, sunPos, sunLightDirTS, sunColor, sunLightExp);
outColor += calcSpotLight(textureColor, reflectorPos, reflectorLightDirTS, reflectorColor, reflectorLightExp); outColor += calcSpotLight(textureColor, reflectorPos, reflectorLightDirTS, reflectorColor, reflectorLightExp);