Guest User

Untitled

a guest
Jun 20th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. uniform mat4 lightView, lightProjection;
  2.  
  3. const mat4 biasMatrix = mat4( 0.5, 0.0, 0.0, 0.0,
  4. 0.0, 0.5, 0.0, 0.0,
  5. 0.0, 0.0, 0.5, 0.0,
  6. 0.5, 0.5, 0.5, 1.0); //bias from [-1, 1] to [0, 1]
  7.  
  8. void main()
  9. {
  10. gl_Position = ftransform();
  11.  
  12. mat4 shadowMatrix = biasMatrix * lightProjection * lightView;
  13. shadowTexCoord = shadowMatrix * gl_Vertex;
  14. }
  15.  
  16. uniform sampler2DShadow shadowmap;
  17. varying vec4 shadowTexCoord;
  18.  
  19. void main()
  20. {
  21. vec4 shadow = shadow2DProj(shadowmap, shadowTexCoord, 0.0);
  22. float colorshadow = shadow.r < 0.1 ? 0.5 : 1.0;
  23.  
  24. vec4 color = vec4(1,1,1,1);
  25.  
  26. gl_FragColor = vec4( color*colorshadow, color.w );
  27.  
  28. gl_Position = gl_ProjectionMatrix * (gl_ModelViewMatrix * gl_Vertex)
  29.  
  30. uniform mat4 lightView, lightProjection;
  31. uniform mat4 camView, camProj, modelTrans;
  32. const mat4 biasMatrix = mat4( 0.5, 0.0, 0.0, 0.0,
  33. 0.0, 0.5, 0.0, 0.0,
  34. 0.0, 0.0, 0.5, 0.0,
  35. 0.5, 0.5, 0.5, 1.0); //bias from [-1, 1] to [0, 1]
  36.  
  37. void main()
  38. {
  39. mat4 modelViewProjMatrix = camProj * camView * modelTrans;
  40. gl_Position = modelViewProjMatrix * gl_Vertex;
  41.  
  42. mat4 shadowMatrix = biasMatrix * lightProjection * lightView * modelTrans;
  43. shadowTexCoord = shadowMatrix * gl_Vertex;
  44. }
Add Comment
Please, Sign In to add comment