oglc/shader/include/depth.glsl

17 lines
353 B
Plaintext
Raw Normal View History

2023-02-24 02:12:51 +01:00
float getLinearDepth(float distance)
{
return distance/INF;
}
float getLogarithmicDepth(float distance)
{
// n roughly correlates to steepness of log curve
// TODO: what does this mean in mathematical terms??
2023-02-26 04:27:15 +01:00
float n = 2;
2023-02-24 02:12:51 +01:00
float f = INF;
float z = distance;
// logarithmic depth
return max(0,log(z*pow(E,n)/f)/n);
}