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 -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -