summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class3/environment/waterF.glsl15
-rw-r--r--indra/newview/llviewershadermgr.cpp20
3 files changed, 31 insertions, 10 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
index 677d83a1fe..e73e396b8e 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
@@ -433,13 +433,15 @@ void boxIntersectDebug(vec3 origin, vec3 pos, int i, inout vec4 col)
// dw - distance weight
float sphereWeight(vec3 pos, vec3 dir, vec3 origin, float r, int i, out float dw)
{
- float r1 = r * 0.5; // 50% of radius (outer sphere to start interpolating down)
+ float r1 = r * 0.5; // 50% of radius (outer sphere to start interpolating down)
vec3 delta = pos.xyz - origin;
float d2 = max(length(delta), 0.001);
float atten = 1.0 - max(d2 - r1, 0.0) / max((r - r1), 0.001);
float w = 1.0 / d2;
-
+
+ w *= refParams[i].z;
+
dw = w * atten * max(r, 1.0)*4;
w *= atten;
diff --git a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
index 7524567f6b..9da86759c9 100644
--- a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl
@@ -25,10 +25,10 @@
// class3/environment/waterF.glsl
-#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
-#else
-#define frag_color gl_FragColor
+
+#ifdef HAS_SUN_SHADOW
+float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen);
#endif
vec3 scaleSoftClipFragLinear(vec3 l);
@@ -199,6 +199,12 @@ void main()
vec3 additive;
vec3 atten;
+ float shadow = 1.0f;
+
+#ifdef HAS_SUN_SHADOW
+ shadow = sampleDirectionalShadow(pos.xyz, norm.xyz, distort);
+#endif
+
calcAtmosphericVarsLinear(pos.xyz, wavef, vary_light_dir, sunlit, amblit, additive, atten);
vec3 sunlit_linear = srgb_to_linear(sunlit);
@@ -241,7 +247,6 @@ void main()
vec3 v = -normalize(pos.xyz);
- float scol = 1.0;
vec3 colorEmissive = vec3(0);
float ao = 1.0;
vec3 light_dir = transform_normal(lightDir);
@@ -253,7 +258,7 @@ void main()
vec3 punctual = pbrPunctual(vec3(0), specularColor, 0.1, metallic, normalize(wavef+up*max(dist, 32.0)/32.0*(1.0-vdu)), v, normalize(light_dir));
- vec3 color = punctual * sunlit_linear * 2.75 * scol;
+ vec3 color = punctual * sunlit_linear * 2.75 * shadow;
vec3 ibl = pbrIbl(vec3(0), vec3(1), radiance, vec3(0), ao, NdotV, 0.0);
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index d1f6392eae..b50cb49b7e 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -760,9 +760,11 @@ std::string LLViewerShaderMgr::loadBasicShaders()
BOOL LLViewerShaderMgr::loadShadersWater()
{
LL_PROFILE_ZONE_SCOPED;
-#if 1 // DEPRECATED -- forward rendering is deprecated
BOOL success = TRUE;
BOOL terrainWaterSuccess = TRUE;
+
+ bool use_sun_shadow = mShaderLevel[SHADER_DEFERRED] > 1 &&
+ gSavedSettings.getS32("RenderShadowDetail") > 0;
if (mShaderLevel[SHADER_WATER] == 0)
{
@@ -783,6 +785,7 @@ BOOL LLViewerShaderMgr::loadShadersWater()
gWaterProgram.mFeatures.hasTransport = true;
gWaterProgram.mFeatures.hasSrgb = true;
gWaterProgram.mFeatures.hasReflectionProbes = true;
+ gWaterProgram.mFeatures.hasShadows = use_sun_shadow;
gWaterProgram.mShaderFiles.clear();
gWaterProgram.mShaderFiles.push_back(make_pair("environment/waterV.glsl", GL_VERTEX_SHADER));
gWaterProgram.mShaderFiles.push_back(make_pair("environment/waterF.glsl", GL_FRAGMENT_SHADER));
@@ -791,6 +794,12 @@ BOOL LLViewerShaderMgr::loadShadersWater()
{
gWaterProgram.addPermutation("TRANSPARENT_WATER", "1");
}
+
+ if (use_sun_shadow)
+ {
+ gWaterProgram.addPermutation("HAS_SUN_SHADOW", "1");
+ }
+
gWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
gWaterProgram.mShaderLevel = mShaderLevel[SHADER_WATER];
success = gWaterProgram.createShader(NULL, NULL);
@@ -808,6 +817,7 @@ BOOL LLViewerShaderMgr::loadShadersWater()
gWaterEdgeProgram.mFeatures.hasTransport = true;
gWaterEdgeProgram.mFeatures.hasSrgb = true;
gWaterEdgeProgram.mFeatures.hasReflectionProbes = true;
+ gWaterEdgeProgram.mFeatures.hasShadows = use_sun_shadow;
gWaterEdgeProgram.mShaderFiles.clear();
gWaterEdgeProgram.mShaderFiles.push_back(make_pair("environment/waterV.glsl", GL_VERTEX_SHADER));
gWaterEdgeProgram.mShaderFiles.push_back(make_pair("environment/waterF.glsl", GL_FRAGMENT_SHADER));
@@ -817,6 +827,11 @@ BOOL LLViewerShaderMgr::loadShadersWater()
{
gWaterEdgeProgram.addPermutation("TRANSPARENT_WATER", "1");
}
+
+ if (use_sun_shadow)
+ {
+ gWaterEdgeProgram.addPermutation("HAS_SUN_SHADOW", "1");
+ }
gWaterEdgeProgram.mShaderGroup = LLGLSLShader::SG_WATER;
gWaterEdgeProgram.mShaderLevel = mShaderLevel[SHADER_WATER];
success = gWaterEdgeProgram.createShader(NULL, NULL);
@@ -866,8 +881,7 @@ BOOL LLViewerShaderMgr::loadShadersWater()
LLWorld::getInstance()->updateWaterObjects();
-#endif
- return TRUE;
+ return TRUE;
}
BOOL LLViewerShaderMgr::loadShadersEffects()