summaryrefslogtreecommitdiff
path: root/drivers/gles2/shaders/scene.glsl
diff options
context:
space:
mode:
authorRaphaelHunter <raphael10241024@gmail.com>2019-07-27 23:05:26 +0800
committerRaphaelHunter <raphael10241024@gmail.com>2019-07-28 11:43:01 +0800
commit47df933c27d03a14a53658278ffd48198e4a9c6a (patch)
tree61080388e3af62ea8b1d8550865ebd5798123ba9 /drivers/gles2/shaders/scene.glsl
parent6c9ccf18f87a662e1994c870088a6beaaeeb0384 (diff)
update algorithm about paking float to vec4 to fix shadow shift and change rgba_shdow options
Diffstat (limited to 'drivers/gles2/shaders/scene.glsl')
-rw-r--r--drivers/gles2/shaders/scene.glsl6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl
index b7f8ec3ce9..534c977a87 100644
--- a/drivers/gles2/shaders/scene.glsl
+++ b/drivers/gles2/shaders/scene.glsl
@@ -1365,7 +1365,7 @@ LIGHT_SHADER_CODE
#ifdef USE_RGBA_SHADOWS
-#define SHADOW_DEPTH(m_val) dot(m_val, vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1.0))
+#define SHADOW_DEPTH(m_val) dot(m_val, vec4(1.0 / (255.0 * 255.0 * 255.0), 1.0 / (255.0 * 255.0), 1.0 / 255.0, 1.0))
#else
@@ -2207,8 +2207,8 @@ FRAGMENT_SHADER_CODE
#ifdef USE_RGBA_SHADOWS
highp float depth = ((position_interp.z / position_interp.w) + 1.0) * 0.5 + 0.0; // bias
- highp vec4 comp = fract(depth * vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0));
- comp -= comp.xxyz * vec4(0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);
+ highp vec4 comp = fract(depth * vec4(255.0 * 255.0 * 255.0, 255.0 * 255.0, 255.0, 1.0));
+ comp -= comp.xxyz * vec4(0.0, 1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0);
gl_FragColor = comp;
#endif