Face normal to transparency shader

Hi all,

I’m trying to find a very simple shader like a constant, but with the transparency binded to the normal direction of the face.

I tryed with the constant template, but without success…

Anyone can help me ?

Thanks for the answer
Arno

psin VS(vsin i) {
    psin o = (psin)0;
    o.pos = mul(i.pos, tWV);
    o.eye = normalize(o.pos.xyz);
    o.norm = mul(float4(i.norm, 0), tWV).xyz;
    o.pos = mul(o.pos, tP);
}
float4 PS(psin i) : SV_Target
{
    float4 col = mycolor;
    col.a *= 1 - abs(dot(i.norm, i.eye));
    return col;
}

on dx9 just replace sv_target with COLOR
if you want some smoother results controlled with a gamma you can put the dot part into pow like:

col.a *= 1 - pow(abs(dot(i.norm, i.eye)), gamma);

oh yeah !

Thank you Microdee !

I try right now