SHARE
TWEET

Untitled

a guest Sep 15th, 2014 136 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.                 /**  vec4 u_projInfo (-2.0f / (width*P[0][0]),
  2.                                   2.0f / (height*P[1][1]),
  3.                                   ( 1.0f - P[0][2]) / P[0][0],
  4.                                   ( -1.0f - P[1][2]) / P[1][1])
  5.                        
  6.                         where P is the projection matrix that maps camera space points
  7.                         to [-1, 1] x [-1, 1].  That is, GCamera::getProjectUnit(). */
  8.  
  9.                 /** Reconstruct camera-space P.xyz from screen-space S = (x, y) in
  10.                         pixels and camera-space z < 0.  Assumes that the upper-left pixel center
  11.                         is at (0.5, 0.5) [but that need not be the location at which the sample tap
  12.                         was placed!]
  13.                 */
  14.                 float3 reconstructCSPositionUV(float2 S, float z) {
  15.                         return float3((S.xy * u_uvProjInfo.xy + u_uvProjInfo.zw) * z, z);
  16.                 }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top