Skip to content

Commit

Permalink
Merge branch 'normalizednormals' into 'master'
Browse files Browse the repository at this point in the history
Don't handle per-vertex normals as tangent space normals (#7748)

See merge request OpenMW/openmw!3704
  • Loading branch information
jvoisin committed Dec 31, 2023
2 parents c97d0b5 + f83a7b7 commit db0d78b
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion files/shaders/compatibility/bs/default.frag
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void main()
vec3 viewNormal = normalToView(normalTex.xyz * 2.0 - 1.0);
specularColor *= normalTex.a;
#else
vec3 viewNormal = normalToView(normalize(passNormal));
vec3 viewNormal = normalize(gl_NormalMatrix * passNormal);
#endif

float shadowing = unshadowedLightRatio(linearDepth);
Expand Down
2 changes: 1 addition & 1 deletion files/shaders/compatibility/bs/default.vert
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void main(void)


#if @shadows_enabled
vec3 viewNormal = normalToView(passNormal);
vec3 viewNormal = normalize(gl_NormalMatrix * passNormal);
setupShadowCoords(viewPos, viewNormal);
#endif
}
2 changes: 1 addition & 1 deletion files/shaders/compatibility/bs/nolighting.vert
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void main(void)
}

#if @shadows_enabled
vec3 viewNormal = normalize((gl_NormalMatrix * gl_Normal).xyz);
vec3 viewNormal = normalize(gl_NormalMatrix * passNormal);
setupShadowCoords(viewPos, viewNormal);
#endif
}
2 changes: 1 addition & 1 deletion files/shaders/compatibility/groundcover.vert
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void main(void)
#endif

#if (!PER_PIXEL_LIGHTING || @shadows_enabled)
vec3 viewNormal = normalToView(passNormal);
vec3 viewNormal = normalize(gl_NormalMatrix * passNormal);
#endif

#if @diffuseMap
Expand Down
2 changes: 1 addition & 1 deletion files/shaders/compatibility/objects.frag
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ vec2 screenCoords = gl_FragCoord.xy / screenRes;
#if @normalMap
vec3 viewNormal = normalToView(texture2D(normalMap, normalMapUV + offset).xyz * 2.0 - 1.0);
#else
vec3 viewNormal = normalToView(normalize(passNormal));
vec3 viewNormal = normalize(gl_NormalMatrix * passNormal);
#endif

vec3 viewVec = normalize(passViewPos);
Expand Down
2 changes: 1 addition & 1 deletion files/shaders/compatibility/objects.vert
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void main(void)
#endif

#if @envMap || !PER_PIXEL_LIGHTING || @shadows_enabled
vec3 viewNormal = normalToView(passNormal);
vec3 viewNormal = normalize(gl_NormalMatrix * passNormal);
#endif

#if @envMap
Expand Down
2 changes: 1 addition & 1 deletion files/shaders/compatibility/terrain.frag
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void main()
#if @normalMap
vec3 viewNormal = normalToView(texture2D(normalMap, adjustedUV).xyz * 2.0 - 1.0);
#else
vec3 viewNormal = normalToView(normalize(passNormal));
vec3 viewNormal = normalize(gl_NormalMatrix * passNormal);
#endif

float shadowing = unshadowedLightRatio(linearDepth);
Expand Down
2 changes: 1 addition & 1 deletion files/shaders/compatibility/terrain.vert
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void main(void)
#endif

#if !PER_PIXEL_LIGHTING || @shadows_enabled
vec3 viewNormal = normalToView(passNormal);
vec3 viewNormal = normalize(gl_NormalMatrix * passNormal);
#endif

#if !PER_PIXEL_LIGHTING
Expand Down

0 comments on commit db0d78b

Please sign in to comment.