You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
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:
@@ -1816,7 +1816,6 @@ void main() {
|
|||||||
normal = -normal;
|
normal = -normal;
|
||||||
}
|
}
|
||||||
#endif // DO_SIDE_CHECK
|
#endif // DO_SIDE_CHECK
|
||||||
vec3 geo_normal = normalize(normal);
|
|
||||||
#endif // NORMAL_USED
|
#endif // NORMAL_USED
|
||||||
|
|
||||||
#ifdef UV_USED
|
#ifdef UV_USED
|
||||||
@@ -1882,6 +1881,10 @@ void main() {
|
|||||||
#endif //USE_MULTIVIEW
|
#endif //USE_MULTIVIEW
|
||||||
#endif //LIGHT_VERTEX_USED
|
#endif //LIGHT_VERTEX_USED
|
||||||
|
|
||||||
|
#ifdef NORMAL_USED
|
||||||
|
vec3 geo_normal = normalize(normal);
|
||||||
|
#endif // NORMAL_USED
|
||||||
|
|
||||||
#ifndef USE_SHADOW_TO_OPACITY
|
#ifndef USE_SHADOW_TO_OPACITY
|
||||||
|
|
||||||
#if defined(ALPHA_SCISSOR_USED)
|
#if defined(ALPHA_SCISSOR_USED)
|
||||||
|
|||||||
@@ -1174,7 +1174,6 @@ void fragment_shader(in SceneData scene_data) {
|
|||||||
normal = -normal;
|
normal = -normal;
|
||||||
}
|
}
|
||||||
#endif // DO_SIDE_CHECK
|
#endif // DO_SIDE_CHECK
|
||||||
vec3 geo_normal = normalize(normal);
|
|
||||||
#endif // NORMAL_USED
|
#endif // NORMAL_USED
|
||||||
|
|
||||||
#ifdef UV_USED
|
#ifdef UV_USED
|
||||||
@@ -1254,6 +1253,10 @@ void fragment_shader(in SceneData scene_data) {
|
|||||||
#endif //USE_MULTIVIEW
|
#endif //USE_MULTIVIEW
|
||||||
#endif //LIGHT_VERTEX_USED
|
#endif //LIGHT_VERTEX_USED
|
||||||
|
|
||||||
|
#ifdef NORMAL_USED
|
||||||
|
vec3 geo_normal = normalize(normal);
|
||||||
|
#endif // NORMAL_USED
|
||||||
|
|
||||||
#ifndef USE_SHADOW_TO_OPACITY
|
#ifndef USE_SHADOW_TO_OPACITY
|
||||||
|
|
||||||
#ifdef ALPHA_SCISSOR_USED
|
#ifdef ALPHA_SCISSOR_USED
|
||||||
|
|||||||
@@ -898,7 +898,6 @@ void main() {
|
|||||||
normal = -normal;
|
normal = -normal;
|
||||||
}
|
}
|
||||||
#endif // DO_SIDE_CHECK
|
#endif // DO_SIDE_CHECK
|
||||||
vec3 geo_normal = normalize(normal);
|
|
||||||
#endif // NORMAL_USED
|
#endif // NORMAL_USED
|
||||||
|
|
||||||
#ifdef UV_USED
|
#ifdef UV_USED
|
||||||
@@ -975,6 +974,10 @@ void main() {
|
|||||||
#endif //USE_MULTIVIEW
|
#endif //USE_MULTIVIEW
|
||||||
#endif //LIGHT_VERTEX_USED
|
#endif //LIGHT_VERTEX_USED
|
||||||
|
|
||||||
|
#ifdef NORMAL_USED
|
||||||
|
vec3 geo_normal = normalize(normal);
|
||||||
|
#endif // NORMAL_USED
|
||||||
|
|
||||||
#ifdef LIGHT_TRANSMITTANCE_USED
|
#ifdef LIGHT_TRANSMITTANCE_USED
|
||||||
#ifdef SSS_MODE_SKIN
|
#ifdef SSS_MODE_SKIN
|
||||||
transmittance_color.a = sss_strength;
|
transmittance_color.a = sss_strength;
|
||||||
|
|||||||
Reference in New Issue
Block a user