0

I'm currently having a pixel shader:

float4 PixelShaderFunction(float2 coords: TEXCOORD0) : COLOR0   
{

float4 color = tex2D(Sampler0,coords);
float dx = coords.x - 0.5f;
float dy = coords.y - 0.5f;

float tpos = dx * dx + dy * dy;
if(tpos <= 0.25f && tpos > 0.25f-width )
    return color;
else
    return float4(0.0f, 0.0f, 0.0f, 0.0f);
}

This way I am able to draw a circle. But how do I cut the circle, e.g. draw 30 degrees circle? Or 60 degrees one? Thanks.

1 Answers1

1

I would suggest to use the intrinsic atan2 (doc)(wiki) to compute the angle of your fragment in relation to the circle center and then do a clipping like your distance clipping.

Gnietschow
  • 3,070
  • 1
  • 18
  • 28