diff options
author | Rider Linden <rider@lindenlab.com> | 2018-11-20 11:00:18 -0800 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2018-11-20 11:00:18 -0800 |
commit | 6c8eebf76209489010694a4e0af8d911e9606498 (patch) | |
tree | de1b57f8f97d184cc64a837c22cc7b355949af16 | |
parent | 29130c5483146d4d27272ef12e986520778ca2c8 (diff) | |
parent | db424c0de3e3803155f0c18376466e8e57beba58 (diff) |
Merge
21 files changed, 281 insertions, 254 deletions
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index f21cca34a6..ace530ae54 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -37,8 +37,8 @@ namespace { const F32 NIGHTTIME_ELEVATION = -8.0f; // degrees const F32 NIGHTTIME_ELEVATION_SIN = (F32)sinf(NIGHTTIME_ELEVATION * DEG_TO_RAD); const LLUUID IMG_BLOOM1("3c59f7fe-9dc8-47f9-8aaf-a9dd1fbc3bef"); - const LLUUID IMG_RAINBOW("12149143-f599-91a7-77ac-b52a3c0f59cd"); - const LLUUID IMG_HALO("11b4c57c-56b3-04ed-1f82-2004363882e4"); + const LLUUID IMG_RAINBOW("11b4c57c-56b3-04ed-1f82-2004363882e4"); + const LLUUID IMG_HALO("12149143-f599-91a7-77ac-b52a3c0f59cd"); } namespace { diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index ae91567334..3a80ff0144 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -196,6 +196,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) } } +#if USE_DEFERRED_SHADER_API if (features->isDeferred || features->hasShadows) { if (!shader->attachObject("deferred/deferredUtil.glsl")) @@ -211,6 +212,7 @@ BOOL LLShaderMgr::attachShaderFeatures(LLGLSLShader * shader) return FALSE; } } +#endif if (features->hasGamma) { diff --git a/indra/llui/llxyvector.cpp b/indra/llui/llxyvector.cpp index 9d5823e368..08dedc157b 100644 --- a/indra/llui/llxyvector.cpp +++ b/indra/llui/llxyvector.cpp @@ -37,6 +37,8 @@ #include "lluictrlfactory.h" #include "llrender.h" +#include "llmath.h" + // Globals static LLDefaultChildRegistry::Register<LLXYVector> register_xy_vector("xy_vector"); @@ -63,7 +65,8 @@ LLXYVector::Params::Params() arrow_color("arrow_color", LLColor4::white), ghost_color("ghost_color"), area_color("area_color", LLColor4::grey4), - grid_color("grid_color", LLColor4::grey % 0.25f) + grid_color("grid_color", LLColor4::grey % 0.25f), + logarithmic("logarithmic", FALSE) { } @@ -77,7 +80,8 @@ LLXYVector::LLXYVector(const LLXYVector::Params& p) mIncrementX(p.increment_x), mMinValueY(p.min_val_y), mMaxValueY(p.max_val_y), - mIncrementY(p.increment_y) + mIncrementY(p.increment_y), + mLogarithmic(p.logarithmic) { mGhostColor = p.ghost_color.isProvided() ? p.ghost_color() % 0.3f : p.arrow_color() % 0.3f; @@ -138,6 +142,9 @@ LLXYVector::~LLXYVector() BOOL LLXYVector::postBuild() { + mLogScaleX = (2 * log(mMaxValueX)) / mTouchArea->getRect().getWidth(); + mLogScaleY = (2 * log(mMaxValueY)) / mTouchArea->getRect().getHeight(); + return TRUE; } @@ -165,9 +172,24 @@ void LLXYVector::draw() { S32 centerX = mTouchArea->getRect().getCenterX(); S32 centerY = mTouchArea->getRect().getCenterY(); + S32 pointX; + S32 pointY; + + if (mLogarithmic) + { + pointX = (log(llabs(mValueX) + 1)) / mLogScaleX; + pointX *= (mValueX < 0) ? -1 : 1; + pointX += centerX; - S32 pointX = centerX + (mValueX * mTouchArea->getRect().getWidth() / (2 * mMaxValueX)); - S32 pointY = centerY + (mValueY * mTouchArea->getRect().getHeight() / (2 * mMaxValueY)); + pointY = (log(llabs(mValueY) + 1)) / mLogScaleY; + pointY *= (mValueY < 0) ? -1 : 1; + pointY += centerY; + } + else // linear + { + pointX = centerX + (mValueX * mTouchArea->getRect().getWidth() / (2 * mMaxValueX)); + pointY = centerY + (mValueY * mTouchArea->getRect().getHeight() / (2 * mMaxValueY)); + } // fill gl_rect_2d(mTouchArea->getRect(), mAreaColor, true); @@ -222,22 +244,8 @@ void LLXYVector::setValue(const LLSD& value) void LLXYVector::setValue(F32 x, F32 y) { - x = llclamp(x, mMinValueX, mMaxValueX); - y = llclamp(y, mMinValueY, mMaxValueY); - - // Round the values to nearest increments - x -= mMinValueX; - x += mIncrementX / 2.0001f; - x -= fmod(x, mIncrementX); - x += mMinValueX; - - y -= mMinValueY; - y += mIncrementY / 2.0001f; - y -= fmod(y, mIncrementY); - y += mMinValueY; - - mValueX = x; - mValueY = y; + mValueX = ll_round(llclamp(x, mMinValueX, mMaxValueX), mIncrementX); + mValueY = ll_round(llclamp(y, mMinValueY, mMaxValueY), mIncrementY); update(); } @@ -269,13 +277,23 @@ BOOL LLXYVector::handleHover(S32 x, S32 y, MASK mask) { if (hasMouseCapture()) { - F32 valueX = F32(x - mTouchArea->getRect().getCenterX()) / mTouchArea->getRect().getWidth(); - F32 valueY = F32(y - mTouchArea->getRect().getCenterY()) / mTouchArea->getRect().getHeight(); - - valueX *= 2 * mMaxValueX; - valueY *= 2 * mMaxValueY; - - setValueAndCommit(valueX, valueY); + if (mLogarithmic) + { + F32 valueX = llfastpow(F_E, mLogScaleX*(llabs(x - mTouchArea->getRect().getCenterX()))) - 1; + valueX *= (x < mTouchArea->getRect().getCenterX()) ? -1 : 1; + + F32 valueY = llfastpow(F_E, mLogScaleY*(llabs(y - mTouchArea->getRect().getCenterY()))) - 1; + valueY *= (y < mTouchArea->getRect().getCenterY()) ? -1 : 1; + + setValueAndCommit(valueX, valueY); + } + else //linear + { + F32 valueX = 2 * mMaxValueX * F32(x - mTouchArea->getRect().getCenterX()) / mTouchArea->getRect().getWidth(); + F32 valueY = 2 * mMaxValueY * F32(y - mTouchArea->getRect().getCenterY()) / mTouchArea->getRect().getHeight(); + + setValueAndCommit(valueX, valueY); + } } return TRUE; diff --git a/indra/llui/llxyvector.h b/indra/llui/llxyvector.h index 4d67db3251..bb3822dd26 100644 --- a/indra/llui/llxyvector.h +++ b/indra/llui/llxyvector.h @@ -59,6 +59,7 @@ public: Optional<LLUIColor> ghost_color; Optional<LLUIColor> area_color; Optional<LLUIColor> grid_color; + Optional<BOOL> logarithmic; Params(); }; @@ -112,6 +113,9 @@ private: LLUIColor mAreaColor; LLUIColor mGridColor; + BOOL mLogarithmic; + F32 mLogScaleX; + F32 mLogScaleY; }; #endif diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl index b810bb4fd1..43f0034874 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl @@ -86,6 +86,8 @@ vec4 getPosition(vec2 pos_screen) return pos; } +#if USE_DEFERRED_SHADER_API + vec4 getPositionWithDepth(vec2 pos_screen, float depth) { vec2 sc = getScreenCoordinate(pos_screen); @@ -285,3 +287,5 @@ float calcAmbientOcclusion(vec4 pos, vec3 norm, vec2 pos_screen) return min(ret, 1.0); } +#endif + diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl index cbc19bbba3..8791469675 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl @@ -45,7 +45,7 @@ vec3 linear_to_srgb(vec3 cl); void main() { vec4 diff = texture2DRect(diffuseRect, vary_fragcoord); - diff.rgb = linear_to_srgb(diff.rgb); + diff.rgb = pow(diff.rgb, vec3(display_gamma)); frag_color = diff; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 18259ed9ed..5813dd84ee 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -41,7 +41,7 @@ uniform sampler2DRect normalMap; uniform sampler2DRect lightMap; uniform sampler2DRect depthMap; uniform samplerCube environmentMap; -uniform sampler2D lightFunc; +uniform sampler2D lightFunc; uniform float blur_size; uniform float blur_fidelity; @@ -78,114 +78,106 @@ vec3 fullbrightScaleSoftClip(vec3 l); vec4 getPosition_d(vec2 pos_screen, float depth) { - vec2 sc = pos_screen.xy*2.0; - sc /= screen_res; - sc -= vec2(1.0,1.0); - vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); - vec4 pos = inv_proj * ndc; - pos /= pos.w; - pos.w = 1.0; - return pos; + vec2 sc = pos_screen.xy*2.0; + sc /= screen_res; + sc -= vec2(1.0,1.0); + vec4 ndc = vec4(sc.x, sc.y, 2.0*depth-1.0, 1.0); + vec4 pos = inv_proj * ndc; + pos /= pos.w; + pos.w = 1.0; + return pos; } vec4 getPosition(vec2 pos_screen) { //get position in screen space (world units) given window coordinate and depth map - float depth = texture2DRect(depthMap, pos_screen.xy).a; - return getPosition_d(pos_screen, depth); + float depth = texture2DRect(depthMap, pos_screen.xy).a; + return getPosition_d(pos_screen, depth); } void main() { - vec2 tc = vary_fragcoord.xy; - float depth = texture2DRect(depthMap, tc.xy).r; - vec3 pos = getPosition_d(tc, depth).xyz; - vec4 norm = texture2DRect(normalMap, tc); - float envIntensity = norm.z; - norm.xyz = decode_normal(norm.xy); // unpack norm - - float da = dot(norm.xyz, sun_dir.xyz); - - float final_da = max(0.0,da); - final_da = min(final_da, 1.0f); - -// why an ad hoc gamma boost here? srgb_to_linear instead? - final_da = pow(final_da, 1.0/1.3); - - vec4 diffuse = texture2DRect(diffuseRect, tc); - - //convert to gamma space - diffuse.rgb = linear_to_srgb(diffuse.rgb); - - vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); - vec3 col; - float bloom = 0.0; - { + vec2 tc = vary_fragcoord.xy; + float depth = texture2DRect(depthMap, tc.xy).r; + vec3 pos = getPosition_d(tc, depth).xyz; + vec4 norm = texture2DRect(normalMap, tc); + float envIntensity = norm.z; + norm.xyz = decode_normal(norm.xy); // unpack norm + + float da = dot(norm.xyz, sun_dir.xyz); + + float final_da = clamp(da, 0.0, 1.0); + final_da = pow(final_da, 1.0/1.3); + + vec4 diffuse = texture2DRect(diffuseRect, tc); + + //convert to gamma space + diffuse.rgb = linear_to_srgb(diffuse.rgb); + + vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy); + vec3 col; + float bloom = 0.0; + { vec3 sunlit; vec3 amblit; vec3 additive; vec3 atten; - calcFragAtmospherics(pos.xyz, 1.0, sunlit, amblit, additive, atten); - - float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0); - ambient *= 0.5; - ambient *= ambient; - ambient = (1.0 - ambient); - - col = amblit; + calcFragAtmospherics(pos.xyz, 1.0, sunlit, amblit, additive, atten); + + float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0); + ambient *= 0.5; + ambient *= ambient; + ambient = (1.0 - ambient); + + col = amblit; col *= ambient; - col += (final_da * sunlit); - col *= diffuse.rgb; - - vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); - - if (spec.a > 0.0) // specular reflection - { - // the old infinite-sky shiny reflection - // - - float sa = dot(refnormpersp, sun_dir.xyz); - vec3 dumbshiny = sunlit*(texture2D(lightFunc, vec2(sa, spec.a)).r); - - // add the two types of shiny together - vec3 spec_contrib = dumbshiny * spec.rgb; - bloom = dot(spec_contrib, spec_contrib) / 6; - col += spec_contrib; - } - - - col = mix(col.rgb, diffuse.rgb, diffuse.a); - - if (envIntensity > 0.0) - { //add environmentmap - vec3 env_vec = env_mat * refnormpersp; - - - vec3 refcol = textureCube(environmentMap, env_vec).rgb; - - col = mix(col.rgb, refcol, - envIntensity); - } - - if (norm.w < 0.5) - { - col = mix(atmosFragLighting(col, additive, atten), fullbrightAtmosTransportFrag(col, additive, atten), diffuse.a); - col = mix(scaleSoftClip(col), fullbrightScaleSoftClip(col), diffuse.a); - } - - #ifdef WATER_FOG - vec4 fogged = applyWaterFogView(pos.xyz,vec4(col, bloom)); - col = fogged.rgb; - bloom = fogged.a; - #endif - - col = srgb_to_linear(col); - - //col = vec3(1,0,1); - //col.g = envIntensity; - } - - frag_color.rgb = col.rgb; - frag_color.a = bloom; + col += (final_da * sunlit); + col *= diffuse.rgb; + + vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); + + if (spec.a > 0.0) // specular reflection + { + // the old infinite-sky shiny reflection + // + + float sa = dot(refnormpersp, sun_dir.xyz); + vec3 dumbshiny = sunlit*(texture2D(lightFunc, vec2(sa, spec.a)).r); + + // add the two types of shiny together + vec3 spec_contrib = dumbshiny * spec.rgb; + bloom = dot(spec_contrib, spec_contrib) / 6; + col += spec_contrib; + } + + col = mix(col.rgb, diffuse.rgb, diffuse.a); + + if (envIntensity > 0.0) + { //add environmentmap + vec3 env_vec = env_mat * refnormpersp; + vec3 refcol = textureCube(environmentMap, env_vec).rgb; + col = mix(col.rgb, refcol, envIntensity); + } + + if (norm.w < 0.5) + { + col = mix(atmosFragLighting(col, additive, atten), fullbrightAtmosTransportFrag(col, additive, atten), diffuse.a); + col = mix(scaleSoftClip(col), fullbrightScaleSoftClip(col), diffuse.a); + } + + #ifdef WATER_FOG + vec4 fogged = applyWaterFogView(pos.xyz,vec4(col, bloom)); + col = fogged.rgb; + bloom = fogged.a; + #endif + + col = srgb_to_linear(col); + + //col = vec3(1,0,1); + //col.g = envIntensity; + } + + frag_color.rgb = col.rgb; + frag_color.a = bloom; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl index b59fcbe017..e992776cb4 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl @@ -1,5 +1,5 @@ /** - * @file softenLightF.glsl + * @file softenLightV.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl index c1cc3679a7..8b7c4f2ecf 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsF.glsl @@ -32,7 +32,7 @@ vec3 atmosFragAmbient(vec3 light, vec3 sunlit) vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten) { /* stub function for fallback compatibility on class1 hardware */ - return light; + return light; } vec3 atmosFragAffectDirectionalLight(float light, vec3 sunlit) @@ -43,11 +43,11 @@ vec3 atmosFragAffectDirectionalLight(float light, vec3 sunlit) vec3 atmosLighting(vec3 light) { /* stub function for fallback compatibility on class1 hardware */ - return light; + return light; } void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive) { - /* stub function for fallback compatibility on class1 hardware */ + /* stub function for fallback compatibility on class1 hardware */ } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl index c16e3d50a2..10407eeb02 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl @@ -25,25 +25,27 @@ uniform vec4 sunlight_color; uniform vec4 light_ambient; +uniform int no_atmo; vec3 atmosAmbient(vec3 light) { - return light + light_ambient.rgb; + if (no_atmo == 1) return light + vec3(0.66); + return light + light_ambient.rgb; } vec3 atmosAffectDirectionalLight(float lightIntensity) { - return sunlight_color.rgb * lightIntensity; + return sunlight_color.rgb * lightIntensity; } vec3 atmosGetDiffuseSunlightColor() { - return sunlight_color.rgb; + return sunlight_color.rgb; } vec3 scaleDownLight(vec3 light) { - /* stub function for fallback compatibility on class1 hardware */ - return light; + /* stub function for fallback compatibility on class1 hardware */ + return light; } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl index 89b6a52909..14034bccae 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl @@ -25,31 +25,33 @@ uniform vec4 sunlight_color; uniform vec4 light_ambient; +uniform int no_atmo; vec3 atmosAmbient(vec3 light) { - return light + light_ambient.rgb; + if (no_atmo == 1) return light + vec3(0.66); + return light + light_ambient.rgb; } vec3 atmosAffectDirectionalLight(float lightIntensity) { - return sunlight_color.rgb * lightIntensity; + return sunlight_color.rgb * lightIntensity; } vec3 atmosGetDiffuseSunlightColor() { - return sunlight_color.rgb; + return sunlight_color.rgb; } vec3 scaleDownLight(vec3 light) { - /* stub function for fallback compatibility on class1 hardware */ - return light; + /* stub function for fallback compatibility on class1 hardware */ + return light; } vec3 scaleUpLight(vec3 light) { - /* stub function for fallback compatibility on class1 hardware */ - return light; + /* stub function for fallback compatibility on class1 hardware */ + return light; } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl index 76d7d5059d..b749e1a7a2 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsV.glsl @@ -29,7 +29,7 @@ void setPositionEye(vec3 v); void calcAtmospherics(vec3 inPositionEye) { - /* stub function for fallback compatibility on class1 hardware */ - setPositionEye(inPositionEye); + /* stub function for fallback compatibility on class1 hardware */ + setPositionEye(inPositionEye); } diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 308a85d2d9..541122fb18 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -153,10 +153,9 @@ void main() ambient *= ambient; ambient = (1.0-ambient); - col.rgb = ambient * ((col * 0.5) + amblit); - - col += sunlit * max(min(da, scol), 0.0); - + col.rgb = amblit; + col.rgb *= ambient; + col += sunlit * min(da, scol); col *= diffuse.rgb; vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl index 9653e0809e..2a629f4f42 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl @@ -51,9 +51,9 @@ vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten) { return light; } - light *= atten.r; - light += additive * 2.0; - return light; + light *= atten.r; + light += additive; + return light * 2.0; } vec3 atmosLighting(vec3 light) @@ -63,84 +63,84 @@ vec3 atmosLighting(vec3 light) void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten) { - vec3 P = inPositionEye; - - vec3 tmpLightnorm = lightnorm.xyz; - - vec3 Pn = normalize(P); - float Plen = length(P); - - vec4 temp1 = vec4(0); - vec3 temp2 = vec3(0); - vec4 blue_weight; - vec4 haze_weight; - vec4 sunlight = sunlight_color; - vec4 light_atten; - - //sunlight attenuation effect (hue and brightness) due to atmosphere - //this is used later for sunlight modulation at various altitudes - light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y); - //I had thought blue_density and haze_density should have equal weighting, - //but attenuation due to haze_density tends to seem too strong - - temp1 = blue_density + vec4(haze_density); - blue_weight = blue_density / temp1; - haze_weight = vec4(haze_density) / temp1; - - //(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain) - temp2.y = max(0.0, tmpLightnorm.y); - temp2.y = 1. / temp2.y; - sunlight *= exp( - light_atten * temp2.y); - - // main atmospheric scattering line integral - temp2.z = Plen * density_multiplier; - - // Transparency (-> temp1) - // ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier in a variable because the ati - // compiler gets confused. - temp1 = exp(-temp1 * temp2.z * distance_multiplier); - - //final atmosphere attenuation factor - atten = temp1.rgb; - - //compute haze glow - //(can use temp2.x as temp because we haven't used it yet) - temp2.x = dot(Pn, tmpLightnorm.xyz); - temp2.x = 1. - temp2.x; - //temp2.x is 0 at the sun and increases away from sun - temp2.x = max(temp2.x, .03); //was glow.y - //set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) - temp2.x *= glow.x; - //higher glow.x gives dimmer glow (because next step is 1 / "angle") - temp2.x = pow(temp2.x, glow.z); - //glow.z should be negative, so we're doing a sort of (1 / "angle") function - - //add "minimum anti-solar illumination" - temp2.x += .25; - - //increase ambient when there are more clouds - vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow * 0.5; - - /* decrease value and saturation (that in HSV, not HSL) for occluded areas - * // for HSV color/geometry used here, see http://gimp-savvy.com/BOOK/index.html?node52.html - * // The following line of code performs the equivalent of: - * float ambAlpha = tmpAmbient.a; - * float ambValue = dot(vec3(tmpAmbient), vec3(0.577)); // projection onto <1/rt(3), 1/rt(3), 1/rt(3)>, the neutral white-black axis - * vec3 ambHueSat = vec3(tmpAmbient) - vec3(ambValue); - * tmpAmbient = vec4(RenderSSAOEffect.valueFactor * vec3(ambValue) + RenderSSAOEffect.saturationFactor *(1.0 - ambFactor) * ambHueSat, ambAlpha); - */ - tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a); - - //haze color + vec3 P = inPositionEye; + + vec3 tmpLightnorm = lightnorm.xyz; + + vec3 Pn = normalize(P); + float Plen = length(P); + + vec4 temp1 = vec4(0); + vec3 temp2 = vec3(0); + vec4 blue_weight; + vec4 haze_weight; + vec4 sunlight = sunlight_color; + vec4 light_atten; + + //sunlight attenuation effect (hue and brightness) due to atmosphere + //this is used later for sunlight modulation at various altitudes + light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y); + //I had thought blue_density and haze_density should have equal weighting, + //but attenuation due to haze_density tends to seem too strong + + temp1 = blue_density + vec4(haze_density); + blue_weight = blue_density / temp1; + haze_weight = vec4(haze_density) / temp1; + + //(TERRAIN) compute sunlight from lightnorm only (for short rays like terrain) + temp2.y = max(0.0, tmpLightnorm.y); + temp2.y = 1. / temp2.y; + sunlight *= exp( - light_atten * temp2.y); + + // main atmospheric scattering line integral + temp2.z = Plen * density_multiplier; + + // Transparency (-> temp1) + // ATI Bugfix -- can't store temp1*temp2.z*distance_multiplier in a variable because the ati + // compiler gets confused. + temp1 = exp(-temp1 * temp2.z * distance_multiplier); + + //final atmosphere attenuation factor + atten = temp1.rgb; + + //compute haze glow + //(can use temp2.x as temp because we haven't used it yet) + temp2.x = dot(Pn, tmpLightnorm.xyz); + temp2.x = 1. - temp2.x; + //temp2.x is 0 at the sun and increases away from sun + temp2.x = max(temp2.x, .03); //was glow.y + //set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) + temp2.x *= glow.x; + //higher glow.x gives dimmer glow (because next step is 1 / "angle") + temp2.x = pow(temp2.x, glow.z); + //glow.z should be negative, so we're doing a sort of (1 / "angle") function + + //add "minimum anti-solar illumination" + temp2.x += .25; + + //increase ambient when there are more clouds + vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow * 0.5; + + /* decrease value and saturation (that in HSV, not HSL) for occluded areas + * // for HSV color/geometry used here, see http://gimp-savvy.com/BOOK/index.html?node52.html + * // The following line of code performs the equivalent of: + * float ambAlpha = tmpAmbient.a; + * float ambValue = dot(vec3(tmpAmbient), vec3(0.577)); // projection onto <1/rt(3), 1/rt(3), 1/rt(3)>, the neutral white-black axis + * vec3 ambHueSat = vec3(tmpAmbient) - vec3(ambValue); + * tmpAmbient = vec4(RenderSSAOEffect.valueFactor * vec3(ambValue) + RenderSSAOEffect.saturationFactor *(1.0 - ambFactor) * ambHueSat, ambAlpha); + */ + tmpAmbient = vec4(mix(ssao_effect_mat * tmpAmbient.rgb, tmpAmbient.rgb, ambFactor), tmpAmbient.a); + + //haze color additive = - vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow) + tmpAmbient) - + (haze_horizon * haze_weight) * (sunlight*(1.-cloud_shadow) * temp2.x - + tmpAmbient)); + vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow) + tmpAmbient) + + (haze_horizon * haze_weight) * (sunlight*(1.-cloud_shadow) * temp2.x + + tmpAmbient)); - //brightness of surface both sunlight and ambient - sunlit = vec3(sunlight * .5); - amblit = vec3(tmpAmbient * .25); + //brightness of surface both sunlight and ambient + sunlit = vec3(sunlight * .5); + amblit = vec3(tmpAmbient * .25); additive = normalize(additive); - additive *= vec3(1.0 - exp(-temp2.z * distance_multiplier)) * 0.5; + additive *= vec3(1.0 - exp(-temp2.z * distance_multiplier)) * 0.5; } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl index 63c683c99e..86743dc306 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl @@ -26,19 +26,21 @@ // Output variables uniform float scene_light_strength; +uniform int no_atmo; vec3 atmosFragAmbient(vec3 light, vec3 amblit) { - return amblit + light / 2.0; + if (no_atmo == 1) return light; + return amblit + light / 2.0; } vec3 atmosFragAffectDirectionalLight(float lightIntensity, vec3 sunlit) { - return sunlit * lightIntensity; + return sunlit * lightIntensity; } vec3 scaleDownLightFrag(vec3 light) { - return (light / scene_light_strength ); + return (light / scene_light_strength ); } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl index 62a034ce05..95b4a76880 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl @@ -33,29 +33,31 @@ vec3 getAtmosAttenuation(); vec3 getPositionEye(); uniform float scene_light_strength; +uniform int no_atmo; vec3 atmosAmbient(vec3 light) { - return getAmblitColor() + light / 2.0; + if (no_atmo == 1) return light + vec3(0.66); + return getAmblitColor() + light / 2.0; } vec3 atmosAffectDirectionalLight(float lightIntensity) { - return getSunlitColor() * lightIntensity; + return getSunlitColor() * lightIntensity; } vec3 atmosGetDiffuseSunlightColor() { - return getSunlitColor(); + return getSunlitColor(); } vec3 scaleDownLight(vec3 light) { - return (light / scene_light_strength ); + return (light / scene_light_strength ); } vec3 scaleUpLight(vec3 light) { - return (light * scene_light_strength); + return (light * scene_light_strength); } diff --git a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl index 6401845af2..ac7c57747e 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl @@ -48,11 +48,11 @@ vec3 scaleSoftClip(vec3 light) } vec3 fullbrightScaleSoftClipFrag(vec3 light) { - return mix(scaleSoftClip(light.rgb), light.rgb, getAtmosAttenuation()); + return scaleSoftClipFrag(light.rgb); } vec3 fullbrightScaleSoftClip(vec3 light) { - return fullbrightScaleSoftClipFrag(light); + return scaleSoftClipFrag(light); } diff --git a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl index 359fea3073..df731662e8 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl @@ -36,11 +36,11 @@ vec3 atmosTransportFrag(vec3 light, vec3 additive, vec3 atten) { if (no_atmo == 1) { - return light; + return light; } light *= atten.r; - light += additive * 2.0; - return light; + light += additive * 2.0; + return light; } vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten) @@ -49,17 +49,17 @@ vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten) { return light; } - float brightness = dot(light.rgb, vec3(0.33333)); - return mix(atmosTransportFrag(light.rgb, additive, atten), light.rgb + additive.rgb, brightness * brightness); + float brightness = dot(light.rgb, vec3(0.33333)); + return mix(atmosTransportFrag(light.rgb, additive, atten), light.rgb + additive.rgb, brightness * brightness); } -vec3 fullbrightShinyAtmosTransportFrag(vec3 light, vec3 atten, vec3 additive) { +vec3 fullbrightShinyAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten) { if (no_atmo == 1) { return light; } - float brightness = dot(light.rgb, vec3(0.33333)); - return mix(atmosTransportFrag(light.rgb, additive, atten), (light.rgb + additive.rgb) * (2.0 - brightness), brightness * brightness); + float brightness = dot(light.rgb, vec3(0.33333)); + return mix(atmosTransportFrag(light.rgb, additive, atten), (light.rgb + additive.rgb) * (2.0 - brightness), brightness * brightness); } vec3 atmosTransport(vec3 light) diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 16fc0f702d..f4f9a3a0c2 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -991,8 +991,10 @@ BOOL LLViewerShaderMgr::loadBasicShaders() index_channels.push_back(-1); shaders.push_back( make_pair( "environment/encodeNormF.glsl", mVertexShaderLevel[SHADER_ENVIRONMENT] ) ); index_channels.push_back(-1); shaders.push_back( make_pair( "environment/decodeNormF.glsl", mVertexShaderLevel[SHADER_ENVIRONMENT] ) ); index_channels.push_back(-1); shaders.push_back( make_pair( "environment/srgbF.glsl", mVertexShaderLevel[SHADER_ENVIRONMENT] ) ); +#if USE_DEFERRED_SHADER_API index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/deferredUtil.glsl", mVertexShaderLevel[SHADER_DEFERRED] ) ); index_channels.push_back(-1); shaders.push_back( make_pair( "deferred/indirect.glsl", mVertexShaderLevel[SHADER_DEFERRED] ) ); +#endif index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightAlphaMaskNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); index_channels.push_back(-1); shaders.push_back( make_pair( "lighting/lightFullbrightNonIndexedF.glsl", mVertexShaderLevel[SHADER_LIGHTING] ) ); diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index b890e21e41..f5aa003417 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -1000,11 +1000,8 @@ void LLVOSky::setMoonTextures(const LLUUID& moon_texture, const LLUUID& moon_tex { LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); - LLUUID moon_tex = moon_texture.isNull() ? psky->GetDefaultMoonTextureId() : moon_texture; - LLUUID moon_tex_next = moon_texture_next.isNull() ? psky->GetDefaultMoonTextureId() : moon_texture_next; - - mMoonTexturep[0] = moon_tex.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(moon_tex, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); - mMoonTexturep[1] = moon_tex_next.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(moon_tex_next, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); + mMoonTexturep[0] = moon_texture.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(moon_texture, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); + mMoonTexturep[1] = moon_texture_next.isNull() ? nullptr : LLViewerTextureManager::getFetchedTexture(moon_texture_next, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); if (mFace[FACE_MOON]) { diff --git a/indra/newview/skins/default/xui/en/panel_settings_sky_clouds.xml b/indra/newview/skins/default/xui/en/panel_settings_sky_clouds.xml index 457082ede2..11a852f40b 100644 --- a/indra/newview/skins/default/xui/en/panel_settings_sky_clouds.xml +++ b/indra/newview/skins/default/xui/en/panel_settings_sky_clouds.xml @@ -128,10 +128,11 @@ visible="true" left_delta="0" top_delta="21" - min_val_x="-10" - max_val_x="10" - min_val_y="-10" - max_val_y="10" /> + min_val_x="-30" + max_val_x="30" + min_val_y="-30" + max_val_y="30" + logarithmic="1"/> <text follows="left|top" |