Hi guys, I know this has been discussed ad nauseam but I can't get it to work.
I'm using an SSAO shader which works fine using a position texture but not with position from depth reconstruction.
I'm following MJP's http://mynameismjp.wordpress.com/2010/09/05/position-from-depth-3/ and tried both the spotlight and directional versions:
// vertex shader
output.vpos=mul(input.position,InverseProjection);
// pixel shader
float3 viewRay=input.vpos.xyz;
// get position function (in pixel shader)
float3 getPosition(in float2 uv,in float3 viewRay)
{
// old version works perfectly
// return tex2D(PositionTexture,uv).xyz;
// reconstruction doesn't work
float depth=tex2D(DepthTexture,uv).x;
return viewRay*depth;
}
Please help.