diff options
author | RunitaiLinden <davep@lindenlab.com> | 2023-04-05 11:55:51 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-05 11:55:51 -0500 |
commit | 1f79379bf215c5368337c64b4f72c7c9ef3e09c2 (patch) | |
tree | 0864f4005090f49a59c0eabca3bd7760b5c1cf5e /indra/newview/pipeline.cpp | |
parent | d6d634d29ff351450306e211982a98a0050f1b42 (diff) |
SL-19538 Followup -- tune exposure parameters and clamp local light ambiance. Make render targets 16F and scrube NaNs (thanks Rye). Update midday. (#154)
Diffstat (limited to 'indra/newview/pipeline.cpp')
-rw-r--r-- | indra/newview/pipeline.cpp | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 11deff5bff..1222613c66 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -796,7 +796,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) if (!mRT->deferredScreen.allocate(resX, resY, GL_RGBA, true)) return false; if (!addDeferredAttachments(mRT->deferredScreen)) return false; - GLuint screenFormat = GL_RGBA16; + GLuint screenFormat = GL_RGBA16F; if (!mRT->screen.allocate(resX, resY, screenFormat)) return false; @@ -813,7 +813,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples) if (shadow_detail > 0 || ssao || RenderDepthOfField || samples > 0) { //only need mRT->deferredLight for shadows OR ssao OR dof OR fxaa - if (!mRT->deferredLight.allocate(resX, resY, GL_RGBA16)) return false; + if (!mRT->deferredLight.allocate(resX, resY, GL_RGBA16F)) return false; } else { @@ -5631,6 +5631,14 @@ void LLPipeline::setupHWLights() return; } + F32 light_scale = 1.f; + + if (gCubeSnapshot) + { //darken local lights when probe ambiance is above 1 + light_scale = mReflectionMapManager.mLightScale; + } + + LLEnvironment& environment = LLEnvironment::instance(); LLSettingsSky::ptr_t psky = environment.getCurrentSky(); @@ -5730,7 +5738,7 @@ void LLPipeline::setupHWLights() } //send linear light color to shader - LLColor4 light_color = light->getLightLinearColor(); + LLColor4 light_color = light->getLightLinearColor() * light_scale; light_color.mV[3] = 0.0f; F32 fade = iter->fade; @@ -7277,6 +7285,7 @@ void LLPipeline::renderFinalize() gExposureProgram.bind(); + S32 channel = 0; channel = gExposureProgram.enableTexture(LLShaderMgr::DEFERRED_DIFFUSE); if (channel > -1) @@ -7296,11 +7305,17 @@ void LLPipeline::renderFinalize() mLastExposure.bindTexture(0, channel); } + static LLCachedControl<F32> dynamic_exposure_coefficient(gSavedSettings, "RenderDynamicExposureCoefficient", 0.175f); + static LLCachedControl<F32> dynamic_exposure_min(gSavedSettings, "RenderDynamicExposureMin", 0.125f); + static LLCachedControl<F32> dynamic_exposure_max(gSavedSettings, "RenderDynamicExposureMax", 1.3f); + static LLStaticHashedString dt("dt"); static LLStaticHashedString noiseVec("noiseVec"); + static LLStaticHashedString dynamic_exposure_params("dynamic_exposure_params"); gExposureProgram.uniform1f(dt, gFrameIntervalSeconds); gExposureProgram.uniform2f(noiseVec, ll_frand() * 2.0 - 1.0, ll_frand() * 2.0 - 1.0); - + gExposureProgram.uniform3f(dynamic_exposure_params, dynamic_exposure_coefficient, dynamic_exposure_min, dynamic_exposure_max); + mScreenTriangleVB->setBuffer(); mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3); @@ -7876,6 +7891,13 @@ void LLPipeline::renderDeferredLighting() llassert(!sRenderingHUDs); + F32 light_scale = 1.f; + + if (gCubeSnapshot) + { //darken local lights when probe ambiance is above 1 + light_scale = mReflectionMapManager.mLightScale; + } + LLRenderTarget *screen_target = &mRT->screen; LLRenderTarget* deferred_light_target = &mRT->deferredLight; @@ -8032,9 +8054,13 @@ void LLPipeline::renderDeferredLighting() LL_PROFILE_GPU_ZONE("atmospherics"); bindDeferredShader(soften_shader); + static LLCachedControl<F32> sky_scale(gSavedSettings, "RenderSkyHDRScale", 1.f); + static LLStaticHashedString sky_hdr_scale("sky_hdr_scale"); + LLEnvironment &environment = LLEnvironment::instance(); soften_shader.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0); soften_shader.uniform3fv(LLShaderMgr::LIGHTNORM, 1, environment.getClampedLightNorm().mV); + soften_shader.uniform1f(sky_hdr_scale, sky_scale); soften_shader.uniform4fv(LLShaderMgr::WATER_WATERPLANE, 1, LLDrawPoolAlpha::sWaterPlane.mV); @@ -8111,7 +8137,7 @@ void LLPipeline::renderDeferredLighting() F32 s = volume->getLightRadius() * 1.5f; // send light color to shader in linear space - LLColor3 col = volume->getLightLinearColor(); + LLColor3 col = volume->getLightLinearColor() * light_scale; if (col.magVecSquared() < 0.001f) { @@ -8205,7 +8231,7 @@ void LLPipeline::renderDeferredLighting() setupSpotLight(gDeferredSpotLightProgram, drawablep); // send light color to shader in linear space - LLColor3 col = volume->getLightLinearColor(); + LLColor3 col = volume->getLightLinearColor() * light_scale; gDeferredSpotLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, c); gDeferredSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s); @@ -8280,7 +8306,7 @@ void LLPipeline::renderDeferredLighting() setupSpotLight(gDeferredMultiSpotLightProgram, drawablep); // send light color to shader in linear space - LLColor3 col = volume->getLightLinearColor(); + LLColor3 col = volume->getLightLinearColor() * light_scale; gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, tc.v); gDeferredMultiSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, light_size_final); |