sampler2D downsampledImage; half fullDist = 0.3h; half noneDist = 0.9h; half2 direction = half2(-0.01h, -0.01h); struct vertexOutput { float4 oPosition : POSITION; half2 oTexCoord : TEXCOORD0; }; vertexOutput starVP( float4 position : POSITION, float2 texCoord : TEXCOORD0 ) { vertexOutput OUT = (vertexOutput)0; OUT.oPosition = position; OUT.oTexCoord.xy = texCoord; return OUT; } half4 starFP( vertexOutput IN ) : COLOR0 { half4 sample = 0.0h; half4 colour = 0.0h; half dist; half p; half2 samplePosition = IN.oTexCoord.xy; half diffDist = fullDist - noneDist; // Sample from eight points along the star line half weight = 1.h; for(int iSample = 0; iSample < 5; iSample++) { sample = h4tex2D(downsampledImage, samplePosition); sample /= sample.a; dist = distance(half2(0.5h, 0.5h), samplePosition); p = noneDist + (diffDist * dist); //lerp(noneDist, fullDist, dist);//saturate(noneDist - dist) / (noneDist - fullDist); colour += sample * saturate(weight) * p; samplePosition = samplePosition + (direction * 1.0h); weight -= 0.20h; } colour /= 2.h; //colour.a = 1.0f; return colour; } technique star { pass p0 { VertexProgram = compile vp30 starVP(); FragmentProgram = compile fp40 starFP(); DepthTestEnable = false; DepthMask = false; BlendEnable = false; //BlendFuncSeparate = int4( One , One , One , One ) ; } }