You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-15 13:51:40 +00:00
fix inconsistent normal map shader variable naming
This commit is contained in:
@@ -2489,7 +2489,7 @@ RendererCanvasRenderRD::RendererCanvasRenderRD(RendererStorageRD *p_storage) {
|
|||||||
actions.renames["COLOR"] = "color";
|
actions.renames["COLOR"] = "color";
|
||||||
actions.renames["NORMAL"] = "normal";
|
actions.renames["NORMAL"] = "normal";
|
||||||
actions.renames["NORMAL_MAP"] = "normal_map";
|
actions.renames["NORMAL_MAP"] = "normal_map";
|
||||||
actions.renames["NORMAL_MAP_DEPTH"] = "normal_depth";
|
actions.renames["NORMAL_MAP_DEPTH"] = "normal_map_depth";
|
||||||
actions.renames["TEXTURE"] = "color_texture";
|
actions.renames["TEXTURE"] = "color_texture";
|
||||||
actions.renames["TEXTURE_PIXEL_SIZE"] = "draw_data.color_texture_pixel_size";
|
actions.renames["TEXTURE_PIXEL_SIZE"] = "draw_data.color_texture_pixel_size";
|
||||||
actions.renames["NORMAL_TEXTURE"] = "normal_texture";
|
actions.renames["NORMAL_TEXTURE"] = "normal_texture";
|
||||||
|
|||||||
@@ -497,7 +497,7 @@ void main() {
|
|||||||
vec2 shadow_vertex = vertex;
|
vec2 shadow_vertex = vertex;
|
||||||
|
|
||||||
{
|
{
|
||||||
float normal_depth = 1.0;
|
float normal_map_depth = 1.0;
|
||||||
|
|
||||||
#if defined(NORMAL_MAP_USED)
|
#if defined(NORMAL_MAP_USED)
|
||||||
vec3 normal_map = vec3(0.0, 0.0, 1.0);
|
vec3 normal_map = vec3(0.0, 0.0, 1.0);
|
||||||
@@ -511,7 +511,7 @@ FRAGMENT_SHADER_CODE
|
|||||||
/* clang-format on */
|
/* clang-format on */
|
||||||
|
|
||||||
#if defined(NORMAL_MAP_USED)
|
#if defined(NORMAL_MAP_USED)
|
||||||
normal = mix(vec3(0.0, 0.0, 1.0), normal_map * vec3(2.0, -2.0, 1.0) - vec3(1.0, -1.0, 0.0), normal_depth);
|
normal = mix(vec3(0.0, 0.0, 1.0), normal_map * vec3(2.0, -2.0, 1.0) - vec3(1.0, -1.0, 0.0), normal_map_depth);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1855,7 +1855,7 @@ void main() {
|
|||||||
vec3 normal_map = vec3(0.5);
|
vec3 normal_map = vec3(0.5);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
float normal_depth = 1.0;
|
float normal_map_depth = 1.0;
|
||||||
|
|
||||||
vec2 screen_uv = gl_FragCoord.xy * scene_data.screen_pixel_size + scene_data.screen_pixel_size * 0.5; //account for center
|
vec2 screen_uv = gl_FragCoord.xy * scene_data.screen_pixel_size + scene_data.screen_pixel_size * 0.5; //account for center
|
||||||
|
|
||||||
@@ -1931,7 +1931,7 @@ FRAGMENT_SHADER_CODE
|
|||||||
normal_map.xy = normal_map.xy * 2.0 - 1.0;
|
normal_map.xy = normal_map.xy * 2.0 - 1.0;
|
||||||
normal_map.z = sqrt(max(0.0, 1.0 - dot(normal_map.xy, normal_map.xy))); //always ignore Z, as it can be RG packed, Z may be pos/neg, etc.
|
normal_map.z = sqrt(max(0.0, 1.0 - dot(normal_map.xy, normal_map.xy))); //always ignore Z, as it can be RG packed, Z may be pos/neg, etc.
|
||||||
|
|
||||||
normal = normalize(mix(normal, tangent * normal_map.x + binormal * normal_map.y + normal * normal_map.z, normal_depth));
|
normal = normalize(mix(normal, tangent * normal_map.x + binormal * normal_map.y + normal * normal_map.z, normal_map_depth));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user