diff options
Diffstat (limited to 'indra')
9 files changed, 91 insertions, 44 deletions
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 9211a48a8e..a0d81e6d99 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -737,7 +737,7 @@ LLSD LLSettingsSky::defaults(const LLSettingsBase::TrackPosition& position) dfltsetting[SETTING_MOON_ROTATION] = moonquat.getValue(); dfltsetting[SETTING_MOON_BRIGHTNESS] = LLSD::Real(0.5f); - dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(256.0000); + dfltsetting[SETTING_STAR_BRIGHTNESS] = LLSD::Real(250.0000); dfltsetting[SETTING_SUNLIGHT_COLOR] = LLColor4(0.7342, 0.7815, 0.8999, 0.0).getValue(); dfltsetting[SETTING_SUN_ROTATION] = sunquat.getValue(); @@ -1037,72 +1037,65 @@ LLColor3 LLSettingsSky::getLightDiffuse() const return LLColor3::white; } -LLColor3 LLSettingsSky::getAmbientColor() const +LLColor3 LLSettingsSky::getColor(const std::string& key, const LLColor3& default_value) const { - if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_AMBIENT)) + if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(key)) { - return LLColor3(mSettings[SETTING_LEGACY_HAZE][SETTING_AMBIENT]); + return LLColor3(mSettings[SETTING_LEGACY_HAZE][key]); } - if (mSettings.has(SETTING_AMBIENT)) + if (mSettings.has(key)) { - return LLColor3(mSettings[SETTING_AMBIENT]); + return LLColor3(mSettings[key]); } - return LLColor3(0.25f, 0.25f, 0.25f); + return default_value; } -LLColor3 LLSettingsSky::getBlueDensity() const +F32 LLSettingsSky::getFloat(const std::string& key, F32 default_value) const { - if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_BLUE_DENSITY)) + if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(key)) + { + return mSettings[SETTING_LEGACY_HAZE][key].asReal(); + } + if (mSettings.has(key)) { - return LLColor3(mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_DENSITY]); + return mSettings[key].asReal(); } - return LLColor3(0.2447f, 0.4487f, 0.7599f); + return default_value; +} + +LLColor3 LLSettingsSky::getAmbientColor() const +{ + return getColor(SETTING_AMBIENT, LLColor3(0.25f, 0.25f, 0.25f)); +} + +LLColor3 LLSettingsSky::getBlueDensity() const +{ + return getColor(SETTING_BLUE_DENSITY, LLColor3(0.2447f, 0.4487f, 0.7599f)); } LLColor3 LLSettingsSky::getBlueHorizon() const { - if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_BLUE_HORIZON)) - { - return LLColor3(mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_HORIZON]); - } - return LLColor3(0.4954f, 0.4954f, 0.6399f); + return getColor(SETTING_BLUE_HORIZON, LLColor3(0.4954f, 0.4954f, 0.6399f)); } F32 LLSettingsSky::getHazeDensity() const { - if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_HAZE_DENSITY)) - { - return mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_DENSITY].asReal(); - } - return 0.7f; + return getFloat(SETTING_HAZE_DENSITY, 0.7f); } F32 LLSettingsSky::getHazeHorizon() const { - if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_HAZE_HORIZON)) - { - return mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_HORIZON].asReal(); - } - return 0.19f; + return getFloat(SETTING_HAZE_HORIZON, 0.19f); } F32 LLSettingsSky::getDensityMultiplier() const { - F32 density_multiplier = 0.0001f; - if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_DENSITY_MULTIPLIER)) - { - density_multiplier = mSettings[SETTING_LEGACY_HAZE][SETTING_DENSITY_MULTIPLIER].asReal(); - } - return density_multiplier; + return getFloat(SETTING_DENSITY_MULTIPLIER, 0.0001f); } F32 LLSettingsSky::getDistanceMultiplier() const { - if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_DISTANCE_MULTIPLIER)) - { - return mSettings[SETTING_LEGACY_HAZE][SETTING_DISTANCE_MULTIPLIER].asReal(); - } - return 0.8f; + return getFloat(SETTING_DISTANCE_MULTIPLIER, 0.8f); } void LLSettingsSky::setPlanetRadius(F32 radius) diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index cd173a6b18..d585eeddfa 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -337,6 +337,9 @@ private: static LLSD absorptionConfigDefault(); static LLSD mieConfigDefault(); + LLColor3 getColor(const std::string& key, const LLColor3& default_value) const; + F32 getFloat(const std::string& key, F32 default_value) const; + void calculateHeavenlyBodyPositions() const; void calculateLightSettings() const; diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index 6e693bd33b..fb24927b26 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -190,7 +190,7 @@ void main() calcFragAtmospherics(pos.xyz, 1.0, sunlit, amblit, additive, atten); - vec2 abnormal = encode_normal(norm.xyz); + vec2 abnormal = encode_normal(norm.xyz); vec3 light_dir = (sun_up_factor == 1) ? sun_dir: moon_dir; float da = dot(norm.xyz, light_dir.xyz); @@ -208,15 +208,23 @@ void main() float ambient = da; ambient *= 0.5; ambient *= ambient; - ambient = max(0.9, ambient); // keeps shadows dark + ambient = max(0.66, ambient); // keeps shadows dark ambient = 1.0 - ambient; vec3 sun_contrib = min(final_da, shadow) * sunlit; color.rgb *= ambient; + +vec3 post_ambient = color.rgb; + color.rgb += sun_contrib; + +vec3 post_sunlight = color.rgb; + color.rgb *= diff.rgb; +vec3 post_diffuse = color.rgb; + //color.rgb = mix(diff.rgb, color.rgb, final_alpha); color.rgb = atmosFragLighting(color.rgb, additive, atten); @@ -224,6 +232,8 @@ void main() vec4 light = vec4(0,0,0,0); +vec3 prelight_linearish_maybe = color.rgb; + #define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, diff.rgb, pos.xyz, norm, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, light_attenuation[i].w, shadow); LIGHT_LOOP(1) @@ -238,13 +248,19 @@ void main() // color.rgb += light.rgb; +vec3 postlight_linear = color.rgb; + +color.rgb = prelight_linearish_maybe; + color.rgb = linear_to_srgb(color.rgb); + #endif #ifdef WATER_FOG color = applyWaterFogView(pos.xyz, color); #endif + frag_color = color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 4a47311eb7..4bb01824bf 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -305,16 +305,24 @@ void main() float ambient = da; ambient *= 0.5; ambient *= ambient; - ambient = max(0.9, ambient); + ambient = max(0.66, ambient); ambient = 1.0 - ambient; vec3 sun_contrib = min(final_da, shadow) * sunlit; col.rgb = amblit; col.rgb *= ambient; + +vec3 post_ambient = col.rgb; + col.rgb += sun_contrib; + +vec3 post_sunlight = col.rgb; + col.rgb *= diffuse.rgb; +vec3 post_diffuse = col.rgb; + float glare = 0.0; if (spec.a > 0.0) // specular reflection @@ -363,6 +371,8 @@ vec3 post_spec = col.rgb; vec3 light = vec3(0,0,0); + vec3 prelight_linearish_maybe = col.rgb; + #define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare, light_attenuation[i].w, shadow); LIGHT_LOOP(1) @@ -375,6 +385,8 @@ vec3 post_spec = col.rgb; col.rgb += light.rgb; +vec3 postlight_linear = col.rgb; + glare = min(glare, 1.0); float al = max(diffcol.a,glare)*vertex_color.a; @@ -384,6 +396,8 @@ vec3 post_spec = col.rgb; al = temp.a; #endif +//col.rgb = prelight_linearish_maybe; + col.rgb = linear_to_srgb(col.rgb); frag_color.rgb = col.rgb; diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 361ed40eaf..4b9e8290dd 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -112,15 +112,24 @@ void main() float ambient = da; ambient *= 0.5; ambient *= ambient; + ambient = max(0.66, ambient); ambient = 1.0 - ambient; vec3 sun_contrib = final_da * sunlit; col.rgb = amblit; col.rgb *= ambient; + +vec3 post_ambient = col.rgb; + col.rgb += sun_contrib; + +vec3 post_sunlight = col.rgb; + col.rgb *= diffuse.rgb; +vec3 post_diffuse = col.rgb; + vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); if (spec.a > 0.0) // specular reflection @@ -168,6 +177,8 @@ void main() col = fogged.rgb; bloom = fogged.a; #endif + +//col.rgb = post_diffuse; } frag_color.rgb = col.rgb; diff --git a/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl index 7d699a4967..4d7cff37c6 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/sumLightsV.glsl @@ -34,7 +34,7 @@ vec3 scaleDownLight(vec3 light); vec4 sumLights(vec3 pos, vec3 norm, vec4 color, vec4 baseLight) { - vec4 col; + vec4 col = vec4(0); col.a = color.a; col.rgb = light_diffuse[1].rgb * calcDirectionalLight(norm, light_position[1].xyz); diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 12115082a9..8814587fbc 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -126,16 +126,24 @@ void main() float ambient = da; ambient *= 0.5; ambient *= ambient; - ambient = max(0.9, ambient); + ambient = max(0.66, ambient); ambient = 1.0 - ambient; vec3 sun_contrib = min(scol, final_da) * sunlit; col.rgb = amblit; col.rgb *= ambient; + +vec3 post_ambient = col.rgb; + col.rgb += sun_contrib; + +vec3 post_sunlight = col.rgb; + col.rgb *= diffuse.rgb; +vec3 post_diffuse = col.rgb; + vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); if (spec.a > 0.0) // specular reflection diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl index 40c521cd2c..f1398afb99 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl @@ -152,7 +152,7 @@ void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit, + tmpAmbient)); //brightness of surface both sunlight and ambient - sunlit = vec3(sunlight.rgb* 0.5); + sunlit = vec3(sunlight.rgb); amblit = vec3(tmpAmbient * .25); additive = normalize(additive); additive *= vec3(1.0 - exp(-temp2.z * distance_multiplier)) * 0.5; diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 6556380f28..60f4cd3f5a 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -568,9 +568,11 @@ void LLSettingsVOSky::convertAtmosphericsToLegacy(LLSD& legacy, LLSD& settings) F32 density_multiplier = legacyhaze[SETTING_DENSITY_MULTIPLIER].asReal(); density_multiplier = (density_multiplier < 0.0001f) ? 0.0001f : density_multiplier; + density_multiplier *= 0.9f / 2.0f; // take 0 - 2.0 range to 0 - 0.9 range legacy[SETTING_DENSITY_MULTIPLIER] = LLSDArray(density_multiplier)(0.0f)(0.0f)(1.0f); F32 distance_multiplier = legacyhaze[SETTING_DISTANCE_MULTIPLIER].asReal(); + distance_multiplier *= 0.1f; // take 0 - 1000 range to 0 - 100 range legacy[SETTING_DISTANCE_MULTIPLIER] = LLSDArray(distance_multiplier)(0.0f)(0.0f)(1.0f); legacy[SETTING_HAZE_DENSITY] = LLSDArray(legacyhaze[SETTING_HAZE_DENSITY])(0.0f)(0.0f)(1.0f); @@ -597,7 +599,7 @@ LLSD LLSettingsVOSky::convertToLegacy(const LLSettingsSky::ptr_t &psky, bool isA legacy[SETTING_GLOW] = ensure_array_4(settings[SETTING_GLOW], 1.0); legacy[SETTING_LIGHT_NORMAL] = ensure_array_4(psky->getLightDirection().getValue(), 0.0f); legacy[SETTING_MAX_Y] = LLSDArray(settings[SETTING_MAX_Y])(0.0f)(0.0f)(1.0f); - legacy[SETTING_STAR_BRIGHTNESS] = settings[SETTING_STAR_BRIGHTNESS]; + legacy[SETTING_STAR_BRIGHTNESS] = settings[SETTING_STAR_BRIGHTNESS].asReal() / 250.0f; // convert from 0-500 -> 0-2 ala pre-FS-compat changes legacy[SETTING_SUNLIGHT_COLOR] = ensure_array_4(settings[SETTING_SUNLIGHT_COLOR], 1.0f); LLVector3 dir = psky->getLightDirection(); |