Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm experiencing a strange problem using OpenGL SampleAlphaToCoverage mode. There are rendering artifacts when using alpha-blending on pixels that have been rendered using alpha-to-coverage - and I can't explain why.

Here's the basic setup:

  1. Render the world. Some batches of vertices are rendered using alpha-to-coverage. Blending is never enabled at this stage.
  2. Disable depth testing an render a screen overlay. At this point I'm using alpha blending. Alpha-to-coverage is never enabled at this stage.

I'm using alpha-to-coverage on the airplanes glass window. This is what the scene looks like: Works as expected

Everything works as expected so far. However, as soon the screen overlays alpha blending is drawn at a screen location where alpha-to-coverage has been previously active, I'm getting this: Blending artifacts

Note that there is no error as long as blending affects different pixels than alpha-to-coverage! enter image description here

I also tested the following cases:

  • Use alpha-to-coverage for the overlay instead of alpha blending: No artifacts.
  • Clear the entire screen before rendering the screen overlay: No artifacts.
  • Clear all buffers except the color buffer: Artifacts
  • Clear only the color buffer: No artifacts

The screen overlay item in question consists of a single textured Quad. The texture is 256x256.

You can download the test application at http://www.fetzenet.de/atc_error.zip Camera controls are WASD + Mouse (Hold left or right button)

Does anyone have a clue whats going on here? Also, can anyone reproduce this behavior?

share|improve this question
    
Tried playing with glSampleCoverage()? –  Michael Slade May 6 '12 at 18:28
    
Is the MSAA resolve occurring before or after the screen overlay pass? –  John Calsbeek May 6 '12 at 18:29
    
@JohnCalsbeek Can you tell me how to find out? I'm rendering both in a single frame and do nothing special.. Is there a way to trigger an MSAA resolve explicitly? –  Adam May 6 '12 at 18:34
    
@MichaelSlade Yes, I set it to 1.0f when rendering the overlay, but that didn't change anything. –  Adam May 6 '12 at 18:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.