Sign in to follow this  

Multisampling/Depth Peeling

This topic is 2833 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I have a fairly fuzzy understanding of how multisampling works. I'm using Python/PyGame, so enabling multisampling is as simple as:
pygame.display.gl_set_attribute(GL_MULTISAMPLEBUFFERS,1)
pygame.display.gl_set_attribute(GL_MULTISAMPLESAMPLES,1)
I have a very extensive codebase that is capable of quite a bit. In several different effects, I use depth peeling, but I have noticed that when multisampling is enabled, the results are incorrect. As I mentioned, I have a limited understanding of multisampling, although it causing depth peeling to fail for some reason sounds reasonable. I'm not so much looking for a solution here, as an explanation--it would be great if someone could tell me what's likely going on. Thanks, -G

Share this post


Link to post
Share on other sites
Most depth peeling algorithms rely on multiple passes, using the depth buffer of pass N as a texture to pass N+1. This is obviously problematic with multisampling, if the multisampled depth buffer is resolved before being bound as an input texture to the next pass.

There are ways around this (although they can be expensive in terms of performance and/or memory, and some will require DX10 hardware), but the details depend on the exact depth peeling algorithm used.

Share this post


Link to post
Share on other sites
Not really an answer to your problem, talking philosophy here but screen-based algorithms (such as, but not limited to depth peeling) are pretty doomed to be incompatible with multisampling "as is". Workarounds may give more or less convincing results, but still are "workarounds" and as such have limitations or behave poorly in terms of gpu usage and/or memory usage.

The problem resides in the fact that multisampling works internally at the sample level which in fact is a sub-pixel, but when rendering to a texture, only pixels are copied from the texture, not sub-pixels. The lack of sub-pixel information makes subsequent algorithms unable to distinguish which pixels fully belong to the same surface and which ones were combined from multiple surfaces, i.e. pixels at the edges of a surface.

DirectX 10 allows shaders to access individual samples (color only, eventually depth since DX 10.1 IIRC) and I guess OpenGL will soon have similar extensions if not done already.

Share this post


Link to post
Share on other sites
Quote:
Original post by GeometrianI'm not really wanting multisampling and depth peeling--I'm wanting depth peeling without multsampling, but still with mutisampling on the main screen.


Either you or I don't get it. You can't just "disable multisampling for testing depth while depth peeling" and "use multisampling for rendering the final colors". Well, in fact you *can* ask your graphics card to do it, but you *will* have strange results at the edges. It will look like a very small hollow around your objects, and as you move your camera the hollow will either flicker or glow slowly, depending on the shape of the objects and the speed of the camera.

Share this post


Link to post
Share on other sites
Quote:
Either you or I don't get it.
It's likely me; as I said: "I have a limited understanding of multisampling".

I was thinking that, because multisampling can be enabled in the main screen render target while not in a FBO, the multisampling could be disabled for things like rendering depth. Evidently not.

Back to my question--are there workarounds for non-FBO rendering? My FBO depth peeler works fine, but I'd like to be able to support not-using-FBOs too!

Incidently, how would one enable multisampling in a FBO?

-G

Share this post


Link to post
Share on other sites

This topic is 2833 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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