diff options
Diffstat (limited to 'indra/newview')
20 files changed, 357 insertions, 73 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl index e86bca3ddd..f65a6eb32b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl @@ -39,6 +39,7 @@ vec3 fullbrightScaleSoftClip(vec3 light); uniform vec4 color; uniform vec4 sunlight_color; uniform vec3 lumWeights; +uniform float moon_brightness; uniform float minLuminance; uniform sampler2D diffuseMap; uniform sampler2D altDiffuseMap; @@ -51,15 +52,23 @@ void main() vec4 moonB = texture2D(altDiffuseMap, vary_texcoord0.xy); vec4 c = mix(moonA, moonB, blend_factor); + if (c.a < 0.1f) + { + discard; + } + c.rgb = pow(c.rgb, vec3(0.7f)); c.rgb = fullbrightAtmosTransport(c.rgb); c.rgb = fullbrightScaleSoftClip(c.rgb); // mix factor which blends when sunlight is brighter // and shows true moon color at night - vec3 luma_weights = vec3(0.1, 0.3, 0.0); - float mix = 1.0f - dot(sunlight_color.rgb, luma_weights); - frag_data[0] = vec4(c.rgb, mix * c.a); + vec3 luma_weights = vec3(0.2, 0.3, 0.2); + float mix = 1.0f - dot(normalize(sunlight_color.rgb), luma_weights); + + c.rgb = pow(c.rgb, 1.2 - vec3(mix * moon_brightness)); + + frag_data[0] = vec4(c.rgb, mix * (moon_brightness + (c.a * 0.25))); frag_data[1] = vec4(0.0); frag_data[2] = vec4(0.0f); } diff --git a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl index 933625986c..8cc7fc3bb5 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl @@ -39,6 +39,7 @@ vec3 fullbrightScaleSoftClip(vec3 light); uniform vec4 color; uniform vec4 sunlight_color; uniform vec3 lumWeights; +uniform float moon_brightness; uniform float minLuminance; uniform sampler2D diffuseMap; uniform sampler2D altDiffuseMap; @@ -51,13 +52,22 @@ void main() vec4 moonB = texture2D(altDiffuseMap, vary_texcoord0.xy); vec4 c = mix(moonA, moonB, blend_factor); - c.rgb = pow(c.rgb, vec3(0.45f)); + if (c.a < 0.1f) + { + discard; + } + + c.rgb = pow(c.rgb, vec3(0.7f)); c.rgb = fullbrightAtmosTransport(c.rgb); c.rgb = fullbrightScaleSoftClip(c.rgb); + // mix factor which blends when sunlight is brighter // and shows true moon color at night - vec3 luma_weights = vec3(0.1, 0.3, 0.0); - float mix = 1.0f - dot(sunlight_color.rgb, luma_weights); - frag_color = vec4(c.rgb, mix * c.a); + vec3 luma_weights = vec3(0.2, 0.3, 0.2); + float mix = 1.0f - dot(normalize(sunlight_color.rgb), luma_weights); + + c.rgb = pow(c.rgb, 1.2 - vec3(mix * moon_brightness)); + + frag_color = vec4(c.rgb, mix * (moon_brightness + (c.a * 0.25))); } diff --git a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl index 7bfc114383..2073fc066f 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl @@ -42,25 +42,46 @@ uniform sampler2D transmittance_texture; uniform sampler3D scattering_texture; uniform sampler3D single_mie_scattering_texture; uniform sampler2D irradiance_texture; +uniform sampler2D rainbow_map; +uniform sampler2D halo_map; + +uniform float moisture_level; +uniform float droplet_radius; +uniform float ice_level; vec3 GetSolarLuminance(); vec3 GetSkyLuminance(vec3 camPos, vec3 view_dir, float shadow_length, vec3 dir, out vec3 transmittance); vec3 GetSkyLuminanceToPoint(vec3 camPos, vec3 pos, float shadow_length, vec3 dir, out vec3 transmittance); +vec3 rainbow(float d) +{ + float rad = (droplet_radius - 5.0f) / 1024.0f; + return pow(texture2D(rainbow_map, vec2(rad, d)).rgb, vec3(1.8)) * moisture_level; +} + +vec3 halo22(float d) +{ + float v = sqrt(max(0, 1 - (d*d))); + return texture2D(halo_map, vec2(0, v)).rgb * ice_level; +} + void main() { - vec3 pos = vec3((vary_frag * 2.0) - vec2(1.0, 1.0), 0.0); + vec3 pos = vec3((vary_frag * 2.0) - vec2(1.0, 1.0f), 1.0); vec4 view_pos = (inv_proj * vec4(pos, 1.0f)); + view_pos /= view_pos.w; - vec3 view_ray = (inv_modelview * vec4(view_pos.xyz, 0.0f)).xyz; + + vec3 view_ray = (inv_modelview * vec4(view_pos.xyz, 0.0f)).xyz + camPosLocal; vec3 view_direction = normalize(view_ray); vec3 sun_direction = normalize(sun_dir); + vec3 earth_center = vec3(0, 0, -6360.0f); + vec3 camPos = (camPosLocal / 1000.0f) - earth_center; - vec3 camPos = (camPosLocal / 1000.0f) + vec3(0, 0, 6360.0f); vec3 transmittance; vec3 radiance_sun = GetSkyLuminance(camPos, view_direction, 0.0f, sun_direction, transmittance); - vec3 solar_luminance = transmittance * GetSolarLuminance(); + vec3 solar_luminance = GetSolarLuminance(); // If the view ray intersects the Sun, add the Sun radiance. float s = dot(view_direction, sun_direction); @@ -68,12 +89,21 @@ void main() // cheesy solar disc... if (s >= (sun_size * 0.999)) { - radiance_sun += pow(smoothstep(0.0, 1.3, (s - (sun_size * 0.9))), 2.0) * solar_luminance; + radiance_sun += pow(smoothstep(0.0, 1.3, (s - (sun_size * 0.9))), 2.0) * solar_luminance * transmittance; } s = smoothstep(0.9, 1.0, s) * 16.0f; vec3 color = vec3(1.0) - exp(-radiance_sun * 0.0001); + float optic_d = dot(view_direction, sun_direction); + + vec3 halo_22 = halo22(optic_d); + + if (optic_d <= 0) + color.rgb += rainbow(optic_d); + + color.rgb += halo_22; + color = pow(color, vec3(1.0 / 2.2)); frag_data[0] = vec4(color, 1.0 + s); diff --git a/indra/newview/app_settings/windlight/corona_lut.png b/indra/newview/app_settings/windlight/corona_lut.png Binary files differdeleted file mode 100644 index c4843667d9..0000000000 --- a/indra/newview/app_settings/windlight/corona_lut.png +++ /dev/null diff --git a/indra/newview/app_settings/windlight/rainbow_lut.png b/indra/newview/app_settings/windlight/rainbow_lut.png Binary files differdeleted file mode 100644 index 4bede25649..0000000000 --- a/indra/newview/app_settings/windlight/rainbow_lut.png +++ /dev/null diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp index 5104dc18fd..b89588a463 100644 --- a/indra/newview/lldrawpoolwlsky.cpp +++ b/indra/newview/lldrawpoolwlsky.cpp @@ -176,6 +176,13 @@ void LLDrawPoolWLSky::renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 ca sky_shader->bindTexture(LLShaderMgr::ILLUMINANCE_TEX, gAtmosphere->getIlluminance()); LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); + + LLViewerTexture* rainbow_tex = gSky.mVOSkyp->getRainbowTex(); + LLViewerTexture* halo_tex = gSky.mVOSkyp->getHaloTex(); + + sky_shader->bindTexture(LLShaderMgr::RAINBOW_MAP, rainbow_tex); + sky_shader->bindTexture(LLShaderMgr::HALO_MAP, halo_tex); + LLVector3 sun_dir = LLEnvironment::instance().getSunDirection(); LLVector3 moon_dir = LLEnvironment::instance().getMoonDirection(); @@ -184,6 +191,14 @@ void LLDrawPoolWLSky::renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 ca sky_shader->uniform3fv(LLShaderMgr::DEFERRED_SUN_DIR, 1, sun_dir.mV); sky_shader->uniform3fv(LLShaderMgr::DEFERRED_MOON_DIR, 1, moon_dir.mV); + F32 moisture_level = (float)psky->getSkyMoistureLevel(); + F32 droplet_radius = (float)psky->getSkyDropletRadius(); + F32 ice_level = (float)psky->getSkyIceLevel(); + + sky_shader->uniform1f(LLShaderMgr::MOISTURE_LEVEL, moisture_level); + sky_shader->uniform1f(LLShaderMgr::DROPLET_RADIUS, droplet_radius); + sky_shader->uniform1f(LLShaderMgr::ICE_LEVEL, ice_level); + llassert(sky_shader->getUniformLocation(LLShaderMgr::INVERSE_PROJECTION_MATRIX)); glh::matrix4f proj_mat = get_current_projection(); @@ -195,7 +210,7 @@ void LLDrawPoolWLSky::renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 ca LLGLDisable cull(GL_CULL_FACE); renderFsSky(camPosLocal, camHeightLocal, sky_shader); - + sky_shader->unbind(); } } @@ -209,6 +224,22 @@ void LLDrawPoolWLSky::renderSkyHaze(const LLVector3& camPosLocal, F32 camHeightL LLGLDisable blend(GL_BLEND); sky_shader->bind(); + LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); + + LLViewerTexture* rainbow_tex = gSky.mVOSkyp->getRainbowTex(); + LLViewerTexture* halo_tex = gSky.mVOSkyp->getHaloTex(); + + sky_shader->bindTexture(LLShaderMgr::RAINBOW_MAP, rainbow_tex); + sky_shader->bindTexture(LLShaderMgr::HALO_MAP, halo_tex); + + F32 moisture_level = (float)psky->getSkyMoistureLevel(); + F32 droplet_radius = (float)psky->getSkyDropletRadius(); + F32 ice_level = (float)psky->getSkyIceLevel(); + + sky_shader->uniform1f(LLShaderMgr::MOISTURE_LEVEL, moisture_level); + sky_shader->uniform1f(LLShaderMgr::DROPLET_RADIUS, droplet_radius); + sky_shader->uniform1f(LLShaderMgr::ICE_LEVEL, ice_level); + /// Render the skydome renderDome(origin, camHeightLocal, sky_shader); @@ -469,6 +500,12 @@ void LLDrawPoolWLSky::renderHeavenlyBodies() moon_shader->bindTexture(LLShaderMgr::ALTERNATE_DIFFUSE_MAP, tex_b, LLTexUnit::TT_TEXTURE); } + LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky(); + + F32 moon_brightness = (float)psky->getMoonBrightness(); + + moon_shader->uniform1f(LLShaderMgr::MOON_BRIGHTNESS, moon_brightness); + moon_shader->uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, color.mV); moon_shader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor); diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index c8ed43871d..4fd23252fa 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -191,6 +191,7 @@ public: void refreshFromEstate(); virtual BOOL postBuild() override; + virtual void onOpen(const LLSD& key) override {}; virtual S32 getParcelId() override { return INVALID_PARCEL_ID; } diff --git a/indra/newview/llpaneleditsky.cpp b/indra/newview/llpaneleditsky.cpp index 0d36fce90a..0d8c9a988a 100644 --- a/indra/newview/llpaneleditsky.cpp +++ b/indra/newview/llpaneleditsky.cpp @@ -72,6 +72,7 @@ namespace const std::string FIELD_SKY_MOON_ROTATION("moon_rotation"); const std::string FIELD_SKY_MOON_IMAGE("moon_image"); const std::string FIELD_SKY_MOON_SCALE("moon_scale"); + const std::string FIELD_SKY_MOON_BRIGHTNESS("moon_brightness"); const std::string FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL("rayleigh_exponential"); const std::string FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL_SCALE("rayleigh_exponential_scale"); @@ -92,6 +93,10 @@ namespace const std::string FIELD_SKY_DENSITY_ABSORPTION_CONSTANT("absorption_constant"); const std::string FIELD_SKY_DENSITY_ABSORPTION_MAX_ALTITUDE("absorption_max_altitude"); + const std::string FIELD_SKY_DENSITY_MOISTURE_LEVEL("moisture_level"); + const std::string FIELD_SKY_DENSITY_DROPLET_RADIUS("droplet_radius"); + const std::string FIELD_SKY_DENSITY_ICE_LEVEL("ice_level"); + const F32 SLIDER_SCALE_SUN_AMBIENT(3.0f); const F32 SLIDER_SCALE_BLUE_HORIZON_DENSITY(2.0f); const F32 SLIDER_SCALE_GLOW_R(20.0f); @@ -394,6 +399,7 @@ BOOL LLPanelSettingsSkySunMoonTab::postBuild() getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->setAllowNoTexture(TRUE); getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->setAllowLocalTexture(FALSE); getChild<LLUICtrl>(FIELD_SKY_MOON_SCALE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonScaleChanged(); }); + getChild<LLUICtrl>(FIELD_SKY_MOON_BRIGHTNESS)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoonBrightnessChanged(); }); refresh(); @@ -407,6 +413,9 @@ void LLPanelSettingsSkySunMoonTab::setEnabled(BOOL enabled) getChild<LLUICtrl>(FIELD_SKY_GLOW_FOCUS)->setEnabled(enabled); getChild<LLUICtrl>(FIELD_SKY_GLOW_SIZE)->setEnabled(enabled); getChild<LLUICtrl>(FIELD_SKY_STAR_BRIGHTNESS)->setEnabled(enabled); + getChild<LLUICtrl>(FIELD_SKY_SUN_SCALE)->setEnabled(enabled); + getChild<LLUICtrl>(FIELD_SKY_MOON_SCALE)->setEnabled(enabled); + getChild<LLUICtrl>(FIELD_SKY_MOON_BRIGHTNESS)->setEnabled(enabled); } void LLPanelSettingsSkySunMoonTab::refresh() @@ -434,6 +443,7 @@ void LLPanelSettingsSkySunMoonTab::refresh() getChild<LLVirtualTrackball>(FIELD_SKY_MOON_ROTATION)->setRotation(mSkySettings->getMoonRotation()); getChild<LLTextureCtrl>(FIELD_SKY_MOON_IMAGE)->setValue(mSkySettings->getMoonTextureId()); getChild<LLUICtrl>(FIELD_SKY_MOON_SCALE)->setValue(mSkySettings->getMoonScale()); + getChild<LLUICtrl>(FIELD_SKY_MOON_BRIGHTNESS)->setValue(mSkySettings->getMoonBrightness()); } //------------------------------------------------------------------------- @@ -509,6 +519,12 @@ void LLPanelSettingsSkySunMoonTab::onMoonScaleChanged() setIsDirty(); } +void LLPanelSettingsSkySunMoonTab::onMoonBrightnessChanged() +{ + mSkySettings->setMoonBrightness((getChild<LLUICtrl>(FIELD_SKY_MOON_BRIGHTNESS)->getValue().asReal())); + mSkySettings->update(); + setIsDirty(); +} LLPanelSettingsSkyDensityTab::LLPanelSettingsSkyDensityTab() { @@ -536,6 +552,10 @@ BOOL LLPanelSettingsSkyDensityTab::postBuild() getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_MAX_ALTITUDE)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onAbsorptionMaxAltitudeChanged(); }); + getChild<LLUICtrl>(FIELD_SKY_DENSITY_MOISTURE_LEVEL)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onMoistureLevelChanged(); }); + getChild<LLUICtrl>(FIELD_SKY_DENSITY_DROPLET_RADIUS)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onDropletRadiusChanged(); }); + getChild<LLUICtrl>(FIELD_SKY_DENSITY_ICE_LEVEL)->setCommitCallback([this](LLUICtrl *, const LLSD &) { onIceLevelChanged(); }); + refresh(); return TRUE; } @@ -562,6 +582,11 @@ void LLPanelSettingsSkyDensityTab::setEnabled(BOOL enabled) getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_LINEAR)->setEnabled(enabled); getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_CONSTANT)->setEnabled(enabled); getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_MAX_ALTITUDE)->setEnabled(enabled); + + getChild<LLUICtrl>(FIELD_SKY_DENSITY_MOISTURE_LEVEL)->setEnabled(enabled); + getChild<LLUICtrl>(FIELD_SKY_DENSITY_DROPLET_RADIUS)->setEnabled(enabled); + getChild<LLUICtrl>(FIELD_SKY_DENSITY_ICE_LEVEL)->setEnabled(enabled); + } void LLPanelSettingsSkyDensityTab::refresh() @@ -600,6 +625,10 @@ void LLPanelSettingsSkyDensityTab::refresh() F32 absorption_constant_term = absorption_config[LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM].asReal(); F32 absorption_max_alt = absorption_config[LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH].asReal(); + F32 moisture_level = mSkySettings->getSkyMoistureLevel(); + F32 droplet_radius = mSkySettings->getSkyDropletRadius(); + F32 ice_level = mSkySettings->getSkyIceLevel(); + getChild<LLUICtrl>(FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL)->setValue(rayleigh_exponential_term); getChild<LLUICtrl>(FIELD_SKY_DENSITY_RAYLEIGH_EXPONENTIAL_SCALE)->setValue(rayleigh_exponential_scale); getChild<LLUICtrl>(FIELD_SKY_DENSITY_RAYLEIGH_LINEAR)->setValue(rayleigh_linear_term); @@ -618,6 +647,10 @@ void LLPanelSettingsSkyDensityTab::refresh() getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_LINEAR)->setValue(absorption_linear_term); getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_CONSTANT)->setValue(absorption_constant_term); getChild<LLUICtrl>(FIELD_SKY_DENSITY_ABSORPTION_MAX_ALTITUDE)->setValue(absorption_max_alt); + + getChild<LLUICtrl>(FIELD_SKY_DENSITY_MOISTURE_LEVEL)->setValue(moisture_level); + getChild<LLUICtrl>(FIELD_SKY_DENSITY_DROPLET_RADIUS)->setValue(droplet_radius); + getChild<LLUICtrl>(FIELD_SKY_DENSITY_ICE_LEVEL)->setValue(ice_level); } void LLPanelSettingsSkyDensityTab::updateProfile() @@ -645,6 +678,10 @@ void LLPanelSettingsSkyDensityTab::updateProfile() LLSD mie_config = LLSettingsSky::createSingleLayerDensityProfile(mie_max_alt, mie_exponential_term, mie_exponential_scale, mie_linear_term, mie_constant_term, mie_aniso_factor); LLSD absorption_layer = LLSettingsSky::createSingleLayerDensityProfile(absorption_max_alt, absorption_exponential_term, absorption_exponential_scale, absorption_linear_term, absorption_constant_term); + F32 moisture_level = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_MOISTURE_LEVEL)->getValueF32(); + F32 droplet_radius = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_DROPLET_RADIUS)->getValueF32(); + F32 ice_level = getChild<LLSliderCtrl>(FIELD_SKY_DENSITY_ICE_LEVEL)->getValueF32(); + static LLSD absorption_layer_ozone = LLSettingsSky::createDensityProfileLayer(0.0f, 0.0f, 0.0f, -1.0f / 15000.0f, 8.0f / 3.0f); LLSD absorption_config; @@ -654,7 +691,9 @@ void LLPanelSettingsSkyDensityTab::updateProfile() mSkySettings->setRayleighConfigs(rayleigh_config); mSkySettings->setMieConfigs(mie_config); mSkySettings->setAbsorptionConfigs(absorption_config); - + mSkySettings->setSkyMoistureLevel(moisture_level); + mSkySettings->setSkyDropletRadius(droplet_radius); + mSkySettings->setSkyIceLevel(ice_level); mSkySettings->update(); setIsDirty(); @@ -745,3 +784,18 @@ void LLPanelSettingsSkyDensityTab::onAbsorptionMaxAltitudeChanged() { updateProfile(); } + +void LLPanelSettingsSkyDensityTab::onMoistureLevelChanged() +{ + updateProfile(); +} + +void LLPanelSettingsSkyDensityTab::onDropletRadiusChanged() +{ + updateProfile(); +} + +void LLPanelSettingsSkyDensityTab::onIceLevelChanged() +{ + updateProfile(); +} diff --git a/indra/newview/llpaneleditsky.h b/indra/newview/llpaneleditsky.h index b34271f610..829a65dae5 100644 --- a/indra/newview/llpaneleditsky.h +++ b/indra/newview/llpaneleditsky.h @@ -123,6 +123,7 @@ private: void onSunImageChanged(); void onMoonRotationChanged(); void onMoonScaleChanged(); + void onMoonBrightnessChanged(); void onMoonImageChanged(); }; @@ -158,6 +159,9 @@ protected: void onAbsorptionLinearChanged(); void onAbsorptionConstantChanged(); void onAbsorptionMaxAltitudeChanged(); + void onMoistureLevelChanged(); + void onDropletRadiusChanged(); + void onIceLevelChanged(); // update the settings for our profile type void updateProfile(); diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 8d66004ddb..386a5deec6 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -661,6 +661,10 @@ LLSettingsSky::parammapping_t LLSettingsVOSky::getParameterMap() const param_map[SETTING_MAX_Y] = LLShaderMgr::MAX_Y; param_map[SETTING_SUNLIGHT_COLOR] = LLShaderMgr::SUNLIGHT_COLOR; + param_map[SETTING_SKY_MOISTURE_LEVEL] = LLShaderMgr::MOISTURE_LEVEL; + param_map[SETTING_SKY_DROPLET_RADIUS] = LLShaderMgr::DROPLET_RADIUS; + param_map[SETTING_SKY_ICE_LEVEL] = LLShaderMgr::ICE_LEVEL; + // AdvancedAtmospherics TODO // Provide mappings for new shader params here } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 26f0ec7905..db18d6ed2c 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -8452,20 +8452,7 @@ class LLWorldEnvSettings : public view_listener_t } else if (event_name == "my_environs") { - LLUUID asset_id; - - LLSettingsBase::ptr_t cur(LLEnvironment::instance().getCurrentDay()); - if (!cur) - { - cur = LLEnvironment::instance().getCurrentSky(); - } - - if (cur) - { - asset_id = cur->getAssetId(); - } - - LLFloaterReg::showInstance("my_environments", LLSDMap("asset_id", LLSD::UUID(asset_id))); + LLFloaterReg::showInstance("my_environments"); } return true; diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 3fdcac8917..b013250bfc 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -2110,10 +2110,12 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredWLSkyProgram.mName = "Deferred Windlight Sky Shader"; //gWLSkyProgram.mFeatures.hasGamma = true; gDeferredWLSkyProgram.mShaderFiles.clear(); + gDeferredWLSkyProgram.mFeatures.calculatesAtmospherics = true; + gDeferredWLSkyProgram.mFeatures.hasTransport = true; gDeferredWLSkyProgram.mFeatures.hasGamma = true; gDeferredWLSkyProgram.mShaderFiles.push_back(make_pair("deferred/skyV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredWLSkyProgram.mShaderFiles.push_back(make_pair("deferred/skyF.glsl", GL_FRAGMENT_SHADER_ARB)); - gDeferredWLSkyProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT]; + gDeferredWLSkyProgram.mShaderLevel = gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics") ? 3 : mVertexShaderLevel[SHADER_DEFERRED]; gDeferredWLSkyProgram.mShaderGroup = LLGLSLShader::SG_SKY; if (gAtmosphere && mVertexShaderLevel[SHADER_WINDLIGHT] > 1) { @@ -2127,12 +2129,14 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() { gDeferredWLCloudProgram.mName = "Deferred Windlight Cloud Program"; gDeferredWLCloudProgram.mShaderFiles.clear(); + gDeferredWLCloudProgram.mFeatures.calculatesAtmospherics = true; + gDeferredWLCloudProgram.mFeatures.hasTransport = true; gDeferredWLCloudProgram.mFeatures.hasGamma = true; gDeferredWLCloudProgram.mShaderFiles.push_back(make_pair("deferred/cloudsV.glsl", GL_VERTEX_SHADER_ARB)); gDeferredWLCloudProgram.mShaderFiles.push_back(make_pair("deferred/cloudsF.glsl", GL_FRAGMENT_SHADER_ARB)); - gDeferredWLCloudProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; + gDeferredWLCloudProgram.mShaderLevel = gSavedSettings.getBOOL("RenderUseAdvancedAtmospherics") ? 3 : mVertexShaderLevel[SHADER_DEFERRED]; gDeferredWLCloudProgram.mShaderGroup = LLGLSLShader::SG_SKY; - if (gAtmosphere && mVertexShaderLevel[SHADER_WINDLIGHT] >= 3) + if (gAtmosphere && mVertexShaderLevel[SHADER_WINDLIGHT] > 1) { gDeferredWLSkyProgram.mExtraLinkObject = gAtmosphere->getAtmosphericShaderForLink(); } diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 705e382a99..7564a5003b 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -429,7 +429,7 @@ LLVOSky::LLVOSky(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp) mHeavenlyBodyUpdated = FALSE ; mDrawRefl = 0; - mInterpVal = 0.f; + mInterpVal = 0.f; } @@ -492,6 +492,9 @@ void LLVOSky::init() mInitialized = true; mHeavenlyBodyUpdated = FALSE ; + + mRainbowMap = LLViewerTextureManager::getFetchedTexture(psky->getRainbowTextureId(), FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); + mHaloMap = LLViewerTextureManager::getFetchedTexture(psky->getHaloTextureId(), FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI); } void LLVOSky::initCubeMap() diff --git a/indra/newview/llvosky.h b/indra/newview/llvosky.h index e465dcbe27..660db1e518 100644 --- a/indra/newview/llvosky.h +++ b/indra/newview/llvosky.h @@ -263,15 +263,18 @@ public: bool isReflFace(const LLFace* face) const { return face == mFace[FACE_REFLECTION]; } LLFace* getReflFace() const { return mFace[FACE_REFLECTION]; } - LLViewerTexture* getSunTex() const { return mSunTexturep[0]; } - LLViewerTexture* getMoonTex() const { return mMoonTexturep[0]; } - LLViewerTexture* getBloomTex() const { return mBloomTexturep[0]; } - LLViewerTexture* getCloudNoiseTex() const { return mCloudNoiseTexturep[0]; } + LLViewerTexture* getSunTex() const { return mSunTexturep[0]; } + LLViewerTexture* getMoonTex() const { return mMoonTexturep[0]; } + LLViewerTexture* getBloomTex() const { return mBloomTexturep[0]; } + LLViewerTexture* getCloudNoiseTex() const { return mCloudNoiseTexturep[0]; } - LLViewerTexture* getSunTexNext() const { return mSunTexturep[1]; } - LLViewerTexture* getMoonTexNext() const { return mMoonTexturep[1]; } - LLViewerTexture* getBloomTexNext() const { return mBloomTexturep[1]; } - LLViewerTexture* getCloudNoiseTexNext() const { return mCloudNoiseTexturep[1]; } + LLViewerTexture* getRainbowTex() const { return mRainbowMap; } + LLViewerTexture* getHaloTex() const { return mHaloMap; } + + LLViewerTexture* getSunTexNext() const { return mSunTexturep[1]; } + LLViewerTexture* getMoonTexNext() const { return mMoonTexturep[1]; } + LLViewerTexture* getBloomTexNext() const { return mBloomTexturep[1]; } + LLViewerTexture* getCloudNoiseTexNext() const { return mCloudNoiseTexturep[1]; } void setSunTextures(const LLUUID& sun_texture, const LLUUID& sun_texture_next); void setMoonTextures(const LLUUID& moon_texture, const LLUUID& moon_texture_next); @@ -299,6 +302,8 @@ protected: LLPointer<LLViewerFetchedTexture> mMoonTexturep[2]; LLPointer<LLViewerFetchedTexture> mCloudNoiseTexturep[2]; LLPointer<LLViewerFetchedTexture> mBloomTexturep[2]; + LLPointer<LLViewerFetchedTexture> mRainbowMap; + LLPointer<LLViewerFetchedTexture> mHaloMap; F32 mSunScale = 1.0f; F32 mMoonScale = 1.0f; diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index cee47a591e..a519b5a957 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -873,6 +873,57 @@ void LLWorld::waterHeightRegionInfo(std::string const& sim_name, F32 water_heigh } } +void LLWorld::precullWaterObjects(LLCamera& camera, LLCullResult* cull, bool include_void_water) +{ + if (!gAgent.getRegion()) + { + return; + } + + if (mRegionList.empty()) + { + LL_WARNS() << "No regions!" << LL_ENDL; + return; + } + + for (region_list_t::iterator iter = mRegionList.begin(); + iter != mRegionList.end(); ++iter) + { + LLViewerRegion* regionp = *iter; + LLVOWater* waterp = regionp->getLand().getWaterObj(); + if (waterp && waterp->mDrawable) + { + waterp->mDrawable->setVisible(camera); + cull->pushDrawable(waterp->mDrawable); + } + } + + if (include_void_water) + { + for (std::list<LLVOWater*>::iterator iter = mHoleWaterObjects.begin(); + iter != mHoleWaterObjects.end(); ++ iter) + { + LLVOWater* waterp = *iter; + if (waterp && waterp->mDrawable) + { + waterp->mDrawable->setVisible(camera); + cull->pushDrawable(waterp->mDrawable); + } + } + } + + S32 dir; + for (dir = 0; dir < 8; dir++) + { + LLVOWater* waterp = mEdgeWaterObjects[dir]; + if (waterp && waterp->mDrawable) + { + waterp->mDrawable->setVisible(camera); + cull->pushDrawable(waterp->mDrawable); + } + } +} + void LLWorld::updateWaterObjects() { if (!gAgent.getRegion()) diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h index c9ac241d5a..9722448746 100644 --- a/indra/newview/llworld.h +++ b/indra/newview/llworld.h @@ -138,6 +138,9 @@ public: LLViewerTexture *getDefaultWaterTexture(); void updateWaterObjects(); + + void precullWaterObjects(LLCamera& camera, LLCullResult* cull, bool include_void_water); + void waterHeightRegionInfo(std::string const& sim_name, F32 water_height); void shiftRegions(const LLVector3& offset); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index a513588568..c1b7fdc780 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -88,6 +88,7 @@ #include "llvocache.h" #include "llvoground.h" #include "llvosky.h" +#include "llvowlsky.h" #include "llvotree.h" #include "llvovolume.h" #include "llvosurfacepatch.h" @@ -2415,21 +2416,14 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl { LLVector3 pnorm; F32 height = region->getWaterHeight(); - if (water_clip < 0) - { //camera is above water, clip plane points up - pnorm.setVec(0,0,1); - plane.setVec(pnorm, -height); - } - else if (water_clip > 0) - { //camera is below water, clip plane points down - pnorm = LLVector3(0,0,-1); - plane.setVec(pnorm, height); - } + pnorm.setVec(0,0,-(F32)water_clip); + plane.setVec(pnorm, height * pnorm.mV[VZ]); } } glh::matrix4f modelview = get_last_modelview(); - glh::matrix4f proj = get_last_projection(); + glh::matrix4f proj = get_last_projection(); + LLGLUserClipPlane clip(plane, modelview, proj, water_clip != 0 && LLPipeline::sReflectionRender); LLGLDepthTest depth(GL_TRUE, GL_FALSE); @@ -2455,9 +2449,9 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl iter != LLWorld::getInstance()->getRegionList().end(); ++iter) { LLViewerRegion* region = *iter; - if (water_clip != 0) + if (water_clip != 0 && LLPipeline::sReflectionRender) { - LLPlane plane(LLVector3(0,0, (F32) -water_clip), (F32) water_clip*region->getWaterHeight()); + LLPlane plane(LLVector3(0,0, -(F32)water_clip), water_clip * region->getWaterHeight()); camera.setUserClipPlane(plane); } else @@ -2513,7 +2507,20 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl sCull->pushDrawable(gSky.mVOGroundp->mDrawable); } + if (hasRenderType(LLPipeline::RENDER_TYPE_WL_SKY) && + gPipeline.canUseWindLightShaders() && + gSky.mVOWLSkyp.notNull() && + gSky.mVOWLSkyp->mDrawable.notNull()) + { + gSky.mVOWLSkyp->mDrawable->setVisible(camera); + sCull->pushDrawable(gSky.mVOWLSkyp->mDrawable); + } + if (hasRenderType(LLPipeline::RENDER_TYPE_WATER)) + { + LLWorld::getInstance()->precullWaterObjects(camera, sCull, hasRenderType(LLPipeline::RENDER_TYPE_VOIDWATER)); + } + gGL.matrixMode(LLRender::MM_PROJECTION); gGL.popMatrix(); gGL.matrixMode(LLRender::MM_MODELVIEW); @@ -9823,21 +9830,23 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) F32 plane_d; S32 water_clip = 0; - if (!LLViewerCamera::getInstance()->cameraUnderWater()) - { //camera is above water, clip plane points up - pnorm.setVec(0,0,1); - plane_d = -water_height; - plane.setVec(pnorm, -distance_to_water); - water_clip = -1; + + if (LLViewerCamera::getInstance()->cameraUnderWater()) + { + //camera is below water, clip plane points down + water_clip = 1; } else - { //camera is below water, clip plane points down - pnorm = LLVector3(0,0,-1); - plane_d = water_height; - plane.setVec(pnorm, distance_to_water); - water_clip = 1; + { + //camera is above water, clip plane points up + water_clip = -1; } + //camera is below water, clip plane points down + pnorm = LLVector3(0,0,-(F32)water_clip); + plane_d = water_height * pnorm.mV[VZ]; + plane.setVec(pnorm, distance_to_water * pnorm.mV[VZ]); + bool materials_in_water = false; #if MATERIALS_IN_REFLECTIONS diff --git a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml index e1c08a24f2..9aa7c6f499 100644 --- a/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml +++ b/indra/newview/skins/default/xui/en/floater_edit_ext_day_cycle.xml @@ -6,9 +6,9 @@ save_rect="false" title="Edit Day Cycle" width="705" - height="650" + height="700" min_width="705" - min_height="650" + min_height="700" single_instance="true" can_resize="false"> @@ -25,7 +25,7 @@ <!-- Layout --> <layout_stack name="outer_stack" width="705" - height="650" + height="700" follows="all" animate="false" top="0" diff --git a/indra/newview/skins/default/xui/en/panel_settings_sky_density.xml b/indra/newview/skins/default/xui/en/panel_settings_sky_density.xml index e9aa07957e..a21ba44b32 100644 --- a/indra/newview/skins/default/xui/en/panel_settings_sky_density.xml +++ b/indra/newview/skins/default/xui/en/panel_settings_sky_density.xml @@ -22,7 +22,7 @@ auto_resize="true" user_resize="false" visible="true" - height="14"> + height="12"> <slider decimal_digits="6" follows="left|top" @@ -101,7 +101,7 @@ auto_resize="true" user_resize="false" visible="true" - height="16"> + height="14"> <slider decimal_digits="6" follows="left|top" @@ -195,7 +195,7 @@ auto_resize="true" user_resize="false" visible="true" - height="14"> + height="12"> <slider decimal_digits="6" follows="left|top" @@ -269,5 +269,55 @@ label_width="160" can_edit_text="true"/> </layout_panel> + <layout_panel + border="true" + bevel_style="in" + auto_resize="true" + user_resize="false" + visible="true" + height="14"> + <slider + decimal_digits="3" + follows="left|top" + height="14" + increment="0.001" + initial_value="0" + layout="topleft" + min_val="0" + max_val="1" + name="moisture_level" + label="Moisture Level:" + width="400" + label_width="160" + can_edit_text="true"/> + <slider + decimal_digits="2" + follows="left|top" + height="14" + increment="0.01" + initial_value="0" + layout="topleft" + min_val="5.0" + max_val="1000.0" + name="droplet_radius" + label="Droplet Radius:" + width="400" + label_width="160" + can_edit_text="true"/> + <slider + decimal_digits="1" + follows="left|top" + height="14" + increment="0.1" + initial_value="0" + layout="topleft" + min_val="0" + max_val="1" + name="ice_level" + label="Ice Level:" + width="400" + label_width="160" + can_edit_text="true"/> + </layout_panel> </layout_stack> </panel> diff --git a/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml b/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml index 6d12f6bb94..1332ecd965 100644 --- a/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml +++ b/indra/newview/skins/default/xui/en/panel_settings_sky_sunmoon.xml @@ -14,14 +14,14 @@ top="5" right="-5" bottom="-5" - orientation="hoizontal"> + orientation="horizontal"> <layout_panel border="true" bevel_style="in" auto_resize="true" user_resize="false" visible="true" - height="350"> + height="400"> <text follows="left|top" height="10" @@ -176,6 +176,29 @@ top_delta="15" width="250" can_edit_text="true"/> + <text + follows="left|top" + height="10" + layout="topleft" + left_delta="-5" + top_delta="22" + width="200"> + Moon Brightness: + </text> + <slider + decimal_digits="2" + follows="left|top" + height="16" + increment="0.01" + initial_value="0" + layout="topleft" + left_delta="5" + min_val="0.0" + max_val="1.0" + name="moon_brightness" + top_delta="15" + width="250" + can_edit_text="true"/> </layout_panel> <layout_panel border="false" @@ -183,7 +206,7 @@ auto_resize="true" user_resize="false" visible="true" - height="350"> + height="400"> <layout_stack left="5" top="5" |