Jump to content
  • Advertisement
Sign in to follow this  
coderchris

OpenGL [DX9] Alpha to Coverage

This topic is 3791 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

Hey, So, im investigating alpha to coverage, and for some reason I cannot get it to work in Directx9. Iv got it working in OpenGL and Dx10 (on 8800), but for some reason I cant get it working in DX9. When I try to enable it with: device->SetRenderState(D3DRS_POINTSIZE, MAKEFOURCC('A','2','M','1')); There is no transparency at all, no alpha testing, nothing....just my textured billboard, and wherever there is a pixel that should have been transparent, it is black. I got that code from an ATI example. Is it possible that with directx9, ATI cards are the only ones that support Alpha to coverage? or is there a hack for nvidia cards that will enable it in DX9? (that code which works on ATI looks like a hack itself...)

Share this post


Link to post
Share on other sites
Advertisement
nVidia has it's own set of hacks to choose which type of coverage AA you want, which is here

Call GetAdapaterIdentifier to find what hardware is installed. You can figure out the type of card via the vendor id (0x1002 = ATI, 0x10DE = nVidia, 0x8086 = Intel). From there, use whichever hack is needed.

Share this post


Link to post
Share on other sites
Thanks a bunch, that was exactly what i needed.

I cant believe I missed that sample when I was looking through the nvidia sdk..

Share this post


Link to post
Share on other sites
So, in initializing my engine, Im checking weather or not alpha to coverage is supported or not.

On nvidia this is easy, they show how to do it in the white paper:

(d3d->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, 0, D3DRTYPE_SURFACE, (D3DFORMAT)MAKEFOURCC('A', 'T', 'O', 'C'))) == S_OK);

However, ATI doesnt give any info on how to check this. The way to enable it is like this:
device->SetRenderState(D3DRS_POINTSIZE, MAKEFOURCC('A','2','M','1'));

So, im guessing that to check weather this is supported on ATI, ill basically use the same code as above, but Im confused as to what to but in for the resource type parameter:

d3d->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, 0, ???WhatGoesHere???, (D3DFORMAT)MAKEFOURCC('A', '2', 'M', '1'))) == S_OK;

Since it uses point size to enable, i dont think D3DRTYPE_SURFACE will work here...
Any Ideas?

Share this post


Link to post
Share on other sites
ATI does mention it somewhere, but I don't know where. I'll check our engine tomorrow to see how I'm detecting it.
(or the next day... we're expecting 30cm of snow tonight. Getting to work may be problematic. ;) )

Share this post


Link to post
Share on other sites
Hmm, no method to test? that stinks... I guess Ill just do what you did and assume its avaliable (shader model 3 is a requirement for my engine anyway)

Thank you for checking though

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!