Enabling Transparency AA In DX9 On ATI Cards

Started by
6 comments, last by andur 15 years, 8 months ago
Is there a way of enabling transparency anti-aliasing in DX9 on ATI cards? I tried this method from Nvidia: (http://developer.nvidia.com/object/devnews028.html see the tip of the month section) pd3dDevice-> SetRenderState(D3DRS_ADAPTIVETESS_Y, (D3DFORMAT)MAKEFOURCC('S', 'S', 'A', 'A')); And while that works on Nvidia cards, it has no effect on any Ati cards.
Advertisement
pd3dDevice->SetRenderState(D3DRS_POINTSIZE, MAKEFOURCC('A','2','M','1'));


that should do the trick. I havent actually been able to test it myself yet, let me know if it works
Doesn't work on my X1600 card at home here, I'll have to try it out on the fancier cards I've got at work tomorrow.

Now, is that the FourCC code for multi-sampled aa or super-sampled aa? The super-sampled aa looked far better on the Nvidia card (7950) that I tried it out on. (the multi-sampled method had a really weird blur pattern that really broke down up close, and still shimmered some from a distance)

Oh, and where'd you find that code from anyways?
Hmm, yeah it may only work on their newer cards. That four-c is for multisampled AA. To my knoledge, there are no radeon cards that support supersampled AA (correct me if im wrong).

I agree though, supersampled looks so much better than multisampled.

I got that from one of the examples in the ATI SDK (cant remember which one):
http://developer.amd.com/gpu/radeon/pages/RadeonSDKSamplesDocuments.aspx#d3d9

You might try turning on standard multisampling if you havent already. I remember I had to do that to get it working on my nvidia card.
The A2M1 code enables some sort of transparency AA on a radeon 2900 and above, though its kind of an ugly 3-banded blur around the objects. I can't find a way of enabling super-sampling with it. I may just need to roll a custom shader of some sort to consistently deal with softening the masked edges.

And I do have standard multisampling AA turned on as well.
The A2M1 FourCC enables the "Alpha to coverage" feature (also called "Alpha To Mask" hence the FourCC name), which converts the alpha output from the pixel shader into a multisampling coverage mask. Thus for instance an alpha value around 0.5 would result in 2 samples being "on" and 2 samples being "off" on a 4-sample multisampling configuration. This technique should really only be used in combination with MSAA as otherwise a dithering effect will be seen on single-sample configurations. After MSAA resolves Alpha to Coverage results in smooth edges around transparent geometry (the level of smoothness depending on the number of multisamples being used).
Alpha to coverage is different (and cheaper) than "supersample AA" that nVidia exposes through another backdoor; supersample AA simply mutipass transparent geometry (one pass per sample) so that each multisample is aligned with the pixel centre at each pass. Each pass only outputs into a single sample, so you're paying the full cost of supersampling your transparent geometry (on top of the extra geometry cost). Of course this will look better than alpha to coverage (but is also more costly). Off the top of my head supersample AA could also be implemented manually by adjusting the projection matrix each pass and setting the D3DRS_MULTISAMPLEMASK renderstate to write to the selected sample each pass).
Alpha to Coverage:
pd3dDevice->SetRenderState(D3DRS_POINTSIZE, MAKEFOURCC('A','2','M','1'));


Instancing:
pDev->SetRenderState(D3DRS_POINTSIZE, MAKEFOURCC('I','N','S','T'));



Am I missing something here? Or are AtC and Instancing mutually exclusive because they both use POINTSIZE?
Quote:Original post by gzboli
Alpha to Coverage:
pd3dDevice->SetRenderState(D3DRS_POINTSIZE, MAKEFOURCC('A','2','M','1'));


Instancing:
pDev->SetRenderState(D3DRS_POINTSIZE, MAKEFOURCC('I','N','S','T'));



Am I missing something here? Or are AtC and Instancing mutually exclusive because they both use POINTSIZE?


That seems to be the case, tracing through:

DWORD ps;
this->device->GetRenderState(D3DRS_POINTSIZE, &ps);
this->device->SetRenderState(D3DRS_POINTSIZE, MAKEFOURCC('A','2','M','1'));
this->device->GetRenderState(D3DRS_POINTSIZE, &ps);

does show that the value of the point size render state is changing. Now, I imagine that the driver is intercepting that and internally changing its own state somewhere indicating that AtC or Instancing is active, but, I really don't know for sure. Try it and find out!

This topic is closed to new replies.

Advertisement