Created
February 27, 2016 05:58
-
-
Save nobnak/f349a3d764ed80d23a65 to your computer and use it in GitHub Desktop.
Depth Buffer -> Linear Eye Depth for Unity
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
#ifndef __DEPTH_CGINC__ | |
#define __DEPTH_CGINC__ | |
float Z2EyeDepth(float z) { | |
return unity_OrthoParams.w < 0.5 | |
? LinearEyeDepth(z) | |
: ((_ProjectionParams.z - _ProjectionParams.y) * z + _ProjectionParams.y); | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, I am kind of new to shaders. Could you help me implement this?