ATI + ARB_fragment_program + ARB_shadow


Is it not possible to have a ARB_shadow texture bound to a texture unit with comparemode != NULL, and fragment program running at the same time on ATI? I.e. is ARB_shadow disabled when executing a fragment program? (This works fine on NVIDIA)

If so, how can a shadow texture with comparemode set to GL_COMPARE_R_TO_TEXTURE on texture unit #0 be implemented using only a fragment program (if at all possible)??

[ The reason I am asking is that I am trying to implement an order independent transparency rendering on an ATI Radeon (whitepaper by Cass Everint at Nvidia) using fragment programming instead of Nvidia extensions. ]

Øystein Handegard

According to the specs, ARB_shadow is disabled when using ARB_fragment_program. There are other posts about this on this forum. nVidia unintentionally broke the rules about this and IMHO I think they are right to. You have to do the compare yourself in the fragment program, but if you do this you will lose nVidia’s PCF.


Hmmm… thats what I feared (the spec was abit strange at that point). Is there an easy way to make the shadow test using FP instead? I have tried to search the web for info on FP, but most examples only handles simple shading etc.

I use Cg so in Cg it would be

float shadow = (shadowMap.r <= IN.ShadowCoords.z/IN.ShadowCoords.w) ? 0 : 1;

Reverse if you use the other compare type.

As mentioned before you will lose PCF, though it is possible to replicate this in the fragment program but would not take advantage of nVidia’s hardware solution. I believe an example of this is available on ATI’s website.