• Create Account

We're offering banner ads on our site from just \$5!

### #ActualWFP

Posted 28 March 2013 - 03:36 PM

Hm, I'm thinking that possibly in addition or instead of the idea I had earlier, it may actually be that I need to recalculate the view ray for the new texture location:

		// 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;

// reconstruct full view space position r = (rx, ry, rz)
linearDepth = projectionB / (rz - projectionA);
// this viewRay still points to the originally sampled coordinate
float3 r = pIn.viewRay * linearDepth;


I'll try to figure out a solution for this.  If anyone knows it offhand, that'd be great ;).

Thanks!

Edit: Update to comment in code sample

### #1WFP

Posted 28 March 2013 - 03:36 PM

Hm, I'm thinking that possibly in addition or instead of the idea I had earlier, it may actually be that I need to recalculate the view ray for the new texture location:

		// 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;

// reconstruct full view space position r = (rx, ry, rz)
linearDepth = projectionB / (rz - projectionA);
// this viewRay still points the originally sampled coordinate
float3 r = pIn.viewRay * linearDepth;


I'll try to figure out a solution for this.  If anyone knows it offhand, that'd be great ;).

Thanks!

PARTNERS