Re:0.30000000000000004
by daniel-thompson on Monday December 02, 2019 @04:40PM
(#21687285)
Here's some good reading on robust ways to fix this without an arbitrary epsilon bump: http://www.pbr-book.org/3ed-2018/Shapes/Managing_Rounding_Er...
This phenomenon has a name, by the way: "shadow acne" (which is actually a more general phenomenon, but this is an example of it).
Re:0.30000000000000004
by munchbunny on Monday December 02, 2019 @04:04PM
(#21686923)
That's really interesting - hadn't thought of that before. To fix that, would you be able to do a square of the magnitude comparison with the radius and just bump the borderline cases, or is it more efficient without the extra branching?
I just did it across the board; since the error is in the floating-point noise I don't know if I'd even trust a comparison on that. Plus, the discrepancy between "bumped" and "unbumped" samples might cause some visible artifacts.
Direct3D used to have a Z-bias for a similar problem: rendering pictures hanging on walls at a far Z depth. Their whql tests even tested for it.
It was fun discovering all the corner cases while debugging drivers.
And then of course there have been several other "x.abs() < 0.01" cases for various purposes. So I could definitely see that being an interesting experiment.