Closed toastedcrumpets closed 5 years ago
OK, after a play around I'm a bit stumped. I can see you already worked around cancellation when calculating the discriminant, but I seem to have some numerical error implementing the second quadratic formula. I'll play around some more, but if you can shed any insight it would be welcome
You can leave kLengthUnitInMeters to 1000.0 to avoid artifacts, and use a different length unit for your scene. In this case, you just need to convert from your scene unit to kilometers when calling the atmosphere functions (GetSkyRadiance, GetSkyRadianceToPoint and GetSunAndSkyIrradiance - for the 'camera', 'p' / 'point' and 'shadow_length' parameters).
Thank you for the idea! I'll give it a test later this week when I'm back working on VR and report.
Hi, I was playing around with this code in a VR rendering and I noticed that I get artifacts if I set the scale (kLengthUnitInMeters) to be 1m (to give realistic scales for earth). From experience, these artifacts seem to be from catastrophic cancellation in your shader routines when you calculate the intersection distance using the quadratic formula.
I'm currently pulling together a patch set to fix this, but I'm posting this issue first to check if you have any comment about this: i.e, are you already aware of this and is there something more that needs work that I've overlooked?