summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llrender/llrender.cpp4
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/waterF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl32
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl6
-rw-r--r--indra/newview/llmaterialeditor.cpp4
-rw-r--r--indra/newview/llsettingsvo.cpp8
6 files changed, 28 insertions, 30 deletions
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index c7eb4613c1..6e659641fe 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -979,10 +979,6 @@ void LLRender::syncLightState()
shader->uniform4fv(LLShaderMgr::AMBIENT, 1, mAmbientLightColor.mV);
shader->uniform4fv(LLShaderMgr::SUNLIGHT_COLOR, 1, diffuse[0].mV);
shader->uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, diffuse_b[0].mV);
-
- shader->uniform3fv(LLShaderMgr::AMBIENT_LINEAR, 1, linearColor3(mAmbientLightColor).mV);
- shader->uniform3fv(LLShaderMgr::SUNLIGHT_LINEAR, 1, linearColor3(diffuse[0]).mV);
- shader->uniform3fv(LLShaderMgr::MOONLIGHT_LINEAR, 1, linearColor3(diffuse_b[0]).mV);
}
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
index c9e7552312..58a444a763 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
@@ -178,9 +178,9 @@ void main()
// TODO: The non-obvious assignment below is copied from the pre-EEP WL shader code
// Unfortunately, fixing it causes a mismatch for EEP, and so it remains... for now
// SL-12975 (unfix pre-EEP broken alpha)
- frag_data[0] = vec4(srgb_to_linear(color.rgb), 0.0); // Effectively, color.rgbr
+ frag_data[0] = vec4(srgb_to_linear(color.rgb), 0.0);
- frag_data[1] = vec4(1.0, 0.2, 0.0, 0.0); // speccolor, spec
+ frag_data[1] = vec4(1.0, 0.1, 0.0, 0.0); // occlusion, roughness, metalness
frag_data[2] = vec4(encode_normal(screenspacewavef.xyz), 0.0, GBUFFER_FLAG_HAS_PBR);// normalxy, env intens, flags (atmo kill)
frag_data[3] = vec4(srgb_to_linear(refcol.rgb),0);
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl
index 3d6c15fe55..739f00a8b0 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl
@@ -142,7 +142,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou
}
-
+vec3 srgb_to_linear(vec3 col);
// return colors in linear space
void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive,
@@ -155,19 +155,17 @@ void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 light_dir, float ambFact
vec3 rel_pos_norm = normalize(rel_pos);
float rel_pos_len = length(rel_pos);
- vec3 sunlight = (sun_up_factor == 1) ? sunlight_linear : moonlight_linear;
+ vec4 sunlight = (sun_up_factor == 1) ? vec4(sunlight_linear, 0.0) : vec4(moonlight_linear, 0.0);
// sunlight attenuation effect (hue and brightness) due to atmosphere
// this is used later for sunlight modulation at various altitudes
- vec3 light_atten = (blue_density_linear + vec3(haze_density_linear * 0.25)) * (density_multiplier * max_y);
+ vec4 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
-
- vec3 combined_haze_linear = blue_density_linear + vec3(haze_density_linear);
- vec3 combined_haze = blue_density.rgb + vec3(haze_density);
- vec3 blue_weight = blue_density_linear / combined_haze_linear;
- vec3 haze_weight = vec3(haze_density_linear) / combined_haze_linear;
+ vec4 combined_haze = blue_density + vec4(haze_density);
+ vec4 blue_weight = blue_density / combined_haze;
+ vec4 haze_weight = vec4(haze_density) / combined_haze;
//(TERRAIN) compute sunlight from lightnorm y component. Factor is roughly cosecant(sun elevation) (for short rays like terrain)
float above_horizon_factor = 1.0 / max(1e-6, lightnorm.y);
@@ -180,7 +178,7 @@ void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 light_dir, float ambFact
// ATI Bugfix -- can't store combined_haze*density_dist*distance_multiplier in a variable because the ati
// compiler gets confused.
combined_haze = exp(-combined_haze * density_dist * distance_multiplier);
- combined_haze_linear = exp(-combined_haze_linear * density_dist * distance_multiplier);
+
// final atmosphere attenuation factor
atten = combined_haze.rgb;
@@ -205,24 +203,26 @@ void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 light_dir, float ambFact
haze_glow *= sun_moon_glow_factor;
- vec3 amb_color = ambient_linear;
+ //vec4 amb_color = vec4(ambient_linear, 0.0);
+ vec4 amb_color = ambient_color;
// increase ambient when there are more clouds
- vec3 tmpAmbient = amb_color + (vec3(1.) - amb_color) * cloud_shadow * 0.5;
+ vec4 tmpAmbient = amb_color + (vec4(1.) - amb_color) * cloud_shadow * 0.5;
// Similar/Shared Algorithms:
// indra\llinventory\llsettingssky.cpp -- LLSettingsSky::calculateLightSettings()
// indra\newview\app_settings\shaders\class1\windlight\atmosphericsFuncs.glsl -- calcAtmosphericVars()
// haze color
vec3 cs = sunlight.rgb * (1. - cloud_shadow);
- additive = (blue_horizon_linear.rgb * blue_weight.rgb) * (cs + tmpAmbient.rgb) + (haze_horizon * haze_weight.rgb) * (cs * haze_glow + tmpAmbient.rgb);
+ additive = (blue_horizon.rgb * blue_weight.rgb) * (cs + tmpAmbient.rgb) + (haze_horizon * haze_weight.rgb) * (cs * haze_glow + tmpAmbient.rgb);
// brightness of surface both sunlight and ambient
sunlit = sunlight.rgb;
amblit = tmpAmbient.rgb;
- additive *= vec3(1.0 - combined_haze_linear);
+ additive *= vec3(1.0 - combined_haze);
+
+ //sunlit = srgb_to_linear(sunlit);
+ amblit = ambient_linear;
+ additive = srgb_to_linear(additive*1.5);
- sunlit *= 0.8;
- amblit *= 0.05;
- additive *= 0.25;
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
index 1795f3fd1a..7635897db1 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
@@ -156,7 +156,7 @@ void main()
vec3 radiance = vec3(0);
sampleReflectionProbes(irradiance, radiance, pos.xyz, norm.xyz, gloss);
- irradiance = max(amblit*2.0*ao,irradiance);
+ irradiance = max(amblit*0.75,irradiance);
vec3 f0 = vec3(0.04);
vec3 baseColor = diffuse.rgb;
@@ -169,8 +169,8 @@ void main()
vec3 v = -normalize(pos.xyz);
float NdotV = clamp(abs(dot(norm.xyz, v)), 0.001, 1.0);
- color.rgb += pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, norm.xyz, v, normalize(light_dir)) * sunlit*2.75 * scol;
- color.rgb += colorEmissive;
+ color.rgb += pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, norm.xyz, v, normalize(light_dir)) * sunlit * 2.75 * scol;
+ color.rgb += colorEmissive*0.5;
color.rgb += pbrIbl(diffuseColor, specularColor, radiance, irradiance, ao, NdotV, perceptualRoughness);
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp
index 3245c6629a..27694e9ce4 100644
--- a/indra/newview/llmaterialeditor.cpp
+++ b/indra/newview/llmaterialeditor.cpp
@@ -413,12 +413,12 @@ void LLMaterialEditor::setEmissiveUploadId(const LLUUID& id)
LLColor4 LLMaterialEditor::getEmissiveColor()
{
- return LLColor4(childGetValue("emissive color"));
+ return linearColor4(LLColor4(childGetValue("emissive color")));
}
void LLMaterialEditor::setEmissiveColor(const LLColor4& color)
{
- childSetValue("emissive color", color.getValue());
+ childSetValue("emissive color", srgbColor4(color).getValue());
}
LLUUID LLMaterialEditor::getNormalId()
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index a5a8ec4a93..6cd4c973d9 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -710,7 +710,9 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
LLColor4 ambient(getTotalAmbient());
shader->uniform4fv(LLShaderMgr::AMBIENT, LLVector4(ambient.mV));
- shader->uniform3fv(LLShaderMgr::AMBIENT_LINEAR, LLVector3(linearColor3(LLColor3(ambient.mV)).mV));
+ shader->uniform3fv(LLShaderMgr::AMBIENT_LINEAR, linearColor3v(getAmbientColor()/3.f)); // note magic number 3.f comes from SLIDER_SCALE_SUN_AMBIENT
+ shader->uniform3fv(LLShaderMgr::SUNLIGHT_LINEAR, linearColor3v(getSunlightColor()));
+ shader->uniform3fv(LLShaderMgr::MOONLIGHT_LINEAR,linearColor3v(getMoonlightColor()));
shader->uniform1f(LLShaderMgr::REFLECTION_PROBE_AMBIANCE, getReflectionProbeAmbiance());
shader->uniform1i(LLShaderMgr::SUN_UP_FACTOR, getIsSunUp() ? 1 : 0);
@@ -724,8 +726,8 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
shader->uniform1f(LLShaderMgr::GAMMA, g);
shader->uniform1f(LLShaderMgr::DISPLAY_GAMMA, display_gamma);
- shader->uniform3fv(LLShaderMgr::BLUE_HORIZON_LINEAR, linearColor3v(getBlueHorizon()));
- shader->uniform3fv(LLShaderMgr::BLUE_DENSITY_LINEAR, linearColor3v(getBlueDensity()));
+ shader->uniform3fv(LLShaderMgr::BLUE_HORIZON_LINEAR, linearColor3v(getBlueHorizon()/2.f)); // note magic number of 2.f comes from SLIDER_SCALE_BLUE_HORIZON_DENSITY
+ shader->uniform3fv(LLShaderMgr::BLUE_DENSITY_LINEAR, linearColor3v(getBlueDensity()/2.f));
shader->uniform1f(LLShaderMgr::HAZE_DENSITY_LINEAR, sRGBtoLinear(getHazeDensity()));
}