#define MAX_STEPS_LINEAR	20
#define MAX_STEPS_LINEAR_INVF	(1.0 / 20.0)
#define MAX_STEPS_BINARY	10

#define STEP_SIZE		10.0
#define STEP_SIZE_MUL		1.35

#define Z_THRESHOLD		1.0		// sufficient difference to stop tracing

#define	FOREGROUND_FALLOFF	0.25
#define SCREEN_FALLOFF		6.0		// fall-off to screen edge, the higher the sharper

// get linear depth
float GetDepth(const in vec2 uv)
{
	float expDepth = texture(u_DepthBuffer, uv).r;
	return u_depthParms.x / (expDepth * u_depthParms.y - u_depthParms.z);
}

// view space to screen space (0.0 ... 1.0)
vec2 VS2SS(const in vec3 p)
{
	vec4 v = u_ProjectionMatrix * vec4(p, 1.0);
	return v.xy / v.w * 0.5 + 0.5;
}
