diff options
Diffstat (limited to 'src/datavis3d/engine/shaders/vertexShadow')
-rw-r--r-- | src/datavis3d/engine/shaders/vertexShadow | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/datavis3d/engine/shaders/vertexShadow b/src/datavis3d/engine/shaders/vertexShadow index 04923f1a..24184376 100644 --- a/src/datavis3d/engine/shaders/vertexShadow +++ b/src/datavis3d/engine/shaders/vertexShadow @@ -7,7 +7,7 @@ uniform highp mat4 V; uniform highp mat4 M; uniform highp mat4 itM; uniform highp vec3 lightPosition_wrld; // this is for inverted light direction, not position (we are just reusing uniform) -uniform highp mat4 depthBiasMVP; +uniform highp mat4 depthMVP; varying highp vec2 UV; varying highp vec3 position_wrld; @@ -16,9 +16,14 @@ varying highp vec3 eyeDirection_cmr; varying highp vec3 lightDirection_cmr; varying highp vec4 shadowCoord; +const highp mat4 bias = mat4(0.5, 0.0, 0.0, 0.0, + 0.0, 0.5, 0.0, 0.0, + 0.0, 0.0, 0.5, 0.0, + 0.5, 0.5, 0.5, 1.0); + void main() { gl_Position = MVP * vec4(vertexPosition_mdl, 1.0); - shadowCoord = depthBiasMVP * vec4(vertexPosition_mdl, 1.0); + shadowCoord = bias * depthMVP * vec4(vertexPosition_mdl, 1.0); position_wrld = (M * vec4(vertexPosition_mdl, 1.0)).xyz; vec3 vertexPosition_cmr = (V * M * vec4(vertexPosition_mdl, 1.0)).xyz; eyeDirection_cmr = vec3(0.0, 0.0, 0.0) - vertexPosition_cmr; |