diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-02-21 18:49:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-21 18:49:14 +0100 |
commit | a01dca79e2f7b7cb221a4c416cade4fad2941446 (patch) | |
tree | 3ad82507c6e5b94ad08973fd8eb70731e160a315 | |
parent | 8fd2eb6234541dfb34800f7ef4b0350c5795bb67 (diff) | |
parent | 32e7641667146d5b7cfd2ec625e92a545462def9 (diff) |
Merge pull request #26125 from JFonS/revert_light_vec_shadows
Revert back to ignoring LIGHT_VEC for 2D shadows
-rw-r--r-- | drivers/gles2/shaders/canvas.glsl | 4 | ||||
-rw-r--r-- | drivers/gles3/shaders/canvas.glsl | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl index 643b6a5cc9..e74c7d7166 100644 --- a/drivers/gles2/shaders/canvas.glsl +++ b/drivers/gles2/shaders/canvas.glsl @@ -440,6 +440,10 @@ FRAGMENT_SHADER_CODE color *= light; #ifdef USE_SHADOWS + // Reset light_vec to compute shadows, the shadow map is created from the light origin, so it only + // makes sense to compute shadows from there. + light_vec = light_uv_interp.zw; + float angle_to_light = -atan(light_vec.x, light_vec.y); float PI = 3.14159265358979323846264; /*int i = int(mod(floor((angle_to_light+7.0*PI/6.0)/(4.0*PI/6.0))+1.0, 3.0)); // +1 pq os indices estao em ordem 2,0,1 nos arrays diff --git a/drivers/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl index 90775c841f..88368516c1 100644 --- a/drivers/gles3/shaders/canvas.glsl +++ b/drivers/gles3/shaders/canvas.glsl @@ -549,6 +549,10 @@ FRAGMENT_SHADER_CODE color *= light; #ifdef USE_SHADOWS + // Reset light_vec to compute shadows, the shadow map is created from the light origin, so it only + // makes sense to compute shadows from there. + light_vec = light_uv_interp.zw; + float angle_to_light = -atan(light_vec.x, light_vec.y); float PI = 3.14159265358979323846264; /*int i = int(mod(floor((angle_to_light+7.0*PI/6.0)/(4.0*PI/6.0))+1.0, 3.0)); // +1 pq os indices estao em ordem 2,0,1 nos arrays |