Jump to content

  • Log In with Google      Sign In   
  • Create Account

View-space vs window-space 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
No replies to this topic

#1 Kaptein   Prime Members   -  Reputation: 2179

Like
0Likes
Like

Posted 29 May 2014 - 07:55 PM

I have a shader that I input both view-space and window-space depth to.

Both of these are ok, but I would like to get rid of window-space depth so I can replace the depth-texture with a (much faster) depth-renderbuffer.

 

So, the problem is:

	// windowspace depth to world coordinates
	vec4 cofs = eye_direction * matview;
	cofs.xyz *= linearizeDepth(texCoord);

Where eye-direction is:

	eye_direction = vec4(gl_Position.xy * nearPlaneHalfSize, -1.0, 1.0);

So, if i multiply eye_direction with any windowspace depth, it will turn into an eye-space position.

 

Now, if I wanted to get rid of this depth-texture read in linearizeDepth() and use my eye-space depth instead, how would I do that?

Can it even be done easily? Or, relatively speaking just as easily as window-depth to eye-space.

 

Bottom line: I have view-space depth already, how do I throw the window-space depth out the window and use my view-space depth in its stead to reconstruct view-space or world-space.


Edited by Kaptein, 29 May 2014 - 07:56 PM.


Sponsor:



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