diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-17 10:56:44 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-01-17 10:56:44 +0100 |
commit | 59dcf64dd6b8f5da570a551be7a317453e427098 (patch) | |
tree | c430a37e013fe14fa207409847c5402f18ff46fd /servers/rendering/renderer_rd/shaders/canvas.glsl | |
parent | 63dfdf4f89280ed993318059e7b521ea9432b531 (diff) | |
parent | 390f83bf5a1751ec2dc7892f6830285c2373985f (diff) |
Merge pull request #71382 from jainl28patel/sprite2d_flip_normal_map
fix normal map not flipping in sprite2D
Diffstat (limited to 'servers/rendering/renderer_rd/shaders/canvas.glsl')
-rw-r--r-- | servers/rendering/renderer_rd/shaders/canvas.glsl | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/servers/rendering/renderer_rd/shaders/canvas.glsl b/servers/rendering/renderer_rd/shaders/canvas.glsl index eb5f68849e..1fb8b28b15 100644 --- a/servers/rendering/renderer_rd/shaders/canvas.glsl +++ b/servers/rendering/renderer_rd/shaders/canvas.glsl @@ -502,6 +502,12 @@ void main() { if (normal_used || (using_light && bool(draw_data.flags & FLAGS_DEFAULT_NORMAL_MAP_USED))) { normal.xy = texture(sampler2D(normal_texture, texture_sampler), uv).xy * vec2(2.0, -2.0) - vec2(1.0, -1.0); + if (bool(draw_data.flags & FLAGS_FLIP_H)) { + normal.x = -normal.x; + } + if (bool(draw_data.flags & FLAGS_FLIP_V)) { + normal.y = -normal.y; + } normal.z = sqrt(1.0 - dot(normal.xy, normal.xy)); normal_used = true; } else { |