• Create Account

### #ActualWFP

Posted 28 March 2013 - 03:37 PM

Krypt0n:  Just tried your suggestion, and it didn't make a difference besides making the effect darker on the screen (of course, since it was always 1.0f instead of between 0.0f and 1.0f).  It still gave basically the exact same thing we see in the images above, though.

EDIT:  Sorry, meant to answer your first question, too.  I am trying to do everything in view space, not world space.

My thinking is that the issue is somewhere in these lines:

                // sample a point near position within the occlusion radius
float3 q = position + flip * gOcclusionRadius * offset;

// project q and generate projective tex-coords
float4 projQ = mul(float4(q, 1.0f), gViewToTexSpace);
projQ.xy /= projQ.w;

// find nearest depth value along ray from eye to q
float rz = depthStencilTexture.SampleLevel(samNormalDepth, projQ.xy, 0.0f).r;


because I am initially reconstructing the position from linear depth, but am not undoing that linear depth transformation before doing work with q to find the new sampling coordinates.  I have to run to work, but can test this theory this evening, plus any other suggestions anyone may have.

### #3WFP

Posted 28 March 2013 - 03:37 PM

Krypt0n:  Just tried your suggestion, and it didn't make a difference besides making the effect darker on the screen (of course, since it was always 1.0f instead of between 0.0f and 1.0f).  It still gave basically the exact same thing we see in the images above, though.

EDIT:  Sorry, meant to answer your first question, too.  I am trying to do everything in view space, not world space.

My thinking is that the issue is somewhere in these lines:

// sample a point near position within the occlusion radius
float3 q = position + flip * gOcclusionRadius * offset;

// project q and generate projective tex-coords
float4 projQ = mul(float4(q, 1.0f), gViewToTexSpace);
projQ.xy /= projQ.w;

// find nearest depth value along ray from eye to q
float rz = depthStencilTexture.SampleLevel(samNormalDepth, projQ.xy, 0.0f).r;


because I am initially reconstructing the position from linear depth, but am not undoing that linear depth transformation before doing work with q to find the new sampling coordinates.  I have to run to work, but can test this theory this evening, plus any other suggestions anyone may have.

### #2WFP

Posted 28 March 2013 - 06:09 AM

Krypt0n:  Just tried your suggestion, and it didn't make a difference besides making the effect darker on the screen (of course, since it was always 1.0f instead of 0.0f).  It still gave basically the exact same thing we see in the images above, though.

EDIT:  Sorry, meant to answer your first question, too.  I am trying to do everything in view space, not world space.

My thinking is that the issue is somewhere in these lines:

// sample a point near position within the occlusion radius
float3 q = position + flip * gOcclusionRadius * offset;

// project q and generate projective tex-coords
float4 projQ = mul(float4(q, 1.0f), gViewToTexSpace);
projQ.xy /= projQ.w;

// find nearest depth value along ray from eye to q
float rz = depthStencilTexture.SampleLevel(samNormalDepth, projQ.xy, 0.0f).r;


because I am initially reconstructing the position from linear depth, but am not undoing that linear depth transformation before doing work with q to find the new sampling coordinates.  I have to run to work, but can test this theory this evening, plus any other suggestions anyone may have.

### #1WFP

Posted 28 March 2013 - 06:06 AM

Krypt0n:  Just tried your suggestion, and it didn't make a difference besides making the effect darker on the screen (of course, since it was always 1.0f instead of 0.0f).  It still gave basically the exact same thing we see in the images above, though.

My thinking is that the issue is somewhere in these lines:

// sample a point near position within the occlusion radius
float3 q = position + flip * gOcclusionRadius * offset;

// project q and generate projective tex-coords
float4 projQ = mul(float4(q, 1.0f), gViewToTexSpace);
projQ.xy /= projQ.w;

// find nearest depth value along ray from eye to q
float rz = depthStencilTexture.SampleLevel(samNormalDepth, projQ.xy, 0.0f).r;


because I am initially reconstructing the position from linear depth, but am not undoing that linear depth transformation before doing work with q to find the new sampling coordinates.  I have to run to work, but can test this theory this evening, plus any other suggestions anyone may have.

PARTNERS