diff options
author | Michael Pohoreski <ptolemy@lindenlab.com> | 2020-02-26 00:04:23 +0000 |
---|---|---|
committer | Michael Pohoreski <ptolemy@lindenlab.com> | 2020-02-26 00:04:23 +0000 |
commit | 735859c76ed7cfa0d5ceffb8dfc0230bf8de3d7d (patch) | |
tree | d369e78d0ab5b407f1186373a642207f0e4917f9 | |
parent | 9d9b8901e4cb8f3e3d5eaf5beb76de6b00ec75e3 (diff) | |
parent | c4c8d2017494dc1e673b2cb09f031a1715efa0af (diff) |
Merged in SL-12574 (pull request #14)
SL-12574
Approved-by: Dave Houlton <euclid@lindenlab.com>
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl | 8 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl | 8 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/shader_hierarchy.txt | 6 | ||||
-rw-r--r-- | indra/newview/lllegacyatmospherics.cpp | 16 | ||||
-rw-r--r-- | indra/newview/llvosky.cpp | 59 | ||||
-rw-r--r-- | indra/newview/llvosky.h | 2 |
6 files changed, 49 insertions, 50 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index b1dce665a1..705cc2f04e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -81,11 +81,7 @@ void main() norm.xyz = getNorm(tc); vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir; - float da = dot(normalize(norm.xyz), light_dir.xyz); - da = clamp(da, -1.0, 1.0); - - float final_da = da; - final_da = clamp(final_da, 0.0, 1.0); + float da = clamp(dot(normalize(norm.xyz), light_dir.xyz), 0.0, 1.0); vec4 diffuse_srgb = texture2DRect(diffuseRect, tc); vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a); @@ -108,7 +104,7 @@ void main() ambient *= ambient; ambient = (1.0 - ambient); - vec3 sun_contrib = final_da * sunlit; + vec3 sun_contrib = da * sunlit; #if !defined(AMBIENT_KILL) color.rgb = amblit; diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index f49fad5517..593706867d 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -85,11 +85,7 @@ void main() float scol = 1.0; vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg; - float da = dot(normalize(norm.xyz), light_dir.xyz); - da = clamp(da, -1.0, 1.0); - - float final_da = da; - final_da = clamp(final_da, 0.0, 1.0); + float da = clamp(dot(normalize(norm.xyz), light_dir.xyz), 0.0, 1.0); vec4 diffuse_srgb = texture2DRect(diffuseRect, tc); vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a); @@ -116,7 +112,7 @@ void main() ambient *= ambient; ambient = (1.0 - ambient); - vec3 sun_contrib = min(scol, final_da) * sunlit; + vec3 sun_contrib = min(scol, da) * sunlit; #if !defined(AMBIENT_KILL) color.rgb = amblit; diff --git a/indra/newview/app_settings/shaders/shader_hierarchy.txt b/indra/newview/app_settings/shaders/shader_hierarchy.txt index ebccaddd55..8ef04d8e1f 100644 --- a/indra/newview/app_settings/shaders/shader_hierarchy.txt +++ b/indra/newview/app_settings/shaders/shader_hierarchy.txt @@ -1,3 +1,9 @@ +Class 3 is highest quality / lowest performance +Class 2 is medium quality / medium performance +Class 1 is lowest quality / highest performance + +Shaders WILL fall back to "lower" classes for functionality. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ avatar/avatarV.glsl - gAvatarProgram, gAvatarWaterProgram main() - avatar/avatarV.glsl diff --git a/indra/newview/lllegacyatmospherics.cpp b/indra/newview/lllegacyatmospherics.cpp index 165ef8c797..e061b3ad17 100644 --- a/indra/newview/lllegacyatmospherics.cpp +++ b/indra/newview/lllegacyatmospherics.cpp @@ -208,23 +208,25 @@ LLColor4 LLAtmospherics::calcSkyColorInDir(AtmosphericsVars& vars, const LLVecto return calcSkyColorInDir(psky, vars, dir, isShiny); } +// This cubemap is used as "environmentMap" in indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl LLColor4 LLAtmospherics::calcSkyColorInDir(const LLSettingsSky::ptr_t &psky, AtmosphericsVars& vars, const LLVector3 &dir, bool isShiny) { - F32 saturation = 0.3f; + F32 sky_saturation = 0.25f; + F32 land_saturation = 0.1f; if (isShiny && dir.mV[VZ] < -0.02f) { LLColor4 col; LLColor3 desat_fog = LLColor3(mFogColor); - F32 brightness = desat_fog.brightness(); + F32 brightness = desat_fog.brightness();// NOTE: Linear brightness! // So that shiny somewhat shows up at night. if (brightness < 0.15f) { brightness = 0.15f; desat_fog = smear(0.15f); } - F32 greyscale_sat = brightness * (1.0f - saturation); - desat_fog = desat_fog * saturation + smear(greyscale_sat); + F32 greyscale_sat = brightness * (1.0f - land_saturation); + desat_fog = desat_fog * land_saturation + smear(greyscale_sat); if (!gPipeline.canUseWindLightShaders()) { col = LLColor4(desat_fog, 0.f); @@ -250,9 +252,9 @@ LLColor4 LLAtmospherics::calcSkyColorInDir(const LLSettingsSky::ptr_t &psky, Atm if (isShiny) { F32 brightness = vars.hazeColor.brightness(); - F32 greyscale_sat = brightness * (1.0f - saturation); - LLColor3 sky_color = vars.hazeColor * saturation + smear(greyscale_sat); - sky_color *= (0.5f + 0.5f * brightness); + F32 greyscale_sat = brightness * (1.0f - sky_saturation); + LLColor3 sky_color = vars.hazeColor * sky_saturation + smear(greyscale_sat); + //sky_color *= (0.5f + 0.5f * brightness); // SL-12574 EEP sky was too dark dark grey/blue, lighten it slightly return LLColor4(sky_color, 0.0f); } diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 64f34eb619..943704c8de 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -190,9 +190,8 @@ void LLSkyTex::initEmpty(const S32 tex) createGLImage(tex); } -void LLSkyTex::create(const F32 brightness) +void LLSkyTex::create() { - /// Brightness ignored for now. U8* data = mImageRaw[sCurrent]->getData(); for (S32 i = 0; i < sResolution; ++i) { @@ -502,8 +501,8 @@ void LLVOSky::init() initSkyTextureDirs(side, tile); createSkyTexture(m_atmosphericsVars, side, tile); } - mSkyTex[side].create(1.0f); - mShinyTex[side].create(1.0f); + mSkyTex[side].create(); + mShinyTex[side].create(); } initCubeMap(); @@ -699,20 +698,20 @@ bool LLVOSky::updateSky() LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); if (mDead || !(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY))) -{ + { return TRUE; -} + } if (mDead) -{ + { // It's dead. Don't update it. return TRUE; -} + } if (gGLManager.mIsDisabled) -{ + { return TRUE; -} + } static S32 next_frame = 0; const S32 total_no_tiles = NUM_CUBEMAP_FACES * NUM_TILES; @@ -744,15 +743,15 @@ bool LLVOSky::updateSky() mNeedUpdate = mNeedUpdate || !same_atmospherics; if (mNeedUpdate && (mForceUpdateThrottle.hasExpired() || mForceUpdate)) -{ + { // start updating cube map sides updateFog(LLViewerCamera::getInstance()->getFar()); mCubeMapUpdateStage = 0; mForceUpdate = FALSE; - } - } + } + } else if (mCubeMapUpdateStage == NUM_CUBEMAP_FACES) - { + { LL_RECORD_BLOCK_TIME(FTM_VOSKY_UPDATEFORCED); LLSkyTex::stepCurrent(); @@ -764,35 +763,35 @@ bool LLVOSky::updateSky() { LLImageRaw* raw1 = nullptr; LLImageRaw* raw2 = nullptr; - + if (!is_alm_wl_sky) - { + { raw1 = mSkyTex[side].getImageRaw(TRUE); raw2 = mSkyTex[side].getImageRaw(FALSE); raw2->copy(raw1); mSkyTex[side].createGLImage(tex); - } + } raw1 = mShinyTex[side].getImageRaw(TRUE); raw2 = mShinyTex[side].getImageRaw(FALSE); raw2->copy(raw1); mShinyTex[side].createGLImage(tex); -} + } next_frame = 0; // update the sky texture if (!is_alm_wl_sky) { for (S32 i = 0; i < NUM_CUBEMAP_FACES; ++i) -{ - mSkyTex[i].create(1.0f); + { + mSkyTex[i].create(); } - } + } for (S32 i = 0; i < NUM_CUBEMAP_FACES; ++i) - { - mShinyTex[i].create(1.0f); - } + { + mShinyTex[i].create(); + } // update the environment map initCubeMap(); @@ -806,9 +805,9 @@ bool LLVOSky::updateSky() gPipeline.markRebuild(gSky.mVOGroundp->mDrawable, LLDrawable::REBUILD_ALL, TRUE); if (mDrawable.notNull() && mDrawable->getFace(0) && !mDrawable->getFace(0)->getVertexBuffer()) - { - gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE); - } + { + gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE); + } mCubeMapUpdateStage = -1; } // run 0 to 5 faces, each face in own frame @@ -822,11 +821,11 @@ bool LLVOSky::updateSky() // (i.e. potentially can be made per tile again, can be moved to thread // instead of executing per face, or may be can be moved to shaders) for (S32 tile = 0; tile < NUM_TILES; tile++) - { + { createSkyTexture(m_atmosphericsVars, side, tile); - } + } mCubeMapUpdateStage++; - } + } return TRUE; } diff --git a/indra/newview/llvosky.h b/indra/newview/llvosky.h index fc577ab5f8..39e42bbb24 100644 --- a/indra/newview/llvosky.h +++ b/indra/newview/llvosky.h @@ -78,7 +78,7 @@ protected: void initEmpty(const S32 tex); - void create(F32 brightness); + void create(); void setDir(const LLVector3 &dir, const S32 i, const S32 j) { |