Jump to content
  • Advertisement
doogyhatts

Logarithmic Depth Buffer for Orthographic Camera

Recommended Posts

So I had tried to implement the logarithmic depth buffer solution, but I realised that my camera is orthographic. So the math should be different as compared to the one used for perspective camera.

From Outerra's article, The DirectX formula is z = log(C * w + 1) / log(C * Far + 1) * w

Does anyone know how to modify it for use with an orthographic camera?

Share this post


Link to post
Share on other sites
Advertisement

After applying a D3D-style perspective projection, "w" is equivalent to the Z coordinate of the vertex is in view space (relative to the eye/camera). A typical orthographic projection does not produce an equivalent value, instead the "z" value is equivalent to (ViewSpaceZ - NearClip) / (FarClip - NearClip). So if you'd like you can reconstruct the view-space Z value from that using the Near/Far clip plane values that you used, or by directly using values from the orthographic matrix. Or alternatively, you can just compute ViewSpaceZ in the vertex shader by transforming the vertex into view space.
 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!