HLSL: Cut a texture radially -


i'm having 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 able draw circle. how cut circle, e.g. draw 30 degrees circle? or 60 degrees one? thanks.

i suggest use intrinsic atan2 (doc)(wiki) compute angle of fragment in relation circle center , clipping distance clipping.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -