when writing pixel shaders with if statements on the current co-ords
(e.g. if (PosW.x>0) col.a=0) then i get a hard edge which won’t anti-alias
anyone got any ideas of how to get around this (without replacing if statement with a smooth function?)
there is no easy solution. as the pixelsahder code is executed for single pixels, a pixel is either in the range or not. writing a smooth function is one way, another would be to calculate the state of the neighbour pixels and do an interpolation or messing around with the ddx and ddy functions…
i guess filter kernel operations are what you looking for.(eg for a smoothing function) so you caclculate your operation for a matrix of pixels around your point of interest. if you want to magnify egdes youll need something like a highpass filter. i think there are some shaders around using that kind of technique.
thanks for the replies
so does anti-aliasing only run at the rasterising stage then?
I think i’ll probably go for a smoothstep function linked to ddx/y
bah, no easy way out!