1
0
Fork 0

Remove rgb normalization and relax cut on NdotL to positive or null (fix visible redcuts)

This commit is contained in:
Eatdirt 2020-07-12 18:40:38 +02:00
parent d850f211fb
commit 6f4279a5ed
2 changed files with 7 additions and 6 deletions

View file

@ -61,8 +61,9 @@ void main()
float hmap = 1.0 - nmap.a;
nmap = texture2D(normal_texture, gl_TexCoord[0].st - 0.0005 * grad_dir * hmap * 2.0 * parallaxFactor);
// sanity processing for normal map when alpha is close to zero
nmap.rgb = normalize(nmap.rgb);
// nmap.rgb should not be normalized, it adversely modifies N = 2 nmap - 1
// nmap.rgb = normalize(nmap.rgb);
//if (nmap.b < 0.0) {nmap.b = -nmap.b;}
vec3 N = nmap.rgb * 2.0 - 1.0;
@ -125,8 +126,8 @@ void main()
if (NdotL > 0.0) {
// strictly positive produces visible hard cut
if (NdotL >= 0.0) {
color += diff_term * NdotL * (1.0-shadowTexel.a);
NdotHV = max(dot(n, halfVector), 0.0);
if (gl_FrontMaterial.shininess > 0.0)

View file

@ -95,8 +95,8 @@ void main()
if (NdotL > 0.0) {
// strictly positive produces visible hard cut
if (NdotL >= 0.0) {
color += diff_term * NdotL * (1.0-shadowTexel.a);
NdotHV = max(dot(n, halfVector), 0.0);
if (gl_FrontMaterial.shininess > 0.0)