Sign in to follow this  
NewBreed

Multisampling the depth buffer

Recommended Posts

Hi, In simple terms what reasons would there be to multisample the depth buffer, I can see why this would be needed for the back buffer for anti-aliasing... but the depth buffer... Why? Thanks, NB

Share this post


Link to post
Share on other sites
To understand why your depth buffer needs to be multisampled you need to to understand how multisampling works. The basic process is like this:


foreach pixel/fragment
run pixel shader, determine output color
foreach subsample
determine offset sample position
at sample position, determine depth
compare depth with existing subsample depth in depth buffer
if depth test passes, write color to subsample of render target

Then when the multisampled render target is resolved to a non-MS buffer, the color subsamples are averaged with a box filter (or possibly a different type of filter, if it's a newer GPU).


So to summarize: the reason you need a multisampled depth buffer is because the depth comparison is done at a subsample level.

[Edited by - MJP on March 17, 2009 1:37:25 PM]

Share this post


Link to post
Share on other sites
Ack, I'm very sorry - I don't understand [depressed]. I don't have a clue really about shaders and the like I'm just starting out on the DirectX path working my way through the book "Introduction to 3D Game Programming with DirectX 9.0c: A Shader Approach". The passage that mentions multisampling the depth buffer is as follows:

Quote:

the third parameter (of the CheckDeviceMultiSampleType method) is the pixel format of the surface we want multisampled (usually the back buffer or depth buffer format);


The book hasn't gone over how multisampling/shaders/anythingelseremotelycomplex actually works.

This is just guessing but:

1) Render objects to depth buffer to get closest pixel values.
2) Pass information to back buffer.
3) Perform multisampling on back buffer to remove aliasing.

Assuming this process is correct I can't see why the depth buffer needs multisampling as multisampling is only needed to remove aliasing?

Thanks for the help,
NB.

Share this post


Link to post
Share on other sites
That's not really accurate. Multisampling isn't something done after rendering, like a post-processing filter or something like that. It's actually a different method of rendering. If you can't understand what I posted then I wouldn't worry about it too much right now. Just keep focusing on the basics, and once you understand the graphics pipeline better you'll be able to have a better idea of how multisampling works.

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