summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llrender/llrender.cpp1
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/skyF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/skyV.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class3/lighting/lightV.glsl4
-rw-r--r--indra/newview/pipeline.cpp16
9 files changed, 34 insertions, 16 deletions
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index f3771f3bf2..c536b403ef 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -1228,6 +1228,7 @@ void LLRender::syncLightState()
shader->uniform3fv(LLShaderMgr::LIGHT_DIFFUSE, 8, diffuse[0].mV);
shader->uniform4fv(LLShaderMgr::LIGHT_AMBIENT, 1, mAmbientLightColor.mV);
shader->uniform1i(LLShaderMgr::SUN_UP_FACTOR, sun_primary[0] ? 1 : 0);
+ shader->uniform4fv(LLShaderMgr::SUNLIGHT_COLOR, 1, diffuse[0].mV);
shader->uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, diffuse_b[0].mV);
}
}
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
index a3041fccdc..6788cc1f63 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
@@ -68,7 +68,7 @@ void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, o
vec4 light_atten;
float dens_mul = density_multiplier;
- float dist_mul = distance_multiplier * 0.1;
+ float dist_mul = distance_multiplier;
//sunlight attenuation effect (hue and brightness) due to atmosphere
//this is used later for sunlight modulation at various altitudes
diff --git a/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl
index bd0ca0a46e..eb95890e08 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl
@@ -44,6 +44,7 @@ uniform float haze_density;
uniform float cloud_shadow;
uniform float density_multiplier;
+uniform float distance_multiplier;
uniform float max_y;
uniform vec4 glow;
@@ -117,7 +118,8 @@ void main()
vec4 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color;
vec4 light_atten;
- float dens_mul = density_multiplier * 0.45;
+ float dens_mul = density_multiplier;
+ float dist_mul = distance_multiplier;
// Sunlight attenuation effect (hue and brightness) due to atmosphere
// this is used later for sunlight modulation at various altitudes
@@ -139,8 +141,7 @@ void main()
// Transparency (-> temp1)
// ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati
// compiler gets confused.
- temp1 = exp(-temp1 * temp2.z);
-
+ temp1 = exp(-temp1 * temp2.z * dist_mul);
// Compute haze glow
temp2.x = dot(Pn, lightnorm.xyz);
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
index 36703ea742..9db04f4e9a 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
@@ -37,6 +37,8 @@ uniform vec4 blue_density;
uniform float haze_horizon;
uniform float haze_density;
uniform float cloud_shadow;
+uniform float density_multiplier;
+uniform float distance_multiplier;
uniform float max_y;
uniform vec4 glow;
uniform float scene_light_strength;
@@ -53,7 +55,7 @@ vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten)
return light;
}
light *= atten.r;
- light += additive * exp(-1.0f);
+ light += additive;
return light * 2.0;
}
diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl
index 1de919bf30..396ceacd19 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl
@@ -86,14 +86,14 @@ void main()
vec2 disturbance2 = vec2(cloudNoise((uv1 + uv3) / 4.0f).x, cloudNoise((uv4 + uv2) / 8.0f).x) * cloud_variance * (1.0f - cloud_scale * 0.25f);
// Offset texture coords
- uv1 += cloud_pos_density1.xy;// + (disturbance * 0.02); //large texture, visible density
+ uv1 += cloud_pos_density1.xy + (disturbance * 0.02); //large texture, visible density
uv2 += cloud_pos_density1.xy; //large texture, self shadow
uv3 += cloud_pos_density2.xy; //small texture, visible density
uv4 += cloud_pos_density2.xy; //small texture, self shadow
float density_variance = min(1.0, (disturbance.x* 2.0 + disturbance.y* 2.0 + disturbance2.x + disturbance2.y));
- //cloudDensity *= 1.0 - (density_variance * density_variance);
+ cloudDensity *= 1.0 - (density_variance * density_variance);
// Compute alpha1, the main cloud opacity
@@ -104,7 +104,7 @@ void main()
alpha1 = 1. - alpha1 * alpha1;
alpha1 = 1. - alpha1 * alpha1;
- //alpha1 *= altitude_blend_factor;
+ alpha1 *= altitude_blend_factor;
//if (alpha1 < 0.001f)
//{
diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
index 43500bc5e3..aaf995af3c 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
@@ -57,6 +57,7 @@ uniform float haze_density;
uniform float cloud_shadow;
uniform float density_multiplier;
+uniform float distance_multiplier;
uniform float max_y;
uniform vec4 glow;
@@ -103,7 +104,8 @@ void main()
vec4 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color;
vec4 light_atten;
- float dens_mul = density_multiplier * 0.45;
+ float dens_mul = density_multiplier;
+ float dist_mul = distance_multiplier;
// Sunlight attenuation effect (hue and brightness) due to atmosphere
// this is used later for sunlight modulation at various altitudes
@@ -125,8 +127,7 @@ void main()
// Transparency (-> temp1)
// ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati
// compiler gets confused.
- temp1 = exp(-temp1 * temp2.z);
-
+ temp1 = exp(-temp1 * temp2.z * dist_mul);
// Compute haze glow
temp2.x = dot(Pn, lightnorm.xyz);
diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
index f6bef3e6bc..a23a5d4076 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
@@ -49,6 +49,7 @@ uniform float haze_density;
uniform float cloud_shadow;
uniform float density_multiplier;
+uniform float distance_multiplier;
uniform float max_y;
uniform vec4 glow;
@@ -109,7 +110,7 @@ void main()
// Transparency (-> temp1)
// ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati
// compiler gets confused.
- temp1 = exp(-temp1 * temp2.z);
+ temp1 = exp(-temp1 * temp2.z * distance_multiplier);
// Compute haze glow
diff --git a/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl b/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl
index 69267621a3..48c883d98a 100644
--- a/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl
+++ b/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl
@@ -31,8 +31,8 @@ vec4 sumLights(vec3 pos, vec3 norm, vec4 color);
vec4 calcLighting(vec3 pos, vec3 norm, vec4 color)
{
- vec4 c = sumLights(pos, norm, color * 2.0);
+ vec4 c = sumLights(pos, norm, color);
c.rgb += atmosAmbient() * color.rgb;
- return c * 2.0;
+ return c;
}
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index c57b267c92..211993fb46 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -6203,7 +6203,8 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
gGL.setAmbientLightColor(ambient);
}
- bool sun_up = environment.getIsSunUp();
+ bool sun_up = environment.getIsSunUp();
+ bool moon_up = environment.getIsMoonUp();
// Light 0 = Sun or Moon (All objects)
{
@@ -6212,7 +6213,9 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
mSunDir.setVec(sun_dir);
mMoonDir.setVec(moon_dir);
- mSunDiffuse.setVec(psky->getSunDiffuse());
+
+ // calculates diffuse sunlight per-pixel downstream, just provide setting sunlight_color
+ mSunDiffuse.setVec(psky->getSunlightColor());
mMoonDiffuse.setVec(psky->getMoonDiffuse());
F32 max_color = llmax(mSunDiffuse.mV[0], mSunDiffuse.mV[1], mSunDiffuse.mV[2]);
@@ -6229,6 +6232,15 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
}
mMoonDiffuse.clamp();
+ // prevent underlighting from having neither lightsource facing us
+ if (!sun_up && !moon_up)
+ {
+ mSunDiffuse.setVec(LLColor4(0.0, 0.0, 0.0, 1.0));
+ mMoonDiffuse.setVec(LLColor4(0.0, 0.0, 0.0, 1.0));
+ mSunDir.setVec(LLVector4(0.0, 1.0, 0.0, 0.0));
+ mMoonDir.setVec(LLVector4(0.0, 1.0, 0.0, 0.0));
+ }
+
LLVector4 light_dir = sun_up ? mSunDir : mMoonDir;
mHWLightColors[0] = mSunDiffuse;