bero1985

Redconstruct from Depth Buffer

Sep 14th, 2013
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1.  
  2. Fragment:
  3.  
  4. // uClipPlaneConstants.x => uClipPlaneNear*uClipPlaneFar
  5. // uClipPlaneConstants.y => uClipPlaneFar-uClipPlaneNear
  6. // uClipPlaneConstants.z => uClipPlaneFar
  7. uniform vec3 uClipPlaneConstants;
  8. vec3 vertexViewSpace=vec3(vViewRayDirection.xy*(1.0/vViewRayDirection.z),1.0)*
  9.                      (uClipPlaneConstants.x/((texture2D(uTexDepth,vTexCoord).x*uClipPlaneConstants.y)-uClipPlaneConstants.z));
  10.  
  11. Vertex:
  12.  
  13. vViewRayDirection=(uInverseProjectionMatrix*vec4(gl_Position.xy,0.0,1.0)).xyz;
Advertisement
Add Comment
Please, Sign In to add comment