void main (out half4 color : COLOR, float4 wpos : WPOS, // incoming fragment position uniform float3 E0, // edge equation uniform float3 E1, // edge equation uniform sampler1D intensityMap) { // construct sample position (x, y, 1) float3 p = float3(wpos.x, wpos.y, 1.0f); // evaluate edge functions f0, f1 half2 scaledDistance = half2(dot(E0, p), dot(E1, p)); // discard fragments that lie outside the line if (scaledDistance.x < 0.0f || scaledDistance.y < 0.0f) { discard; } // choose the relevant distance (edge) to use half index = min(scaledDistance.x, scaledDistance.y); // map to alpha using precomputed filter table half alpha = tex1D(intensityMap, index); // // do other shading here ... // // color.xyz = ... color.w = alpha; }