Multisampling the depth buffer

Started by
3 comments, last by NewBreed 15 years, 1 month ago
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
Advertisement
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]
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.
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.
Ok, I'll keep going, I guess you're right - things should clear up.

Thank you.
NB.

This topic is closed to new replies.

Advertisement