Jump to content

[SOLVED] Reconstructing eye position from deferred depth


photo

Recommended Posts

Another similar question.

From my understunding depth = getDeferredDepth(deferred_depth)*s_depth_range.y returns distance betwen camera position and the point (even in ortho). Unlike "traditional" depth values which return z values in the camera cordinates.  How to reconstruct z values in eye cordinates? 

The method i invented was doing that was multiplying inverseProjectionMatrix to the point (IN.texcoord_0.x*2.0 - 1.0 ,2.0 * (1.0 - IN.texcoord_0.y) -1.0, 0.0, 1.0 ). 

(obtained y,x values doesn't depend from depth value)

In obtained vertex values vertex.x / vertex.w , vertex.x/vertex.w are x and y cordinates of the point in eye space. so z*z will be equal to depth*depth - x*x - y*y..

It's not very straight forward method. Is there any easier way to do that in unigine?

 

 

Link to comment
×
×
  • Create New...