summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2018-10-30 18:17:47 +0100
committerGraham Linden <graham@lindenlab.com>2018-10-30 18:17:47 +0100
commit9a8e124fdecbeb57f65645d102f5f1767f8e4d16 (patch)
tree1457b7beb2ca152ec6fa63131369c8d1a7742de9 /indra
parent2f97660ab7de0154ea3cadb1530b261f93bd31de (diff)
SL-9976 change moon blend/brightness handling in shaders and cleanup extraneous GL state management.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/moonF.glsl20
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/moonF.glsl17
-rw-r--r--indra/newview/lldrawpoolwlsky.cpp8
3 files changed, 12 insertions, 33 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
index f65a6eb32b..8bf4551abc 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
@@ -33,9 +33,6 @@ out vec4 frag_data[3];
#define frag_data gl_FragData
#endif
-vec3 fullbrightAtmosTransport(vec3 light);
-vec3 fullbrightScaleSoftClip(vec3 light);
-
uniform vec4 color;
uniform vec4 sunlight_color;
uniform vec3 lumWeights;
@@ -52,23 +49,16 @@ void main()
vec4 moonB = texture2D(altDiffuseMap, vary_texcoord0.xy);
vec4 c = mix(moonA, moonB, blend_factor);
- if (c.a < 0.1f)
- {
- discard;
- }
-
- c.rgb = pow(c.rgb, vec3(0.7f));
- c.rgb = fullbrightAtmosTransport(c.rgb);
- c.rgb = fullbrightScaleSoftClip(c.rgb);
-
// mix factor which blends when sunlight is brighter
// and shows true moon color at night
vec3 luma_weights = vec3(0.2, 0.3, 0.2);
- float mix = 1.0f - dot(normalize(sunlight_color.rgb), luma_weights);
- c.rgb = pow(c.rgb, 1.2 - vec3(mix * moon_brightness));
+ float mix = 1.0 - dot(normalize(sunlight_color.rgb), luma_weights);
+
+ vec3 exp = vec3(1.0 - mix * moon_brightness) * 2.0 - 1.0;
+ c.rgb = pow(c.rgb, exp);
- frag_data[0] = vec4(c.rgb, mix * (moon_brightness + (c.a * 0.25)));
+ frag_data[0] = vec4(c.rgb, c.a);
frag_data[1] = vec4(0.0);
frag_data[2] = vec4(0.0f);
}
diff --git a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl
index 8cc7fc3bb5..b66b56e0fb 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl
@@ -33,9 +33,6 @@ out vec4 frag_color;
#define frag_color gl_FragColor
#endif
-vec3 fullbrightAtmosTransport(vec3 light);
-vec3 fullbrightScaleSoftClip(vec3 light);
-
uniform vec4 color;
uniform vec4 sunlight_color;
uniform vec3 lumWeights;
@@ -52,22 +49,14 @@ void main()
vec4 moonB = texture2D(altDiffuseMap, vary_texcoord0.xy);
vec4 c = mix(moonA, moonB, blend_factor);
- if (c.a < 0.1f)
- {
- discard;
- }
-
- c.rgb = pow(c.rgb, vec3(0.7f));
- c.rgb = fullbrightAtmosTransport(c.rgb);
- c.rgb = fullbrightScaleSoftClip(c.rgb);
-
// mix factor which blends when sunlight is brighter
// and shows true moon color at night
vec3 luma_weights = vec3(0.2, 0.3, 0.2);
float mix = 1.0f - dot(normalize(sunlight_color.rgb), luma_weights);
- c.rgb = pow(c.rgb, 1.2 - vec3(mix * moon_brightness));
+ vec3 exp = vec3(1.0 - mix * moon_brightness) * 2.0 - 1.0;
+ c.rgb = pow(c.rgb, exp);
- frag_color = vec4(c.rgb, mix * (moon_brightness + (c.a * 0.25)));
+ frag_color = vec4(c.rgb, c.a);
}
diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp
index 9f3cf8f78e..1ea7cc446c 100644
--- a/indra/newview/lldrawpoolwlsky.cpp
+++ b/indra/newview/lldrawpoolwlsky.cpp
@@ -631,6 +631,8 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
}
}
+ blend_factor = LLEnvironment::instance().getCurrentSky()->getBlendFactor();
+
face = gSky.mVOSkyp->mFace[LLVOSky::FACE_MOON];
if (gSky.mVOSkyp->getMoon().getDraw() && face && face->getTexture(LLRender::DIFFUSE_MAP) && face->getGeomCount() && moon_shader)
@@ -667,7 +669,7 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
moon_shader->uniform1f(LLShaderMgr::MOON_BRIGHTNESS, moon_brightness);
- moon_shader->uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, color.mV);
+ moon_shader->uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, color.mV);
moon_shader->uniform1f(LLShaderMgr::BLEND_FACTOR, blend_factor);
LLFacePool::LLOverrideFaceColor color_override(this, color);
@@ -738,9 +740,7 @@ void LLDrawPoolWLSky::render(S32 pass)
const F32 camHeightLocal = LLEnvironment::instance().getCamHeight();
LLVector3 const & origin = LLViewerCamera::getInstance()->getOrigin();
-
- LLGLSPipelineBlendSkyBox sky(true, false);
-
+
renderSkyHaze(origin, camHeightLocal);
renderStars();
renderHeavenlyBodies();