nythrix's picture

Playing with multisampling

I have noticed that colors on multisampled renderbuffers are not accurate. It's probably because of pixels "blending" with each other, though I have no idea on how renderbuffers work so this is more of a guess. Anyway, here's a picture of 3 cubes, each rendered with a different sampling method. Top: no multisampling, left: 2 samples, right: 4 samples.

Is there a way of making them look the same?
Edit: I'm on a GL3+ context so I hope I can counter this effect on the pixel shader. No more ideas so far.

Inline Images

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

This looks more like a driver bug than anything.

Check your driver settings and try disabling things like "adaptive antialiasing" or "temporal antialiasing". What happens if you disable FSAA in code but force through the drivers?

kvark's picture

I'm not expert in AA but how can you use it differently inside one window? AFAIK, the context is usually reset (by app reloading) in order to change AA quality.

the Fiddler's picture

Two ways I can think of: use multisampled framebuffer objects or use 3 different contexts at once.

kvark's picture

OK, then the source code producing this bug could be helpful.
At least, we'd know whether nythrix uses blending somewhere or not.

nythrix's picture

Sorry, I updated my post during your reply.
Forcing the AA setting through the driver and specifying a different one in the code crashes the app (on GL.BlitFramebuffer) I can specify the driver's AA or no AA. It's not really overriding my app. Instead I get a good old kick in the teeth if I rebel:) Weird...
Anyway, turning "Antialiasing - Gamma correction" off fixes the problem. No idea what's that for, never messed with it.
Config: nVidia GT9600, ForceWare 186.16

nythrix's picture

Indeed, I use 3 FBOs with multisampled renderbuffers. Then I blit them into the framebuffer. I'm currently looking into fitting a raytracer in that window too. I can write down a short tutorial if there's interest.

kvark's picture

Despite the problem is solved, you can try writing FBO textures to external BMP/TIF/TGA files to see what's in there.

the Fiddler's picture

Gamma correction tries to improves FSAA appearance of dark on light objects and vice versa. Imagine thin power lines hanging under of a bright sky: without gamma correction they will appear darker than they should.

In general, the effect is subtle and there are a few cases where it gamma correct FSAA looks worse. However, in most cases it looks better - this was considered one of the advantages of R500 over NV40 (IIRC).

It is possible that you've hit a driver bug (186 is still beta, I think?) You could try logging a bug or asking at the nvidia forums.

Edit: and yes, this seems to be a known issue, that could be considered a bug or not - depending on whom you ask. The specs are vague here.

nythrix's picture

Edit: and yes, this seems to be a known issue, that could be considered a bug or not - depending on whom you ask. The specs are vague here.
I was about to post the same thing. There's a lot of big words in that discussion which I'm not sure I fully understand. My knowledge on pixel processing is a bit limited. I only started with FBOs this morning.