Alpha to coverage support added to OGRE

· by Steve · Read in about 2 min · (278 Words)

With only a couple of days to go before the feature lock-down of Ogre 1.6, in time for a release candidate next week, I decided to squeeze in one more feature of my own - Alpha to Coverage support. This allows the use of Multi-sample Anti-aliasing (MSAA) on transparent texture edges as well as the more usual polygon edges.

It headlines as a Dx10 feature, but in fact both ATI and NVIDIA have exposed it on GL and on Dx9, the latter via some nasty ‘magic’ state hacks since Dx9’s API doesn’t include it. They weren’t as nasty as I thought though, and since someone raised it in the forum recently, plus the fact that I’d been manually turning it on in the NVIDIA control panel for OgreSpeedTree, I figured I might as well add proper support for it.

In the image (if you click to get the full-size version), you can probably tell that the leaf on the right has alpha to coverage enabled, and the one on the left doesn’t - the right-hand one looks nicer, obviously. It does have an overhead of course, but those with decent cards will appreciate the extra quality I’m sure, and you can enable it on a per-pass basis in your materials to target it where you need it, which is better than enabling it across the board in the control panel like I was doing before. I’ve tested it on Dx9 and OpenGL on my GeForce 9800, and my Radeon HD 2900 (I guess I could update that, but it’s only a test box after all!) and it works nicely.

Yet another reason to upgrade to Ogre 1.6 😀