Advertisement
Guest User

Untitled

a guest
Jun 3rd, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. float _vectorToDepth(float3 vec, float n, float f)
  2. {
  3. float3 AbsVec = abs(vec);
  4. float LocalZcomp = max(AbsVec.x, max(AbsVec.y, AbsVec.z));
  5.  
  6. float NormZComp = (f+n) / (f-n) - (2*f*n)/(f-n)/LocalZcomp;
  7. return (NormZComp + 1.0) * 0.5;
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement