Skip to content

Instantly share code, notes, and snippets.

@obviousjim
Created July 30, 2013 19:29
Show Gist options
  • Save obviousjim/6116086 to your computer and use it in GitHub Desktop.
Save obviousjim/6116086 to your computer and use it in GitHub Desktop.
float depthValueFromSample( vec2 depthPos){
vec2 halfvec = vec2(.5,.5);
vec3 hsl = rgb2hsl( texture2DRect(texture, floor(depthPos) + halfvec ).xyz );
float depth = hsl.r;
if(hsl.b > .2){
return depth * ( maxDepth - minDepth ) + minDepth;
}
else {
return 0.0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment