// Pass 3 (smoothie CORNER): fragment program.
void main (half zLinear     : TEXCOORD0,
           float4 wpos      : WPOS,
           out half4 aRemap : COLOR,
           uniform half3 v,      // silhouette vertex
           uniform half invT,    // 1/t (smoothie size)
           uniform samplerRECT shadowMap)
{
    // Compute linear alpha in screen space and remap.
    half alpha = saturate(length(wpos.xyz - v) * invT);
    half f = zLinear / texRECT(shadowMap, wpos.xy).x;
    aRemap = (f > 1) ? 1 : saturate(alpha / (1 - f));
}
