summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2019-01-29 18:25:20 +0000
committerRider Linden <rider@lindenlab.com>2019-01-29 18:25:20 +0000
commit51fe738aaf5e84d88f9e2ce7b04e6e4e25c35ffe (patch)
tree1a25946a6bfdf666c9b877508183fef2ba010ec8 /indra
parent347ae7a38bb2535bac4d3c497e216e3178c6e966 (diff)
parent04cb0884581da31128cf8c7473e8c6b1ba1ddbf9 (diff)
Merged in graham_linden/viewer-eep-fixes (pull request #243)
SL-10303, SL-10414, SL-10415, SL-10424, SL-10381
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/moonV.glsl5
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl63
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/moonV.glsl17
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/sunDiscV.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/skyF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/skyV.glsl2
-rw-r--r--indra/newview/lldrawpoolterrain.cpp23
-rw-r--r--indra/newview/lldrawpoolterrain.h2
-rw-r--r--indra/newview/pipeline.cpp13
12 files changed, 72 insertions, 64 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
index fe336fc3a8..baf54c1fbe 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl
@@ -132,7 +132,7 @@ void main()
temp2.x = pow(temp2.x, glow.z);
// glow.z should be negative, so we're doing a sort of (1 / "angle") function
- temp2.x *= sun_up_factor;
+ //temp2.x *= sun_up_factor;
// Add "minimum anti-solar illumination"
temp2.x += .25;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonV.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonV.glsl
index 0a68fc82f7..e1bac4f248 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/moonV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/moonV.glsl
@@ -37,10 +37,11 @@ void calcAtmospherics(vec3 eye_pos);
void main()
{
//transform vertex
- vec4 vert = vec4(position.xyz, 1.0);
+ vec3 offset = vec3(0, 0, 50);
+ vec4 vert = vec4(position.xyz - offset, 1.0);
vec4 pos = (modelview_matrix * vert);
- gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+ gl_Position = modelview_projection_matrix*vert;
calcAtmospherics(pos.xyz);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl
index 70568bc75f..747f1dacdd 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl
@@ -48,44 +48,28 @@ uniform float shadow_bias;
uniform float spot_shadow_bias;
uniform float spot_shadow_offset;
-
+uniform float sun_up_factor;
uniform mat4 inv_proj;
uniform vec2 screen_res;
vec3 decode_normal(vec2 enc);
-float pcfShadowLegacy(sampler2DShadow shadowMap, vec4 stc)
-{
- stc.xyz /= stc.w;
- stc.z += shadow_bias;
-
- stc.x = floor(stc.x*shadow_res.x + fract(stc.y*shadow_res.y*12345))/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;
-
- shadow += shadow2D(shadowMap, stc.xyz+vec3(2.0/shadow_res.x, 1.5/shadow_res.y, 0.0)).x;
- shadow += shadow2D(shadowMap, stc.xyz+vec3(1.0/shadow_res.x, -1.5/shadow_res.y, 0.0)).x;
- shadow += shadow2D(shadowMap, stc.xyz+vec3(-1.0/shadow_res.x, 1.5/shadow_res.y, 0.0)).x;
- shadow += shadow2D(shadowMap, stc.xyz+vec3(-2.0/shadow_res.x, -1.5/shadow_res.y, 0.0)).x;
-
- return shadow*0.2;
-}
-
-float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float bias_scale, vec2 pos_screen)
+float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float bias_mul, vec2 pos_screen, vec3 light_dir)
{
stc.xyz /= stc.w;
- stc.z += shadow_bias * bias_scale;
-
- stc.x = floor(stc.x*pos_screen.x + fract(stc.y*pos_screen.y*0.666666666))/shadow_res.x; // add some chaotic jitter to X sample pos according to Y to disguise the snapping going on here
+ stc.z += max(0.5, light_dir.z) * shadow_bias * 8.0 * bias_mul;
+
+ stc.x = floor(stc.x*shadow_res.x + fract(stc.y*pos_screen.y*3.14159))/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;
+ float shadow = cs * 4.0;
+
shadow += shadow2D(shadowMap, stc.xyz+vec3(2.0/shadow_res.x, 1.5/shadow_res.y, 0.0)).x;
shadow += shadow2D(shadowMap, stc.xyz+vec3(1.0/shadow_res.x, -1.5/shadow_res.y, 0.0)).x;
shadow += shadow2D(shadowMap, stc.xyz+vec3(-1.0/shadow_res.x, 1.5/shadow_res.y, 0.0)).x;
shadow += shadow2D(shadowMap, stc.xyz+vec3(-2.0/shadow_res.x, -1.5/shadow_res.y, 0.0)).x;
- return shadow*0.2;
+
+ return shadow*0.125;
}
float pcfSpotShadow(sampler2DShadow shadowMap, vec4 stc, float bias_scale, vec2 pos_screen)
@@ -111,10 +95,10 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
{
float dp_sun = max(0.0, dot(sun_dir.xyz, norm));
float dp_moon = max(0.0, dot(moon_dir.xyz, norm));
- float dp_directional_light = max(dp_sun,dp_moon);
+ float dp_directional_light = (sun_up_factor > 0) ? dp_sun : dp_moon;
dp_directional_light = clamp(dp_directional_light, 0.0, 1.0);
- vec3 light_dir = (dp_moon > dp_sun) ? moon_dir : sun_dir;
+ vec3 light_dir = (sun_up_factor > 0) ? sun_dir : moon_dir;
vec3 offset = light_dir * (1.0-dp_directional_light);
vec3 shadow_pos = pos.xyz + (offset * shadow_bias);
@@ -141,7 +125,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 += pcfShadowLegacy(shadowMap3, lpos)*w;
+ shadow += pcfShadow(shadowMap3, lpos, 0.25, 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);
}
@@ -153,7 +137,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 += pcfShadowLegacy(shadowMap2, lpos)*w;
+ shadow += pcfShadow(shadowMap2, lpos, 0.5, pos_screen, light_dir)*w;
weight += w;
}
@@ -164,7 +148,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
float w = 1.0;
w -= max(spos.z-far_split.x, 0.0)/transition_domain.x;
w -= max(near_split.y-spos.z, 0.0)/transition_domain.y;
- shadow += pcfShadowLegacy(shadowMap1, lpos)*w;
+ shadow += pcfShadow(shadowMap1, lpos, 0.75, pos_screen, light_dir)*w;
weight += w;
}
@@ -175,14 +159,15 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
float w = 1.0;
w -= max(near_split.x-spos.z, 0.0)/transition_domain.x;
- shadow += pcfShadowLegacy(shadowMap0, lpos)*w;
+ shadow += pcfShadow(shadowMap0, lpos, 1.0, pos_screen, light_dir)*w;
weight += w;
}
shadow /= weight;
}
- return min(dp_directional_light, shadow);
+ shadow = min(dp_directional_light, shadow);
+ return shadow;
}
float sampleSpotShadow(vec3 pos, vec3 norm, int index, vec2 pos_screen)
@@ -201,11 +186,19 @@ float sampleSpotShadow(vec3 pos, vec3 norm, int index, vec2 pos_screen)
float weight = 0.0;
{
- lpos = shadow_matrix[4 + index]*spos;
float w = 1.0;
w -= max(spos.z-far_split.z, 0.0)/transition_domain.z;
-
- shadow += pcfSpotShadow((index == 0) ? shadowMap4 : shadowMap5, lpos, 0.8, spos.xy)*w;
+
+ if (index == 0)
+ {
+ lpos = shadow_matrix[4]*spos;
+ shadow += pcfSpotShadow(shadowMap4, lpos, 0.8, spos.xy)*w;
+ }
+ else
+ {
+ lpos = shadow_matrix[5]*spos;
+ shadow += pcfSpotShadow(shadowMap5, lpos, 0.8, spos.xy)*w;
+ }
weight += w;
shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0);
}
diff --git a/indra/newview/app_settings/shaders/class1/windlight/moonV.glsl b/indra/newview/app_settings/shaders/class1/windlight/moonV.glsl
index aaa6768ed7..1c43a7332e 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/moonV.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/moonV.glsl
@@ -36,13 +36,14 @@ VARYING vec2 vary_texcoord0;
void main()
{
- //transform vertex
- vec4 vert = vec4(position.xyz, 1.0);
- vec4 pos = (modelview_matrix * vert);
+ //transform vertex
+ vec3 offset = vec3(0, 0, 50);
+ vec4 vert = vec4(position.xyz - offset, 1.0);
+ vec4 pos = (modelview_matrix * vert);
- gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
-
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
-
- calcAtmospherics(pos.xyz);
+ gl_Position = modelview_projection_matrix*vert;
+
+ vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+
+ calcAtmospherics(pos.xyz);
}
diff --git a/indra/newview/app_settings/shaders/class1/windlight/sunDiscV.glsl b/indra/newview/app_settings/shaders/class1/windlight/sunDiscV.glsl
index 1fa32c3f3b..ca116628f1 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/sunDiscV.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/sunDiscV.glsl
@@ -38,7 +38,8 @@ void calcAtmospherics(vec3 eye_pos);
void main()
{
//transform vertex
- vec4 vert = vec4(position.xyz, 1.0);
+ vec3 offset = vec3(0, 0, 50);
+ vec4 vert = vec4(position.xyz - offset, 1.0);
vec4 pos = modelview_projection_matrix*vert;
sun_fade = smoothstep(0.3, 1.0, (position.z + 50) / 512.0f);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl
index 6ddd7e7c86..792aa4e85c 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/skyF.glsl
@@ -153,7 +153,7 @@ void main()
// Add "minimum anti-solar illumination"
temp2.x += .25;
- temp2.x *= sun_up_factor;
+ //temp2.x *= sun_up_factor;
// Haze color above cloud
vec4 color = ( blue_horizon * blue_weight * (sunlight + ambient)
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
index 5cf3cd1dd2..8d1e5e3281 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
@@ -119,7 +119,7 @@ void calcFragAtmospherics(vec3 inPositionEye, float ambFactor, out vec3 sunlit,
//add "minimum anti-solar illumination"
temp2.x += .25;
- temp2.x *= sun_up_factor;
+ //temp2.x *= sun_up_factor;
//increase ambient when there are more clouds
vec4 tmpAmbient = ambient + (vec4(1.) - ambient) * cloud_shadow * 0.5;
diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
index 644cd5a35b..a250cf2c45 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl
@@ -131,7 +131,7 @@ void main()
temp2.x = pow(temp2.x, glow.z);
// glow.z should be negative, so we're doing a sort of (1 / "angle") function
- temp2.x *= sun_up_factor;
+ //temp2.x *= sun_up_factor;
// Add "minimum anti-solar illumination"
temp2.x += .25;
diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
index 04cf4052b8..f509f9f8d4 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl
@@ -119,7 +119,7 @@ void main()
temp2.x = pow(temp2.x, glow.z);
// glow.z should be negative, so we're doing a sort of (1 / "angle") function
- temp2.x *= sun_up_factor;
+ //temp2.x *= sun_up_factor;
// Add "minimum anti-solar illumination"
temp2.x += .25;
diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp
index 593636b14a..e716214d72 100644
--- a/indra/newview/lldrawpoolterrain.cpp
+++ b/indra/newview/lldrawpoolterrain.cpp
@@ -145,6 +145,18 @@ S32 LLDrawPoolTerrain::getDetailMode()
return sDetailMode;
}
+void LLDrawPoolTerrain::boostTerrainDetailTextures()
+{
+ // Hack! Get the region that this draw pool is rendering from!
+ LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
+ LLVLComposition *compp = regionp->getComposition();
+ for (S32 i = 0; i < 4; i++)
+ {
+ compp->mDetailTextures[i]->setBoostLevel(LLGLTexture::BOOST_TERRAIN);
+ compp->mDetailTextures[i]->addTextureStats(1024.f*1024.f); // assume large pixel area
+ }
+}
+
void LLDrawPoolTerrain::render(S32 pass)
{
LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN);
@@ -154,14 +166,7 @@ void LLDrawPoolTerrain::render(S32 pass)
return;
}
- // Hack! Get the region that this draw pool is rendering from!
- LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
- LLVLComposition *compp = regionp->getComposition();
- for (S32 i = 0; i < 4; i++)
- {
- compp->mDetailTextures[i]->setBoostLevel(LLGLTexture::BOOST_TERRAIN);
- compp->mDetailTextures[i]->addTextureStats(1024.f*1024.f); // assume large pixel area
- }
+ boostTerrainDetailTextures();
LLOverrideFaceColor override(this, 1.f, 1.f, 1.f, 1.f);
@@ -236,6 +241,8 @@ void LLDrawPoolTerrain::renderDeferred(S32 pass)
return;
}
+ boostTerrainDetailTextures();
+
renderFullShader();
// Special-case for land ownership feedback
diff --git a/indra/newview/lldrawpoolterrain.h b/indra/newview/lldrawpoolterrain.h
index 55f75e2644..b4ef7881a8 100644
--- a/indra/newview/lldrawpoolterrain.h
+++ b/indra/newview/lldrawpoolterrain.h
@@ -78,6 +78,8 @@ public:
static F32 sDetailScale; // meters per texture
protected:
+ void boostTerrainDetailTextures();
+
void renderSimple();
void renderOwnership();
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 9b89af20d2..0784f3acdd 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -9459,12 +9459,14 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
water_clip = -1;
}
+ S32 occlusion = LLPipeline::sUseOcclusion;
+
+ LLPipeline::sUseOcclusion = 0;
+
if (!LLViewerCamera::getInstance()->cameraUnderWater())
{ //generate planar reflection map
//disable occlusion culling for reflection map for now
- S32 occlusion = LLPipeline::sUseOcclusion;
-
- LLPipeline::sUseOcclusion = 0;
+
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
glClearColor(0,0,0,0);
@@ -9603,8 +9605,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.popMatrix();
mWaterRef.flush();
- set_current_modelview(current);
- LLPipeline::sUseOcclusion = occlusion;
+ set_current_modelview(current);
}
camera.setOrigin(camera_in.getOrigin());
@@ -9708,6 +9709,8 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
}
last_update = LLDrawPoolWater::sNeedsReflectionUpdate && LLDrawPoolWater::sNeedsDistortionUpdate;
+ LLPipeline::sUseOcclusion = occlusion;
+
LLPipeline::sUnderWaterRender = false;
LLPipeline::sReflectionRender = false;