summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-02-22 15:42:07 -0800
committerGraham Linden <graham@lindenlab.com>2019-02-22 15:42:07 -0800
commitf8f250f80bd7a401fb0518a09c0067529e7c59cb (patch)
tree253e069fed3f5e5d223a0f4c23813627e169d9ce /indra/newview
parent7989df1c3623f9402248aa74bdec20dff6d78fd1 (diff)
parent8bebb385fe1f7df22c7fd040eceaaf1b3bcbef75 (diff)
Merge
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialF.glsl21
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl35
-rw-r--r--indra/newview/llfloatereditextdaycycle.cpp12
-rw-r--r--indra/newview/llviewershadermgr.cpp30
-rw-r--r--indra/newview/pipeline.cpp5
6 files changed, 70 insertions, 46 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
index c8f4d7c570..251e60c59e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
@@ -202,7 +202,8 @@ void main()
#endif
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
- vec3 gamma_diff = linear_to_srgb(diffcol.rgb);
+ vec3 gamma_diff = diffcol.rgb;
+ diffcol.rgb = srgb_to_linear(diffcol.rgb);
#endif
#if HAS_SPECULAR_MAP
@@ -280,20 +281,17 @@ void main()
final_da = min(final_da, 1.0f);
final_da = pow(final_da, display_gamma);
- col.rgb = (col * 0.5) + amblit;
+ col.rgb = amblit;
float ambient = min(abs(final_da), 1.0);
ambient *= 0.5;
ambient *= ambient;
ambient = (1.0-ambient);
- col.rgb *= ambient;
-
- col.rgb = col.rgb + (final_da * sunlit);
-
+ col.rgb *= min(ambient, max(shadow,0.3));
+ col.rgb += (final_da * sunlit);
col.rgb *= gamma_diff.rgb;
-
float glare = 0.0;
if (spec.a > 0.0) // specular reflection
@@ -315,6 +313,7 @@ void main()
col += spec_contrib;
}
+vec3 post_spec = col.rgb;
col = mix(col.rgb, diffcol.rgb, diffuse.a);
@@ -337,6 +336,8 @@ void main()
col = atmosFragLighting(col, additive, atten);
col = scaleSoftClipFrag(col);
+vec3 post_atmo= col.rgb;
+
vec3 npos = normalize(-pos.xyz);
vec3 light = vec3(0,0,0);
@@ -353,18 +354,24 @@ void main()
col.rgb += light.rgb;
+vec3 post_lighting = col.rgb;
+
glare = min(glare, 1.0);
float al = max(diffcol.a,glare)*vertex_color.a;
//convert to gamma space for display on screen
col.rgb = linear_to_srgb(col.rgb);
+vec3 post_srgb = col.rgb;
+
#ifdef WATER_FOG
vec4 temp = applyWaterFogView(pos, vec4(col.rgb, al));
col.rgb = temp.rgb;
al = temp.a;
#endif
+//col.rgb = post_lighting;
+
frag_color.rgb = col.rgb;
frag_color.a = al;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl
index 5cc24475e3..ad96c84de8 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl
@@ -49,8 +49,8 @@ uniform int sun_up_factor;
float pcfShadow(sampler2DShadow shadowMap, vec3 norm, vec4 stc, float bias_mul, vec2 pos_screen, vec3 light_dir)
{
stc.xyz /= stc.w;
- stc.z += shadow_bias * bias_mul* 2.0;
- stc.x = floor(stc.x*shadow_res.x + fract(stc.y*pos_screen.y*pos_screen.x))/shadow_res.x; // add some chaotic jitter to X sample pos according to Y to disguise the snapping going on here
+ stc.z += shadow_bias * bias_mul * 2.0;
+ stc.x = floor(stc.x*shadow_res.x + fract(stc.y*shadow_res.y))/shadow_res.x; // add some chaotic jitter to X sample pos according to Y to disguise the snapping going on here
float cs = shadow2D(shadowMap, stc.xyz).x;
float shadow = cs * 4.0;
@@ -90,7 +90,9 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
dp_directional_light = clamp(dp_directional_light, 0.0, 1.0);
vec3 shadow_pos = pos.xyz;
- vec3 offset = abs(light_dir.xyz) * (1.0 - dp_directional_light* 0.8);
+
+ vec3 offset = light_dir.xyz * (1.0 - dp_directional_light);
+
shadow_pos += offset * shadow_offset;
vec4 spos = vec4(shadow_pos.xyz, 1.0);
@@ -109,7 +111,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
float w = 1.0;
w -= max(spos.z-far_split.z, 0.0)/transition_domain.z;
- shadow += pcfShadow(shadowMap3, norm, lpos, 4.0, pos_screen, light_dir)*w;
+ shadow += pcfShadow(shadowMap3, norm, lpos, 1.0, pos_screen, light_dir)*w;
weight += w;
shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0);
}
@@ -121,7 +123,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
float w = 1.0;
w -= max(spos.z-far_split.y, 0.0)/transition_domain.y;
w -= max(near_split.z-spos.z, 0.0)/transition_domain.z;
- shadow += pcfShadow(shadowMap2, norm, lpos, 2.0, pos_screen, light_dir)*w;
+ shadow += pcfShadow(shadowMap2, norm, lpos, 1.0, pos_screen, light_dir)*w;
weight += w;
}
@@ -153,6 +155,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
{
return 1.0f; // lit beyond the far split...
}
+ shadow = min(dp_directional_light,shadow);
return shadow;
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index 8bc9add5cf..7fd4d7e248 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -90,17 +90,16 @@ void main()
vec4 norm = texture2DRect(normalMap, tc);
float envIntensity = norm.z;
norm.xyz = getNorm(tc); // unpack norm
-
- float da_sun = dot(norm.xyz, sun_dir.xyz);
- float da_moon = dot(norm.xyz, moon_dir.xyz);
- float da = (sun_up_factor == 1) ? da_sun : da_moon;
- da = clamp(da, 0.0, 1.0);
- da = pow(da, global_gamma + 0.3);
+ vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir;
+
+ float da = dot(norm.xyz, light_dir.xyz);
+ da = clamp(da, 0.0, 1.0);
vec4 diffuse = texture2DRect(diffuseRect, tc);
vec3 col;
+ float scol = 1.0;
float bloom = 0.0;
{
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
@@ -108,9 +107,13 @@ void main()
vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg;
scol_ambocc = pow(scol_ambocc, vec2(global_gamma + 0.3));
- float scol = max(scol_ambocc.r, diffuse.a);
+ scol = max(scol_ambocc.r, diffuse.a);
float ambocc = scol_ambocc.g;
+ float final_da = da;
+ final_da = min(final_da, scol);
+ final_da = pow(final_da, global_gamma + 0.3);
+
vec3 sunlit;
vec3 amblit;
vec3 additive;
@@ -118,18 +121,17 @@ void main()
calcFragAtmospherics(pos.xyz, ambocc, sunlit, amblit, additive, atten);
- float ambient = da;
-
+ float ambient = min(da, 1.0);
ambient *= 0.5;
ambient *= ambient;
- ambient = (1.0-ambient);
-
- col.rgb = amblit;
- col.rgb *= min(ambient, max(scol, 0.5));
+ ambient = min(1.0 - ambient,max(scol,0.3));
- col += sunlit * da * scol;
+ vec3 sun_contrib = sunlit * final_da;
- col *= diffuse.rgb;
+ col.rgb = amblit;
+ col.rgb *= ambient;
+ col.rgb += sun_contrib;
+ col.rgb *= diffuse.rgb;
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
@@ -165,9 +167,6 @@ void main()
col = fogged.rgb;
bloom = fogged.a;
#endif
-
-//col.rgb = vec3(scol);
-//col.rgb = vec3(da * scol);
}
frag_color.rgb = col;
frag_color.a = bloom;
diff --git a/indra/newview/llfloatereditextdaycycle.cpp b/indra/newview/llfloatereditextdaycycle.cpp
index 3b148fa89e..18f22bf2d2 100644
--- a/indra/newview/llfloatereditextdaycycle.cpp
+++ b/indra/newview/llfloatereditextdaycycle.cpp
@@ -838,20 +838,10 @@ void LLFloaterEditExtDayCycle::onCloneTrack()
args.append(track);
}
- if (populated_counter > 1)
+ if (populated_counter > 0)
{
doOpenTrackFloater(args);
}
- else if (populated_counter > 0)
- {
- for (U32 i = 1; i < LLSettingsDay::TRACK_MAX; i++)
- {
- if ((!mEditDay->isTrackEmpty(i)) && (i != mCurrentTrack))
- {
- onPickerCommitTrackId(i);
- }
- }
- }
else
{
// Should not happen
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index a81b20747d..c07a4b3a7d 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -2196,6 +2196,17 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
{
gDeferredTerrainProgram.mName = "Deferred Terrain Shader";
gDeferredTerrainProgram.mFeatures.encodesNormal = true;
+ gDeferredTerrainProgram.mFeatures.hasSrgb = true;
+ gDeferredTerrainProgram.mFeatures.calculatesLighting = false;
+ gDeferredTerrainProgram.mFeatures.hasLighting = false;
+ gDeferredTerrainProgram.mFeatures.isAlphaLighting = true;
+ gDeferredTerrainProgram.mFeatures.disableTextureIndex = true; //hack to disable auto-setup of texture channels
+ gDeferredTerrainProgram.mFeatures.hasWaterFog = true;
+ gDeferredTerrainProgram.mFeatures.calculatesAtmospherics = true;
+ gDeferredTerrainProgram.mFeatures.hasAtmospherics = true;
+ gDeferredTerrainProgram.mFeatures.hasGamma = true;
+ gDeferredTerrainProgram.mFeatures.hasTransport = true;
+
gDeferredTerrainProgram.mShaderFiles.clear();
gDeferredTerrainProgram.mShaderFiles.push_back(make_pair("deferred/terrainV.glsl", GL_VERTEX_SHADER_ARB));
gDeferredTerrainProgram.mShaderFiles.push_back(make_pair("deferred/terrainF.glsl", GL_FRAGMENT_SHADER_ARB));
@@ -2208,8 +2219,17 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
{
gDeferredTerrainWaterProgram.mName = "Deferred Terrain Underwater Shader";
gDeferredTerrainWaterProgram.mFeatures.encodesNormal = true;
- gDeferredTerrainWaterProgram.mFeatures.hasWaterFog = true;
gDeferredTerrainWaterProgram.mFeatures.hasSrgb = true;
+ gDeferredTerrainWaterProgram.mFeatures.calculatesLighting = false;
+ gDeferredTerrainWaterProgram.mFeatures.hasLighting = false;
+ gDeferredTerrainWaterProgram.mFeatures.isAlphaLighting = true;
+ gDeferredTerrainWaterProgram.mFeatures.disableTextureIndex = true; //hack to disable auto-setup of texture channels
+ gDeferredTerrainWaterProgram.mFeatures.hasWaterFog = true;
+ gDeferredTerrainWaterProgram.mFeatures.calculatesAtmospherics = true;
+ gDeferredTerrainWaterProgram.mFeatures.hasAtmospherics = true;
+ gDeferredTerrainWaterProgram.mFeatures.hasGamma = true;
+ gDeferredTerrainWaterProgram.mFeatures.hasTransport = true;
+
gDeferredTerrainWaterProgram.mShaderFiles.clear();
gDeferredTerrainWaterProgram.mShaderFiles.push_back(make_pair("deferred/terrainV.glsl", GL_VERTEX_SHADER_ARB));
gDeferredTerrainWaterProgram.mShaderFiles.push_back(make_pair("deferred/terrainF.glsl", GL_FRAGMENT_SHADER_ARB));
@@ -3400,9 +3420,9 @@ BOOL LLViewerShaderMgr::loadShadersObject()
BOOL LLViewerShaderMgr::loadShadersAvatar()
{
- BOOL success = TRUE;
+ BOOL success = TRUE;
- if (mShaderLevel[SHADER_AVATAR] == 0)
+ if (mShaderLevel[SHADER_AVATAR] == 0)
{
gAvatarProgram.unload();
gAvatarWaterProgram.unload();
@@ -3411,7 +3431,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar()
return TRUE;
}
- if (success)
+ if (success)
{
gAvatarProgram.mName = "Avatar Shader";
gAvatarProgram.mFeatures.hasSkinning = true;
@@ -3455,7 +3475,7 @@ BOOL LLViewerShaderMgr::loadShadersAvatar()
}
}
- if (success)
+ if (success)
{
gAvatarPickProgram.mName = "Avatar Pick Shader";
gAvatarPickProgram.mFeatures.hasSkinning = true;
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 490738d304..b6e35fb6ea 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -8497,8 +8497,12 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
shader.uniform1f(LLShaderMgr::DEFERRED_DEPTH_CUTOFF, RenderEdgeDepthCutoff);
shader.uniform1f(LLShaderMgr::DEFERRED_NORM_CUTOFF, RenderEdgeNormCutoff);
+ shader.uniform4fv(LLShaderMgr::SUNLIGHT_COLOR, 1, mSunDiffuse.mV);
+ shader.uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, mMoonDiffuse.mV);
+
LLEnvironment& environment = LLEnvironment::instance();
shader.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
+ shader.uniform1f(LLShaderMgr::SUN_MOON_GLOW_FACTOR, environment.getCurrentSky()->getSunMoonGlowFactor());
if (shader.getUniformLocation(LLShaderMgr::DEFERRED_NORM_MATRIX) >= 0)
{
@@ -8591,6 +8595,7 @@ void LLPipeline::renderDeferredLighting(LLRenderTarget* screen_target)
mTransformedSunDir.set(tc.v);
glh::vec4f tc_moon(mMoonDir.mV);
+ mat.mult_matrix_vec(tc_moon);
mTransformedMoonDir.set(tc_moon.v);
gGL.pushMatrix();