Jump to content

  • Log In with Google      Sign In   
  • Create Account


Reconstruct position from depth


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Martin Perry   Members   -  Reputation: 1054

Like
0Likes
Like

Posted 13 February 2014 - 09:00 AM

I am trying to reconstruct position from depth in World Space (WS), but my code produce incorrect results.

 

So what I do:

 

1) Create depth map:

    for each vertex do:

   

viewPos = POSITION_WS * matrixView;

Depth = viewPos.z / farClipPlane;

 

2) Get corners of camera view frustrum in WS (cornerRayWS)

3) Use far plane corners and reconstruct depth for (x, y) -> <0,1>

 

cornerRayWS_interp = lerp(lerp(cornerRayWS[0], cornerRayWS[1], x),

                          lerp(cornerRayWS[2], cornerRayWS[3], x),

                          y);

 

reconstructed_posWS = camera_pos_ws + Depth * cornerRayWS_interp;

 

But my results are incorrect. You can see input calc values for one camera position and view matrices in atached screen. From that I reconstruct position.

Attached Thumbnails

  • Clipboard01.png


Sponsor:

#2 AverageJoeSSU   Members   -  Reputation: 516

Like
1Likes
Like

Posted 17 February 2014 - 02:35 PM

This, this, and this are good for reference. Have you looked at those articles?


------------------------------

redwoodpixel.com





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS