diff options
author | Max Hilbrunner <mhilbrunner@users.noreply.github.com> | 2018-07-04 23:39:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-04 23:39:59 +0200 |
commit | d90efacbc9a507fcf2693ffd08af5481fabc58e2 (patch) | |
tree | ba86bec4948bd3cea6d6bd36b7c707e652cbb34a | |
parent | 9986b64b7683a224cc16192bf54c619dc2cac9be (diff) | |
parent | ac18444c7e14e2d7f5bf347c7a600156d3af6ac7 (diff) |
Merge pull request #19973 from JFonS/fix_light_vec_rotation
Fix regression of 2D light height
-rw-r--r-- | drivers/gles3/shaders/canvas.glsl | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl index b3366a7f99..7aafd28c35 100644 --- a/drivers/gles3/shaders/canvas.glsl +++ b/drivers/gles3/shaders/canvas.glsl @@ -520,7 +520,11 @@ FRAGMENT_SHADER_CODE #ifdef USE_LIGHTING - vec2 light_vec = (inverse(light_matrix)*vec4(normalize(light_uv_interp.zw),0.0,0.0)).xy; //for normal mapping + mat3 inverse_light_matrix = mat3(inverse(light_matrix)); + inverse_light_matrix[0] = normalize(inverse_light_matrix[0]); + inverse_light_matrix[1] = normalize(inverse_light_matrix[1]); + inverse_light_matrix[2] = normalize(inverse_light_matrix[2]); + vec2 light_vec = (inverse_light_matrix * vec3(light_uv_interp.zw,0.0)).xy; //for normal mapping if (normal_used) { normal.xy = mat2(local_rot.xy,local_rot.zw) * normal.xy; |