//****************************************************************** //FUNCTION: void COutdoorLightScattering::computeInscatteringIntegral(vec3f vRayStart, vec3f vRayEnd, vec3f vEarthCentre, vec3f vDirOnLight, vec2f& voNetParticleFromCam, vec3f& voRayleighInscattering, vec3f& voMieInscattering, const float vNumSteps /*= 7*/) { voNetParticleFromCam[0] = voNetParticleFromCam[1] = 0.0; voRayleighInscattering[0] = voRayleighInscattering[1] = voRayleighInscattering[2] = 0.0; voMieInscattering[0] = voMieInscattering[1] = voMieInscattering[2] = 0.0; normalizeVector(vDirOnLight); computeScatteringCoefficients(); vec3f Steps = (vRayEnd - vRayStart) / vNumSteps; float StepLen = sqrt(Steps[0]*Steps[0] + Steps[1]*Steps[1] + Steps[2]*Steps[2]); for (float StepNum = 0.5; StepNum < vNumSteps; StepNum += 1.0) { vec3f CurrPos = vRayStart + Steps * StepNum; vec2f ParticleDensity, NetParticleDensityToAtmTop; __getAtmosphereProperties(CurrPos, vEarthCentre, vDirOnLight, ParticleDensity, NetParticleDensityToAtmTop); NetParticleDensityToAtmTop = __IntegrateParticleDensityAlongRay(CurrPos, vDirOnLight, vEarthCentre); voNetParticleFromCam += ParticleDensity * StepLen; vec3f RlghInsctr, MieInsctr; RlghInsctr[0] = RlghInsctr[1] = RlghInsctr[2] = 0.0; MieInsctr[0] = MieInsctr[1] = MieInsctr[2] = 0.0; __computePointDiffInscattering(ParticleDensity, voNetParticleFromCam, NetParticleDensityToAtmTop, RlghInsctr, MieInsctr); voRayleighInscattering += RlghInsctr * StepLen; voMieInscattering += MieInsctr * StepLen; } float CosBetha = computeCosBetha(vRayStart - vRayEnd, vDirOnLight); __applyPhaseFunction(voRayleighInscattering, voMieInscattering, CosBetha); vec3f LightInScattering = voRayleighInscattering + voMieInscattering; }
RenderSetting::RenderSetting() noexcept : window(nullptr) , width(0) , height(0) , dpi_w(0) , dpi_h(0) , deviceType(GraphicsDeviceType::GraphicsDeviceTypeOpenGL) , swapInterval(GraphicsSwapInterval::GraphicsSwapIntervalVsync) , pipelineType(RenderPipelineType::RenderPipelineTypeDeferredLighting) , shadowMode(ShadowMode::ShadowModeSoft) , shadowQuality(ShadowQuality::ShadowQualityMedium) , enableSSDO(true) , enableAtmospheric(false) , enableSSR(false) , enableSSSS(false) , enableLightShaft(false) , enableDOF(false) , enableMotionBlur(false) , enableHDR(true) , enableColorGrading(false) , enableFXAA(true) , enableGlobalIllumination(false) , earthRadius(6360000.f, 6440000.f) , earthScaleHeight(7994.f, 2000.f) , minElevation(0.0f) , maxElevation(80000.0f) , rayleighAngularSctrCoeff(0) , rayleighExtinctionCoeff(0) , mieAngularSctrCoeff(0) , mieExtinctionCoeff(0) , mie(0.97f) , density(1.0f) { computeScatteringCoefficients(); }