Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uniform mat4 lightView, lightProjection;
- const mat4 biasMatrix = 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); //bias from [-1, 1] to [0, 1]
- void main()
- {
- gl_Position = ftransform();
- mat4 shadowMatrix = biasMatrix * lightProjection * lightView;
- shadowTexCoord = shadowMatrix * gl_Vertex;
- }
- uniform sampler2DShadow shadowmap;
- varying vec4 shadowTexCoord;
- void main()
- {
- vec4 shadow = shadow2DProj(shadowmap, shadowTexCoord, 0.0);
- float colorshadow = shadow.r < 0.1 ? 0.5 : 1.0;
- vec4 color = vec4(1,1,1,1);
- gl_FragColor = vec4( color*colorshadow, color.w );
- gl_Position = gl_ProjectionMatrix * (gl_ModelViewMatrix * gl_Vertex)
- uniform mat4 lightView, lightProjection;
- uniform mat4 camView, camProj, modelTrans;
- const mat4 biasMatrix = 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); //bias from [-1, 1] to [0, 1]
- void main()
- {
- mat4 modelViewProjMatrix = camProj * camView * modelTrans;
- gl_Position = modelViewProjMatrix * gl_Vertex;
- mat4 shadowMatrix = biasMatrix * lightProjection * lightView * modelTrans;
- shadowTexCoord = shadowMatrix * gl_Vertex;
- }
Add Comment
Please, Sign In to add comment