Sign in to follow this  
OutrageousBobIV

XNA/HLSL- 2D Deferred Rendering Depth Map

Recommended Posts

Hello,
I am trying to implement a depth map in my 2D game, so that I can use deferred rendering. My problem is, that when sprites are drawn on top of eachother, I cannot get the last z-value stored in that pixel. I am not using the vertex part of the pipeline, instead relying on spritebatch to do layering for me. Is there a way I can easily retireve the previous depth value in the texture? I am using alpha transparency for my sprites, and am not sure if this will cause problems.

This picture is the depth map, where white -> closer to the front. Therefore the white sprite should appear on top of the darker sprite, but it doesn't (the darker sprite is drawn after the lighter one).

Thanks in advance :)

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

Sign in to follow this