Fix User-supplied Normals Being Ignored

Moves the initialization of the geo_normal value
to after the user shader code, so that the normal
supplied by the user is actually used instead of
the interpolated vertex normal.
This commit is contained in:
Stayd 2024-12-27 13:01:20 -07:00
parent a7a2a12bfd
commit 40f17127ef
3 changed files with 12 additions and 3 deletions

View File

@ -1816,7 +1816,6 @@ void main() {
normal = -normal;
}
#endif // DO_SIDE_CHECK
vec3 geo_normal = normalize(normal);
#endif // NORMAL_USED
#ifdef UV_USED
@ -1882,6 +1881,10 @@ void main() {
#endif //USE_MULTIVIEW
#endif //LIGHT_VERTEX_USED
#ifdef NORMAL_USED
vec3 geo_normal = normalize(normal);
#endif // NORMAL_USED
#ifndef USE_SHADOW_TO_OPACITY
#if defined(ALPHA_SCISSOR_USED)

View File

@ -1174,7 +1174,6 @@ void fragment_shader(in SceneData scene_data) {
normal = -normal;
}
#endif // DO_SIDE_CHECK
vec3 geo_normal = normalize(normal);
#endif // NORMAL_USED
#ifdef UV_USED
@ -1254,6 +1253,10 @@ void fragment_shader(in SceneData scene_data) {
#endif //USE_MULTIVIEW
#endif //LIGHT_VERTEX_USED
#ifdef NORMAL_USED
vec3 geo_normal = normalize(normal);
#endif // NORMAL_USED
#ifndef USE_SHADOW_TO_OPACITY
#ifdef ALPHA_SCISSOR_USED

View File

@ -898,7 +898,6 @@ void main() {
normal = -normal;
}
#endif // DO_SIDE_CHECK
vec3 geo_normal = normalize(normal);
#endif // NORMAL_USED
#ifdef UV_USED
@ -975,6 +974,10 @@ void main() {
#endif //USE_MULTIVIEW
#endif //LIGHT_VERTEX_USED
#ifdef NORMAL_USED
vec3 geo_normal = normalize(normal);
#endif // NORMAL_USED
#ifdef LIGHT_TRANSMITTANCE_USED
#ifdef SSS_MODE_SKIN
transmittance_color.a = sss_strength;