summaryrefslogtreecommitdiffstats
path: root/PostProcess/EpipolarLightScattering/src/EpipolarLightScattering.cpp
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-08-26 05:44:34 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-08-26 05:44:34 +0000
commitd4903eb8f5c018ad6813e04b0ad237cf5f692f67 (patch)
treeb33703efea66b81ef128638fdeda9abf31b5e81b /PostProcess/EpipolarLightScattering/src/EpipolarLightScattering.cpp
parentEpipolar scattering FX: added Ozone approximation that fixes yellow-green sky (diff)
downloadDiligentFX-d4903eb8f5c018ad6813e04b0ad237cf5f692f67.tar.gz
DiligentFX-d4903eb8f5c018ad6813e04b0ad237cf5f692f67.zip
Light scattering FX: added custom Ozone absorption coefficient
Diffstat (limited to 'PostProcess/EpipolarLightScattering/src/EpipolarLightScattering.cpp')
-rw-r--r--PostProcess/EpipolarLightScattering/src/EpipolarLightScattering.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/PostProcess/EpipolarLightScattering/src/EpipolarLightScattering.cpp b/PostProcess/EpipolarLightScattering/src/EpipolarLightScattering.cpp
index 74ae2de..98308e3 100644
--- a/PostProcess/EpipolarLightScattering/src/EpipolarLightScattering.cpp
+++ b/PostProcess/EpipolarLightScattering/src/EpipolarLightScattering.cpp
@@ -2235,8 +2235,9 @@ void EpipolarLightScattering::PrepareForNewFrame(FrameAttribs&
m_PostProcessingAttribs.fAerosolDensityScale != PPAttribs.fAerosolDensityScale ||
m_PostProcessingAttribs.fAerosolAbsorbtionScale != PPAttribs.fAerosolAbsorbtionScale ||
(PPAttribs.bUseCustomSctrCoeffs &&
- (m_PostProcessingAttribs.f4CustomRlghBeta != PPAttribs.f4CustomRlghBeta ||
- m_PostProcessingAttribs.f4CustomMieBeta != PPAttribs.f4CustomMieBeta) );
+ (m_PostProcessingAttribs.f4CustomRlghBeta != PPAttribs.f4CustomRlghBeta ||
+ m_PostProcessingAttribs.f4CustomMieBeta != PPAttribs.f4CustomMieBeta ||
+ m_PostProcessingAttribs.f4CustomOzoneAbsorption != PPAttribs.f4CustomOzoneAbsorption) );
// clang-format on
m_PostProcessingAttribs = PPAttribs;
@@ -2624,20 +2625,27 @@ void EpipolarLightScattering::ComputeScatteringCoefficients(IDeviceContext* pDev
f4RayleighExtinctionCoeff = f4TotalRayleighSctrCoeff;
}
- if (m_PostProcessingAttribs.bUseOzoneApproximation && !m_PostProcessingAttribs.bUseCustomSctrCoeffs)
+ if (m_PostProcessingAttribs.bUseOzoneApproximation)
{
// As noted in [1], taking into account ozone particle absorption is essential to reproduce
// the blue of the zenith sky. Without ozone, the sky can appear too yellow overall, especially
// at sunset/sunrise. Ozone should be concentrated 32km up in the sky, however the author suggests
// to use the same distribution as the Rayleigh particle distribution, which allows simply adding
- // ozone absorption to Rayleigh absorption.
+ // ozone absorption to Rayleigh extinction.
//
// 1. Physically Based Sky, Atmosphere and Cloud Rendering in Frostbite, Sebastien Hillaire
// (Physically-Based Shading in Theory and Practice, Siggraph 2016)
- // Add Ozone absorption coefficients from [1] to total Rayleigh extinction coefficient
- const float4 f4OzoneAbsorption = float4{3.426f, 8.298f, 0.356f, 0.f} * 6e-7f;
- m_MediaParams.f4RayleighExtinctionCoeff += f4OzoneAbsorption;
+ if (m_PostProcessingAttribs.bUseCustomSctrCoeffs)
+ {
+ m_MediaParams.f4RayleighExtinctionCoeff += m_PostProcessingAttribs.f4CustomOzoneAbsorption;
+ }
+ else
+ {
+ // Add Ozone absorption coefficients from [1] to total Rayleigh extinction coefficient
+ const float4 f4OzoneAbsorption = float4{3.426f, 8.298f, 0.356f, 0.f} * 6e-7f;
+ m_MediaParams.f4RayleighExtinctionCoeff += f4OzoneAbsorption;
+ }
}
// Calculate angular and total scattering coefficients for Mie scattering: