|
|
|
|
|
by NohatCoder
318 days ago
|
|
Reminds me that I found an alternative way of sampling an SDF: First take a sample in each corner of the pixel to be rendered (s1 s2 s3 s4), then compute: coverage=0.5 + (s1+s2+s3+s4)/(abs(s1)+abs(s2)+abs(s3)+abs(s4))/2
It is a good approximation, and it keeps on working no matter how you scale and stretch the field.Relative to the standard method it is expensive to calculate. But for a modern GPU it is still a very light workload to do this once per screen pixel. |
|
It is indeed scale invariant but I think you can do better, you should have enough to make it invariant to any linear transformation. The calculation will be more complex but that is nothing compared to evaluating the SDF