can someone thanslate this from ARB_fragment_program to cg fragment program ?
!!ARBfp1.0
OPTION ARB_fragment_program_shadow;
TEMP R0;
MOV R0, fragment.position;
TEX R0.x, R0, texture[1], SHADOWRECT;
ADD R0.x, R0.x, -0.5;
KIL R0.x;
OUTPUT out = result.color;
TEMP temp;
TEX temp, fragment.texcoord[0], texture[0], 2D;
MUL out, fragment.color, temp;
END
i need it for order independent transparency. texture[0] is a shadowmap which stores the depth values of the topmost fragments. now i want to draw the fragments which are behind these fragments.
my first try was this:
void main (
float4 iFragmentPos : TEXCOORD2,
float4 iColor : COLOR,
uniform samplerRECT iDepthBuffer,
uniform int iPeel,
out float4 oColor : COLOR
)
{
float4 kil = texRECT(iDepthBuffer, iFragmentPos.xy);
oColor = float4(iColor.rgb, iColor.a * kil.r);
}
but the result looks like the first layer.