ebruneton / precomputed_atmospheric_scattering

This project provides a new implementation of our EGSR 2008 paper "Precomputed Atmospheric Scattering".
BSD 3-Clause "New" or "Revised" License
922 stars 121 forks source link

Improve numerical robustness when extrapolating mie scattering #36

Closed Ralith closed 4 years ago

Ralith commented 4 years ago

Resolves sparkling artifacts that can arise under certain configurations when the sun is at the horizon and occluded by geometry very close to the viewpoint.

Rounding errors can cause the scattering value passed in by the final call to GetExtrapolatedSingleMieScattering made by GetSkyRadianceToPoint to have a very small negative r channel, which resulted in dramatically amplifying the returned value rather than clamping it to zero. By being slightly more tolerant in the existing sanity-check on the function, we can prevent this for free.

Hooray for renderdoc's shiny new shader debugging tools!