summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-04-29 11:11:05 -0700
committerGraham Linden <graham@lindenlab.com>2019-04-29 11:11:05 -0700
commit0f83696585b8810c24d535432716215caf0c21e9 (patch)
tree25bcabd6ae10702922e887c701cde9eaf1a07335 /indra
parenteff7acfb1caaa092a88555fca752dc9aea11625e (diff)
SL-10956, SL-10969
Don't ignore far z in culling. Fix Mid lighting being very dark. Partial fix for broken projectors with forward rendering.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl15
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialF.glsl18
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class3/lighting/lightV.glsl6
-rw-r--r--indra/newview/pipeline.cpp16
6 files changed, 30 insertions, 34 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index 11fcb3e87a..1acb76bdd1 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -98,8 +98,9 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec
float da = 1.0;
vec3 col = vec3(0);
if (proj_tc.z < 0
- || proj_tc.x < 0
|| proj_tc.z > 1
+ || proj_tc.x < 0
+ || proj_tc.x > 1
|| proj_tc.y < 0
|| proj_tc.y > 1)
{
@@ -139,7 +140,9 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec
amb_da *= dist_atten;
amb_da = min(amb_da, 1.0f - lit);
+#ifndef NO_AMBIANCE
col.rgb += amb_da * 0.5 * light_col * diffuse;
+#endif
// no spec for alpha shader...
}
@@ -260,17 +263,9 @@ vec3 post_atmo = color.rgb;
LIGHT_LOOP(6)
LIGHT_LOOP(7)
-vec3 light_linear = light.rgb;
+ color.rgb = linear_to_srgb(color.rgb);
- // keep it linear
- //
color.rgb += light.rgb;
-
-vec3 postlight_linear = color.rgb;
-
-//color.rgb = light_linear;
-
- color.rgb = linear_to_srgb(color.rgb);
#endif
#ifdef WATER_FOG
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
index f21b7644bb..cbb7a04631 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
@@ -101,8 +101,9 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe
vec4 proj_tc = proj_mat * lp;
if (proj_tc.z < 0
- || proj_tc.x < 0
|| proj_tc.z > 1
+ || proj_tc.x < 0
+ || proj_tc.x > 1
|| proj_tc.y < 0
|| proj_tc.y > 1)
{
@@ -119,7 +120,11 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe
fa += 1.0f;
float dist_atten = ( fa > 0) ? clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0) : 1.0f;
dist_atten *= dist_atten;
- dist_atten *= 2.0f;
+
+ if (dist_atten <= 0)
+ {
+ return col;
+ }
// spotlight coefficient.
float spot = max(dot(-ln, lv), is_pointlight);
@@ -141,7 +146,9 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe
amb_da += (da*da*0.5+0.5) * ambiance;
amb_da = min(amb_da, 1.0f - lit);
+#ifndef NO_AMBIANCE
col.rgb += amb_da * 0.5 * light_col * diffuse;
+#endif
if (spec.a > 0.0)
{
@@ -172,7 +179,6 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe
}
return max(col, vec3(0.0,0.0,0.0));
-
}
#else
@@ -405,10 +411,6 @@ vec3 post_atmo = col.rgb;
LIGHT_LOOP(6)
LIGHT_LOOP(7)
-vec3 light_linear = light.rgb;
-
- col.rgb += light_linear;
-
vec3 postlight_linear = col.rgb;
glare = min(glare, 1.0);
@@ -424,6 +426,8 @@ vec3 postlight_linear = col.rgb;
col.rgb = linear_to_srgb(col.rgb);
+ col.rgb += light.rgb;
+
frag_color.rgb = col.rgb;
frag_color.a = al;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
index a82d738ec2..9cd5592d7c 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
@@ -224,7 +224,10 @@ void main()
amb_da *= dist_atten * noise;
amb_da = min(amb_da, 1.0-lit);
+#ifndef NO_AMBIANCE
col += amb_da*color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
+#endif
+
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
index cd3b33eecc..957ce579c0 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
@@ -222,8 +222,10 @@ void main()
amb_da += (da*da*0.5+0.5)*(1.0-shadow)*proj_ambiance;
amb_da *= dist_atten * noise;
amb_da = min(amb_da, 1.0-lit);
-
- col += amb_da*color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
+
+#ifndef NO_AMBIANCE
+ col += amb_da*color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a;
+#endif
}
diff --git a/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl b/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl
index 372992fab2..1ac0ad8948 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);
- c.rgb += atmosAmbient() * color.rgb * 0.5;
- return c;
+ vec4 c = sumLights(pos, norm, color);
+ c.rgb += atmosAmbient() * color.rgb;
+ return c * 2.0;
}
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index eb6a2edcec..95ee1ef488 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -2426,10 +2426,6 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
camera.disableUserClipPlane();
- bool use_far_clip = LLPipeline::sUseFarClip;
-
- LLPipeline::sUseFarClip = false;
-
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
{
@@ -2456,15 +2452,11 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
}
}
- LLPipeline::sUseFarClip = use_far_clip;
-
if (bound_shader)
{
gOcclusionCubeProgram.unbind();
}
- camera.disableUserClipPlane();
-
if (hasRenderType(LLPipeline::RENDER_TYPE_SKY) &&
gSky.mVOSkyp.notNull() &&
gSky.mVOSkyp->mDrawable.notNull())
@@ -10288,7 +10280,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
//far_clip = llmin(far_clip, 128.f);
far_clip = llmin(far_clip, camera.getFar());
- far_clip = llmax(far_clip, 256.0f);
+ //far_clip = llmax(far_clip, 256.0f);
F32 range = far_clip-near_clip;
@@ -10648,11 +10640,11 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
set_current_modelview(view[j]);
set_current_projection(proj[j]);
- LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE);
-
- //shadow_cam.ignoreAgentFrustumPlane(LLCamera::AGENT_PLANE_NEAR);
+ shadow_cam.ignoreAgentFrustumPlane(LLCamera::AGENT_PLANE_NEAR);
shadow_cam.getAgentPlane(LLCamera::AGENT_PLANE_NEAR).set(shadow_near_clip);
+ LLViewerCamera::updateFrustumPlanes(shadow_cam, FALSE, FALSE, TRUE);
+
//translate and scale to from [-1, 1] to [0, 1]
glh::matrix4f trans(0.5f, 0.f, 0.f, 0.5f,
0.f, 0.5f, 0.f, 0.5f,