Created
February 25, 2015 16:48
-
-
Save yiwenl/a37eff62f687881ff3c8 to your computer and use it in GitHub Desktop.
GLSL code for getting the colour of the depth
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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