From 8969b114357d189e1bf39024762698eeddddfc78 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 3 Jul 2018 16:37:32 +0100 Subject: MAINT-8838 render a sun disc if the texture(s) are provided by WL settings (default is no sun disc and just haze) Refactor sky texture optimization to retain building the cubemap used by shiny. --- .../shaders/class1/windlight/sunDiscF.glsl | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl (limited to 'indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl') diff --git a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl new file mode 100644 index 0000000000..0eb32b69b8 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl @@ -0,0 +1,54 @@ +/** + * @file sunDiscF.glsl + * + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2005, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#extension GL_ARB_texture_rectangle : enable + +/*[EXTRA_CODE_HERE]*/ + +#ifdef DEFINE_GL_FRAGCOLOR +out vec4 frag_color; +#else +#define frag_color gl_FragColor +#endif + +vec3 fullbrightAtmosTransport(vec3 light); +vec3 fullbrightScaleSoftClip(vec3 light); + +uniform sampler2D diffuseMap; +uniform sampler2D altDiffuseMap; +uniform float blend_factor; // interp factor between sun A/B +VARYING vec2 vary_texcoord0; + +void main() +{ + vec4 sunA = texture2D(diffuseMap, vary_texcoord0.xy); + vec4 sunB = texture2D(altDiffuseMap, vary_texcoord0.xy); + vec4 c = mix(sunB, sunA, blend_factor); + c.rgb = pow(c.rgb, vec3(0.45f)); + c.rgb = fullbrightAtmosTransport(c.rgb); + c.rgb = fullbrightScaleSoftClip(c.rgb); + frag_color = c; +} + -- cgit v1.2.3 From b86e899e7e51c56252479236df9a74f9bb432670 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 23 Aug 2018 00:53:11 +0100 Subject: MAINT-9006 Make perspective projection consistent between ALM and non-ALM when drawing water (horizon matches). Make perspective projection consistent between ALM and non-ALM when drawing heavenly bodies (sun disc position matches). Make gamma correction of sun disc tex consistent between ALM and non-ALM rendering. --- indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl') diff --git a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl index 0eb32b69b8..05251e7e96 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl @@ -46,7 +46,7 @@ void main() vec4 sunA = texture2D(diffuseMap, vary_texcoord0.xy); vec4 sunB = texture2D(altDiffuseMap, vary_texcoord0.xy); vec4 c = mix(sunB, sunA, blend_factor); - c.rgb = pow(c.rgb, vec3(0.45f)); + c.rgb = pow(c.rgb, vec3(0.7f)); c.rgb = fullbrightAtmosTransport(c.rgb); c.rgb = fullbrightScaleSoftClip(c.rgb); frag_color = c; -- cgit v1.2.3 From 6dd9dd3ab63cb0daa7682a400ff0408fd894ba77 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 30 Aug 2018 17:54:59 +0100 Subject: MAINT-9064 Fix binding of current/next sun/moon textures. Remove redundant code in GLSLShader determination of tex uniform bindings. Unhack mix calls in sun/moon shaders to reverse sense of blending (was working around reversed bindings). --- indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl') diff --git a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl index 05251e7e96..3f2375ee4d 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl @@ -45,7 +45,7 @@ void main() { vec4 sunA = texture2D(diffuseMap, vary_texcoord0.xy); vec4 sunB = texture2D(altDiffuseMap, vary_texcoord0.xy); - vec4 c = mix(sunB, sunA, blend_factor); + vec4 c = mix(sunA, sunB, blend_factor); c.rgb = pow(c.rgb, vec3(0.7f)); c.rgb = fullbrightAtmosTransport(c.rgb); c.rgb = fullbrightScaleSoftClip(c.rgb); -- cgit v1.2.3 From 88d4d85711a25772f3659850902e3a395ef2358c Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 25 Jan 2019 10:34:42 -0800 Subject: SL-10303 Modify sun disc shader to better position itself within the sun glow and to fade as the sun approaches the horizon (to mask where the position difference is greatest). --- .../app_settings/shaders/class1/windlight/sunDiscF.glsl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl') diff --git a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl index 3f2375ee4d..668379164d 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl @@ -40,15 +40,18 @@ uniform sampler2D diffuseMap; uniform sampler2D altDiffuseMap; uniform float blend_factor; // interp factor between sun A/B VARYING vec2 vary_texcoord0; +VARYING float sun_fade; void main() { - vec4 sunA = texture2D(diffuseMap, vary_texcoord0.xy); - vec4 sunB = texture2D(altDiffuseMap, vary_texcoord0.xy); + vec4 sunA = texture2D(diffuseMap, vary_texcoord0.xy); + vec4 sunB = texture2D(altDiffuseMap, vary_texcoord0.xy); vec4 c = mix(sunA, sunB, blend_factor); + c.a *= sun_fade; + c.rgb = pow(c.rgb, vec3(0.7f)); - c.rgb = fullbrightAtmosTransport(c.rgb); + c.rgb = fullbrightAtmosTransport(c.rgb); c.rgb = fullbrightScaleSoftClip(c.rgb); - frag_color = c; + frag_color = c; } -- cgit v1.2.3 From 5cd188840d968731047aa89459ff63f605709c6e Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Mon, 25 Feb 2019 12:14:59 -0800 Subject: SL-9806 Remove fade effect on sun disc as it nears horizon (stars poke through). --- indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl') diff --git a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl index 668379164d..d85ce004a5 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl @@ -47,7 +47,9 @@ void main() vec4 sunA = texture2D(diffuseMap, vary_texcoord0.xy); vec4 sunB = texture2D(altDiffuseMap, vary_texcoord0.xy); vec4 c = mix(sunA, sunB, blend_factor); - c.a *= sun_fade; + +// SL-9806 stars poke through +// c.a *= sun_fade; c.rgb = pow(c.rgb, vec3(0.7f)); c.rgb = fullbrightAtmosTransport(c.rgb); -- cgit v1.2.3 From 3dd5942776a8e3755fa75e01661b343972affbf9 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 19 Apr 2019 07:44:18 -0700 Subject: Add directory names to sentinels in shaders so shaders with same filename can be differentiated in nSight while debugging. --- indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl') diff --git a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl index d85ce004a5..b9ae7a0226 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/sunDiscF.glsl @@ -1,5 +1,5 @@ /** - * @file sunDiscF.glsl + * @file class1\wl\sunDiscF.glsl * * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code -- cgit v1.2.3