Sign in to follow this  
coderchris

OpenGL [DX9] Alpha to Coverage

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
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
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
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

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