Skip to content

Instantly share code, notes, and snippets.

@yiwenl
Created February 25, 2015 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yiwenl/a37eff62f687881ff3c8 to your computer and use it in GitHub Desktop.
Save yiwenl/a37eff62f687881ff3c8 to your computer and use it in GitHub Desktop.
GLSL code for getting the colour of the depth
//float n = 5.0;
//float f = 800.0;
float getDepth(float z, float n, float f) {
return (2.0 * n) / (f + n - z*(f-n));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment