Merged in SL-12574 (pull request #14)

SL-12574

Approved-by: Dave Houlton <euclid@lindenlab.com>
meow-7.2.2
Michael Pohoreski 2020-02-26 00:04:23 +00:00
commit 735859c76e
6 changed files with 49 additions and 50 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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)
{