diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred')
24 files changed, 0 insertions, 1636 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl deleted file mode 100644 index f4ec1ec532..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @file alphaF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -//class1/deferred/alphaF.glsl - - -out vec4 frag_color; - -void main() -{ - frag_color = vec4(1,0,1,0.5); -} - diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl deleted file mode 100644 index 850f7ebb38..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file fullbrightShinyF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -//debug stub - -out vec4 frag_color; - -void main() -{ - frag_color = vec4(0.25, 0.5, 0, 1.0); -} - diff --git a/indra/newview/app_settings/shaders/class1/deferred/indirect.glsl b/indra/newview/app_settings/shaders/class1/deferred/indirect.glsl deleted file mode 100644 index 49bfa660f8..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/indirect.glsl +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @file class1/deferred/indirect.glsl - * - * $LicenseInfo:firstyear=2018&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -vec3 getIndirect(vec3 ambient, vec3 norm, vec3 pos, vec2 pos_screen) -{ - return ambient; -} - diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl deleted file mode 100644 index 185c1150ef..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @file luminanceF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -/*[EXTRA_CODE_HERE]*/ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform sampler2D diffuseMap; -VARYING vec2 vary_fragcoord; - -void main() -{ - frag_color = texture2D(diffuseMap, vary_fragcoord.xy); -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl deleted file mode 100644 index 5488a63c6a..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @file giV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform mat4 modelview_projection_matrix; - -ATTRIBUTE vec3 position; -ATTRIBUTE vec4 diffuse_color; - -VARYING vec2 vary_fragcoord; -VARYING vec4 vertex_color; - -uniform vec2 screen_res; - -void main() -{ - //transform vertex - vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_Position = pos; - - vary_fragcoord = (pos.xy * 0.5 + 0.5); - - vertex_color = diffuse_color; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl deleted file mode 100644 index 51a36935f2..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @file materialF.glsl -* -* $LicenseInfo:firstyear=2007&license=viewerlgpl$ -* Second Life Viewer Source Code -* Copyright (C) 2007, 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$ -*/ - - -/*[EXTRA_CODE_HERE]*/ - -//class1/deferred/materialF.glsl - -// Debug stub for non-pbr material - -#define DIFFUSE_ALPHA_MODE_BLEND 1 - -#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) -out vec4 frag_color; -#else -out vec4 frag_data[4]; -#endif - -void main() -{ -#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) - frag_color = vec4(1, 0, 0, 0.5); -#else - // emissive red PBR material - frag_data[0] = vec4(0, 0, 0, 0); - frag_data[1] = vec4(0, 0, 0, 0); - frag_data[2] = vec4(1, 0, 0, GBUFFER_FLAG_HAS_PBR); - frag_data[3] = vec4(1, 0, 0, 0); -#endif -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl deleted file mode 100644 index 8fdb5e7154..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @file class1/deferred/multiPointLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - - // debug stub - -out vec4 frag_color; - -void main() -{ - frag_color = vec4(0.5, 0.5, 0.0, 0.0); -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl deleted file mode 100644 index d71dc76423..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl +++ /dev/null @@ -1,37 +0,0 @@ -/** - * @file multiPointLightV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -ATTRIBUTE vec3 position; - -VARYING vec4 vary_fragcoord; - -void main() -{ - //transform vertex - vec4 pos = vec4(position.xyz, 1.0); - vary_fragcoord = pos; - - gl_Position = pos; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl deleted file mode 100644 index e9dac711c3..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ /dev/null @@ -1,283 +0,0 @@ -/** - * @file multiSpotLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - - - -//class 1 -- no shadows - -#extension GL_ARB_texture_rectangle : enable -#extension GL_ARB_shader_texture_lod : enable - -/*[EXTRA_CODE_HERE]*/ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform sampler2D diffuseRect; -uniform sampler2D specularRect; -uniform sampler2D depthMap; -uniform sampler2D normalMap; -uniform sampler2D noiseMap; -uniform sampler2D projectionMap; -uniform sampler2D lightFunc; - -uniform mat4 proj_mat; //screen space to light space -uniform float proj_near; //near clip for projection -uniform vec3 proj_p; //plane projection is emitting from (in screen space) -uniform vec3 proj_n; -uniform float proj_focus; //distance from plane to begin blurring -uniform float proj_lod; //(number of mips in proj map) -uniform float proj_range; //range between near clip and far clip plane of projection -uniform float proj_ambient_lod; -uniform float proj_ambiance; -uniform float near_clip; -uniform float far_clip; - -uniform vec3 proj_origin; //origin of projection to be used for angular attenuation -uniform float sun_wash; - -uniform vec3 center; -uniform vec3 color; -uniform float falloff; -uniform float size; - -VARYING vec4 vary_fragcoord; -uniform vec2 screen_res; - -uniform mat4 inv_proj; -vec3 getNorm(vec2 pos_screen); -vec3 srgb_to_linear(vec3 c); -float getDepth(vec2 tc); - -vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) -{ - vec4 ret = texture2DLod(projectionMap, tc, lod); - ret.rgb = srgb_to_linear(ret.rgb); - - vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); - - float det = min(lod/(proj_lod*0.5), 1.0); - - float d = min(dist.x, dist.y); - - d *= min(1, d * (proj_lod - lod)); - - float edge = 0.25*det; - - ret *= clamp(d/edge, 0.0, 1.0); - - return ret; -} - -vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) -{ - vec4 ret = texture2DLod(projectionMap, tc, lod); - ret.rgb = srgb_to_linear(ret.rgb); - - vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); - - float det = min(lod/(proj_lod*0.5), 1.0); - - float d = min(dist.x, dist.y); - - float edge = 0.25*det; - - ret *= clamp(d/edge, 0.0, 1.0); - - return ret; -} - -vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) -{ - vec4 ret = texture2DLod(projectionMap, tc, lod); - ret.rgb = srgb_to_linear(ret.rgb); - - vec2 dist = tc-vec2(0.5); - - float d = dot(dist,dist); - - ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0), 1.0); - - return ret; -} - -vec4 getPosition(vec2 pos_screen); - -void main() -{ - vec3 col = vec3(0,0,0); - -#if defined(LOCAL_LIGHT_KILL) - discard; -#else - vec4 frag = vary_fragcoord; - frag.xyz /= frag.w; - frag.xyz = frag.xyz*0.5+0.5; - - vec3 pos = getPosition(frag.xy).xyz; - vec3 lv = center.xyz-pos.xyz; - float dist = length(lv); - dist /= size; - if (dist > 1.0) - { - discard; - } - - float envIntensity = texture2D(normalMap, frag.xy).z; - vec3 norm = getNorm(frag.xy); - - float l_dist = -dot(lv, proj_n); - - vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); - if (proj_tc.z < 0.0) - { - discard; - } - - proj_tc.xyz /= proj_tc.w; - - float fa = falloff+1.0; - float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0); - dist_atten *= dist_atten; - dist_atten *= 2.0; - - - if (dist_atten <= 0.0) - { - discard; - } - - float noise = texture2D(noiseMap, frag.xy).b; - dist_atten *= noise; - - lv = proj_origin-pos.xyz; - lv = normalize(lv); - float da = dot(norm, lv); - - - vec3 diff_tex = texture2D(diffuseRect, frag.xy).rgb; - - vec3 dlit = vec3(0, 0, 0); - - - if (proj_tc.z > 0.0 && - proj_tc.x < 1.0 && - proj_tc.y < 1.0 && - proj_tc.x > 0.0 && - proj_tc.y > 0.0) - { - float lit = 0.0; - float amb_da = proj_ambiance; - - if (da > 0.0) - { - float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0); - float lod = diff * proj_lod; - - vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod); - - dlit = color.rgb * plcol.rgb * plcol.a; - - lit = da * dist_atten; - - col = dlit*lit*diff_tex; - amb_da += (da*0.5)*proj_ambiance; - } - //float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); - vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod); - - amb_da += (da*da*0.5+0.5)*proj_ambiance; - - amb_da *= dist_atten * noise; - - amb_da = min(amb_da, 1.0-lit); - col += amb_da*color.rgb*diff_tex*amb_plcol.rgb*amb_plcol.a; - } - - - vec4 spec = texture2D(specularRect, frag.xy); - - if (spec.a > 0.0) - { - dlit *= min(da*6.0, 1.0) * dist_atten; - - vec3 npos = -normalize(pos); - - //vec3 ref = dot(pos+lv, norm); - vec3 h = normalize(lv+npos); - float nh = dot(norm, h); - float nv = dot(norm, npos); - float vh = dot(npos, h); - float sa = nh; - float fres = pow(1 - dot(h, npos), 5)*0.4+0.5; - - float gtdenom = 2 * nh; - float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh)); - - if (nh > 0.0) - { - float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); - col += dlit*scol*spec.rgb; - //col += spec.rgb; - } - } - - if (envIntensity > 0.0) - { - vec3 ref = reflect(normalize(pos), norm); - - //project from point pos in direction ref to plane proj_p, proj_n - vec3 pdelta = proj_p-pos; - float ds = dot(ref, proj_n); - - if (ds < 0.0) - { - vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; - - vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0)); - - if (stc.z > 0.0) - { - stc /= stc.w; - - if (stc.x < 1.0 && - stc.y < 1.0 && - stc.x > 0.0 && - stc.y > 0.0) - { - col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a) * (proj_lod * 0.6)).rgb * envIntensity; - } - } - } - } -#endif - - //output linear, sum of lights will be gamma corrected later - frag_color.rgb = col; - frag_color.a = 0.0; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbralphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbralphaF.glsl deleted file mode 100644 index fc1024f4f1..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/pbralphaF.glsl +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file class1\deferred\pbralphaF.glsl - * - * $LicenseInfo:firstyear=2022&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2022, 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$ - */ - -/*[EXTRA_CODE_HERE]*/ - -out vec4 frag_color; - -void main() -{ - frag_color = vec4(0,1,0,0.5); -} - diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl deleted file mode 100644 index a025c4a1b4..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @file class1\deferred\pointLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -// debug stub -out vec4 frag_color; - -void main() -{ - frag_color = vec4(0.0, 0.5, 0.5, 0.0); -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl deleted file mode 100644 index 3da8531442..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @file pointLightV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform mat4 modelview_projection_matrix; -uniform mat4 modelview_matrix; - -ATTRIBUTE vec3 position; - -uniform vec3 center; -uniform float size; - -VARYING vec4 vary_fragcoord; -VARYING vec3 trans_center; - -void main() -{ - //transform vertex - vec3 p = position*size+center; - vec4 pos = modelview_projection_matrix * vec4(p.xyz, 1.0); - vary_fragcoord = pos; - trans_center = (modelview_matrix*vec4(center.xyz, 1.0)).xyz; - gl_Position = pos; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl deleted file mode 100644 index 8111f43c28..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl +++ /dev/null @@ -1,99 +0,0 @@ -/** - * @file postgiF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -/*[EXTRA_CODE_HERE]*/ - - #ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform sampler2D depthMap; -uniform sampler2D normalMap; -uniform sampler2D giLightMap; -uniform sampler2D noiseMap; - -uniform vec2 kern[32]; -uniform float dist_factor; -uniform float blur_size; -uniform vec2 delta; -uniform int kern_length; -uniform float kern_scale; -uniform vec3 blur_quad; - -VARYING vec2 vary_fragcoord; - -uniform mat4 inv_proj; -uniform vec2 screen_res; - -vec4 getPosition(vec2 pos_screen); - -void main() -{ - vec3 norm = texture2D(normalMap, vary_fragcoord.xy).xyz; - norm = vec3((norm.xy-0.5)*2.0,norm.z); // unpack norm - vec3 pos = getPosition(vary_fragcoord.xy).xyz; - - vec3 ccol = texture2D(giLightMap, vary_fragcoord.xy).rgb; - vec2 dlt = kern_scale * delta/(1.0+norm.xy*norm.xy); - dlt /= max(-pos.z*dist_factor, 1.0); - float defined_weight = kern[0].x; - vec3 col = vec3(0.0); - - for (int i = 0; i < kern_length; i++) - { - vec2 tc = vary_fragcoord.xy + kern[i].y*dlt; - vec3 sampNorm = texture2D(normalMap, tc.xy).xyz; - sampNorm = vec3((sampNorm.xy-0.5)*2.0,sampNorm.z); // unpack norm - - float d = dot(norm.xyz, sampNorm); - - if (d > 0.8) - { - vec3 samppos = getPosition(tc.xy).xyz; - samppos -= pos; - if (dot(samppos,samppos) < -0.05*pos.z) - { - col += texture2D(giLightMap, tc).rgb*kern[i].x; - defined_weight += kern[i].x; - } - } - } - - col /= defined_weight; - - //col = ccol; - - col = col*col*blur_quad.x + col*blur_quad.y + blur_quad.z; - - frag_color.rgb = col; - -#ifdef IS_AMD_CARD - // If it's AMD make sure the GLSL compiler sees the arrays referenced once by static index. Otherwise it seems to optimise the storage awawy which leads to unfun crashes and artifacts. - vec2 dummy1 = kern[0]; - vec2 dummy2 = kern[31]; -#endif -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class1/deferred/reflectionProbeF.glsl deleted file mode 100644 index 2ffe688524..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/reflectionProbeF.glsl +++ /dev/null @@ -1,64 +0,0 @@ -/** - * @file class1/deferred/reflectionProbeF.glsl - * - * $LicenseInfo:firstyear=2022&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2022, 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$ - */ - -// fallback stub -- will be used if actual reflection probe shader failed to load (output pink so it's obvious) -void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness, bool errorCorrect) -{ - ambenv = vec3(1,0,1); - glossenv = vec3(1,0,1); -} - -void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness) -{ - sampleReflectionProbes(ambenv, glossenv, - pos, norm, glossiness, false); -} - -vec4 sampleReflectionProbesDebug(vec3 pos) -{ - //output green to debug display - return vec4(0, 1, 0, 0.5); -} - -void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv, - vec3 pos, vec3 norm, float glossiness, float envIntensity) -{ - ambenv = vec3(1,0,1); - glossenv = vec3(1,0,1); - legacyenv = vec3(1,0,1); -} - -void applyGlossEnv(inout vec3 color, vec3 glossenv, vec4 spec, vec3 pos, vec3 norm) -{ - -} - -void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3 norm, float envIntensity) -{ - -} - diff --git a/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflPostF.glsl b/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflPostF.glsl deleted file mode 100644 index df16e7f0e7..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflPostF.glsl +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @file class3/deferred/screenSpaceReflPostF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - - // debug stub - -out vec4 frag_color; - -void main() -{ - frag_color = vec4(0.5, 0.4, 0.1, 0); -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflPostV.glsl b/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflPostV.glsl deleted file mode 100644 index 966e7e1cbb..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflPostV.glsl +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @file class3/deferred/screenSpaceReflPostV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -ATTRIBUTE vec3 position; - -uniform vec2 screen_res; - -VARYING vec2 vary_fragcoord; - -void main() -{ - //transform vertex - vec4 pos = vec4(position.xyz, 1.0); - gl_Position = pos; - - vary_fragcoord = pos.xy * 0.5 + 0.5; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl deleted file mode 100644 index 152402907b..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ /dev/null @@ -1,165 +0,0 @@ -/** - * @file class1/deferred/softenLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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 -#extension GL_ARB_shader_texture_lod : enable - -/*[EXTRA_CODE_HERE]*/ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -uniform sampler2D diffuseRect; -uniform sampler2D specularRect; -uniform sampler2D normalMap; -uniform sampler2D lightMap; -uniform sampler2D depthMap; -uniform samplerCube environmentMap; -uniform sampler2D lightFunc; - -uniform float blur_size; -uniform float blur_fidelity; - -// Inputs -uniform mat3 env_mat; - -uniform vec3 sun_dir; -uniform vec3 moon_dir; -uniform int sun_up_factor; -VARYING vec2 vary_fragcoord; - -uniform mat4 inv_proj; -uniform vec2 screen_res; - -vec3 getNorm(vec2 pos_screen); -vec4 getPositionWithDepth(vec2 pos_screen, float depth); -float getDepth(vec2 pos_screen); - -void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao); -float getAmbientClamp(); -vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten); -vec3 scaleSoftClipFrag(vec3 l); -vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten); -vec3 fullbrightScaleSoftClip(vec3 light); - -vec3 linear_to_srgb(vec3 c); -vec3 srgb_to_linear(vec3 c); - -#ifdef WATER_FOG -vec4 applyWaterFogView(vec3 pos, vec4 color); -#endif - -void main() -{ - vec2 tc = vary_fragcoord.xy; - float depth = getDepth(tc); - vec4 pos = getPositionWithDepth(tc, depth); - vec4 norm = texture2D(normalMap, tc); - float envIntensity = norm.z; - norm.xyz = getNorm(tc); - - vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir; - float da = clamp(dot(norm.xyz, light_dir.xyz), 0.0, 1.0); - float light_gamma = 1.0/1.3; - da = pow(da, light_gamma); - - vec4 diffuse = texture2D(diffuseRect, tc); - - //convert to gamma space - diffuse.rgb = linear_to_srgb(diffuse.rgb); // SL-14035 - - vec4 spec = texture2D(specularRect, vary_fragcoord.xy); - vec3 color = vec3(0); - float bloom = 0.0; - { - float ambocc = 1.0; // no AO... - - vec3 sunlit; - vec3 amblit; - vec3 additive; - vec3 atten; - - calcAtmosphericVars(pos.xyz, light_dir, ambocc, sunlit, amblit, additive, atten, false); - - color.rgb = amblit; - - float ambient = min(abs(dot(norm.xyz, sun_dir.xyz)), 1.0); - ambient *= 0.5; - ambient *= ambient; - ambient = (1.0 - ambient); - - color.rgb *= ambient; - - vec3 sun_contrib = da * sunlit; - - color.rgb += sun_contrib; - - color.rgb *= diffuse.rgb; - - vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); - - if (spec.a > 0.0) // specular reflection - { - float sa = dot(refnormpersp, light_dir.xyz); - vec3 dumbshiny = sunlit * (texture2D(lightFunc, vec2(sa, spec.a)).r); - - // add the two types of shiny together - vec3 spec_contrib = dumbshiny * spec.rgb; - bloom = dot(spec_contrib, spec_contrib) / 6; - color.rgb += spec_contrib; - } - - color.rgb = mix(color.rgb, diffuse.rgb, diffuse.a); - - if (envIntensity > 0.0) - { //add environmentmap - vec3 env_vec = env_mat * refnormpersp; - vec3 reflected_color = textureCube(environmentMap, env_vec).rgb; - color = mix(color.rgb, reflected_color, envIntensity); - } - - if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_ATMOS)) - { - color = mix(atmosFragLighting(color, additive, atten), fullbrightAtmosTransportFrag(color, additive, atten), diffuse.a); - color = mix(scaleSoftClipFrag(color), fullbrightScaleSoftClip(color), diffuse.a); - } - - #ifdef WATER_FOG - vec4 fogged = applyWaterFogView(pos.xyz,vec4(color, bloom)); - color = fogged.rgb; - bloom = fogged.a; - #endif - - } - - // convert to linear as fullscreen lights need to sum in linear colorspace - // and will be gamma (re)corrected downstream... - - frag_color.rgb = srgb_to_linear(color.rgb); - frag_color.a = bloom; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl deleted file mode 100644 index 23ad332db4..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl +++ /dev/null @@ -1,43 +0,0 @@ -/** - * @file softenLightV.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -ATTRIBUTE vec3 position; - -uniform vec2 screen_res; - -void setAtmosAttenuation(vec3 c); -void setAdditiveColor(vec3 c); - -VARYING vec2 vary_fragcoord; -void main() -{ - //transform vertex - vec4 pos = vec4(position.xyz, 1.0); - gl_Position = pos; - // appease OSX GLSL compiler/linker by touching all the varyings we said we would - setAtmosAttenuation(vec3(1)); - setAdditiveColor(vec3(0)); - vary_fragcoord = (pos.xy*0.5+0.5); -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl deleted file mode 100644 index 0376f42319..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl +++ /dev/null @@ -1,278 +0,0 @@ -/** - * @file spotLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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 -#extension GL_ARB_shader_texture_lod : enable - -/*[EXTRA_CODE_HERE]*/ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -//class 1 -- no shadows - -uniform sampler2D diffuseRect; -uniform sampler2D specularRect; -uniform sampler2D depthMap; -uniform sampler2D normalMap; -uniform samplerCube environmentMap; -uniform sampler2D noiseMap; -uniform sampler2D projectionMap; -uniform sampler2D lightFunc; - -uniform mat4 proj_mat; //screen space to light space -uniform float proj_near; //near clip for projection -uniform vec3 proj_p; //plane projection is emitting from (in screen space) -uniform vec3 proj_n; -uniform float proj_focus; //distance from plane to begin blurring -uniform float proj_lod; //(number of mips in proj map) -uniform float proj_range; //range between near clip and far clip plane of projection -uniform float proj_ambient_lod; -uniform float proj_ambiance; -uniform float near_clip; -uniform float far_clip; - -uniform vec3 proj_origin; //origin of projection to be used for angular attenuation -uniform float sun_wash; - -uniform float size; -uniform vec3 color; -uniform float falloff; - -VARYING vec3 trans_center; -VARYING vec4 vary_fragcoord; -uniform vec2 screen_res; - -uniform mat4 inv_proj; - -vec3 getNorm(vec2 pos_screen); -vec3 srgb_to_linear(vec3 c); - -vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod) -{ - vec4 ret = texture2DLod(projectionMap, tc, lod); - ret.rgb = srgb_to_linear(ret.rgb); - - vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); - - float det = min(lod/(proj_lod*0.5), 1.0); - - float d = min(dist.x, dist.y); - - d *= min(1, d * (proj_lod - lod)); - - float edge = 0.25*det; - - ret *= clamp(d/edge, 0.0, 1.0); - - return ret; -} - -vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod) -{ - vec4 ret = texture2DLod(projectionMap, tc, lod); - ret.rgb = srgb_to_linear(ret.rgb); - - vec2 dist = vec2(0.5) - abs(tc-vec2(0.5)); - - float det = min(lod/(proj_lod*0.5), 1.0); - - float d = min(dist.x, dist.y); - - float edge = 0.25*det; - - ret *= clamp(d/edge, 0.0, 1.0); - - return ret; -} - -vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod) -{ - vec4 ret = texture2DLod(projectionMap, tc, lod); - ret.rgb = srgb_to_linear(ret.rgb); - - vec2 dist = tc-vec2(0.5); - - float d = dot(dist,dist); - - ret *= min(clamp((0.25-d)/0.25, 0.0, 1.0), 1.0); - - return ret; -} - -vec4 getPosition(vec2 pos_screen); - -void main() -{ - vec3 col = vec3(0,0,0); - -#if defined(LOCAL_LIGHT_KILL) - discard; -#else - vec4 frag = vary_fragcoord; - frag.xyz /= frag.w; - frag.xyz = frag.xyz*0.5+0.5; - - vec3 pos = getPosition(frag.xy).xyz; - vec3 lv = trans_center.xyz-pos.xyz; - float dist = length(lv); - dist /= size; - if (dist > 1.0) - { - discard; - } - - vec3 norm = texture2D(normalMap, frag.xy).xyz; - float envIntensity = norm.z; - norm = getNorm(frag.xy); - norm = normalize(norm); - float l_dist = -dot(lv, proj_n); - - vec4 proj_tc = (proj_mat * vec4(pos.xyz, 1.0)); - if (proj_tc.z < 0.0) - { - discard; - } - - proj_tc.xyz /= proj_tc.w; - - float fa = falloff+1.0; - float dist_atten = min(1.0-(dist-1.0*(1.0-fa))/fa, 1.0); - dist_atten *= dist_atten; - dist_atten *= 2.0; - - if (dist_atten <= 0.0) - { - discard; - } - - lv = proj_origin-pos.xyz; - lv = normalize(lv); - float da = dot(norm, lv); - - vec3 diff_tex = texture2D(diffuseRect, frag.xy).rgb; - //light shaders output linear and are gamma corrected later in postDeferredGammaCorrectF.glsl - diff_tex.rgb = srgb_to_linear(diff_tex.rgb); - - vec4 spec = texture2D(specularRect, frag.xy); - - float noise = texture2D(noiseMap, frag.xy).b; - vec3 dlit = vec3(0, 0, 0); - - if (proj_tc.z > 0.0 && - proj_tc.x < 1.0 && - proj_tc.y < 1.0 && - proj_tc.x > 0.0 && - proj_tc.y > 0.0) - { - float amb_da = proj_ambiance; - float lit = 0.0; - - if (da > 0.0) - { - lit = da * dist_atten * noise; - - float diff = clamp((l_dist-proj_focus)/proj_range, 0.0, 1.0); - float lod = diff * proj_lod; - - vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod); - dlit = color.rgb * plcol.rgb * plcol.a; - - col = dlit*lit*diff_tex; - //amb_da += (da*0.5)*(1.0-shadow)*proj_ambiance; - } - //float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); - vec4 amb_plcol = texture2DLodAmbient(projectionMap, proj_tc.xy, proj_lod); - - amb_da += (da*da*0.5+0.5)*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*diff_tex.rgb; - } - - if (spec.a > 0.0) - { - dlit *= min(da*6.0, 1.0) * dist_atten; - vec3 npos = -normalize(pos); - - //vec3 ref = dot(pos+lv, norm); - vec3 h = normalize(lv+npos); - float nh = dot(norm, h); - float nv = dot(norm, npos); - float vh = dot(npos, h); - float sa = nh; - float fres = pow(1 - dot(h, npos), 5)*0.4+0.5; - - float gtdenom = 2 * nh; - float gt = max(0, min(gtdenom * nv / vh, gtdenom * da / vh)); - - if (nh > 0.0) - { - - float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); - col += dlit*scol*spec.rgb; - //col += spec.rgb; - } - } - - if (envIntensity > 0.0) - { - vec3 ref = reflect(normalize(pos), norm); - - //project from point pos in direction ref to plane proj_p, proj_n - vec3 pdelta = proj_p-pos; - float ds = dot(ref, proj_n); - - if (ds < 0.0) - { - vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; - - vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0)); - - if (stc.z > 0.0) - { - stc /= stc.w; - - if (stc.x < 1.0 && - stc.y < 1.0 && - stc.x > 0.0 && - stc.y > 0.0) - { - col += color.rgb * texture2DLodSpecular(projectionMap, stc.xy, (1 - spec.a) * (proj_lod * 0.6)).rgb * envIntensity; - } - } - } - } -#endif - - //col.r = 1.0; - frag_color.rgb = col; - frag_color.a = 0.0; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl deleted file mode 100644 index 7329efe3f7..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightF.glsl +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @file sunLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -//class 1, no shadow, no SSAO, should never be called - -#extension GL_ARB_texture_rectangle : enable - -/*[EXTRA_CODE_HERE]*/ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -void main() -{ - frag_color = vec4(0,0,0,0); -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightNoFragCoordV.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightNoFragCoordV.glsl deleted file mode 100644 index 47e9d15fbc..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightNoFragCoordV.glsl +++ /dev/null @@ -1,37 +0,0 @@ -/** - * @file sunLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -uniform mat4 modelview_projection_matrix; - -ATTRIBUTE vec3 position; - -uniform vec2 screen_res; - -void main() -{ - //transform vertex - vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_Position = pos; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl deleted file mode 100644 index d9a0b6c702..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl +++ /dev/null @@ -1,62 +0,0 @@ -/** - * @file sunLightSSAOF.glsl - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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 - -//class 1 -- no shadow, SSAO only - -uniform sampler2D normalMap; - -// Inputs -VARYING vec2 vary_fragcoord; - -vec3 getNorm(vec2 pos_screen); -vec4 getPosition(vec2 pos_screen); - -//calculate decreases in ambient lighting when crowded out (SSAO) -float calcAmbientOcclusion(vec4 pos, vec3 norm, vec2 pos_screen); - -void main() -{ - vec2 pos_screen = vary_fragcoord.xy; - - //try doing an unproject here - - vec4 pos = getPosition(pos_screen); - vec3 norm = getNorm(pos_screen); - - frag_color[0] = 1.0; - frag_color[1] = calcAmbientOcclusion(pos, norm, pos_screen); - frag_color[2] = 1.0; - frag_color[3] = 1.0; -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl deleted file mode 100644 index 9d70b9d98d..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @file sunLightF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -ATTRIBUTE vec3 position; - -VARYING vec2 vary_fragcoord; - -uniform vec2 screen_res; - -void main() -{ - //transform vertex - vec4 pos = vec4(position.xyz, 1.0); - gl_Position = pos; - - vary_fragcoord = (pos.xy * 0.5 + 0.5); -} diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl deleted file mode 100644 index 876422f86b..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @file class1/deferred/waterF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, 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$ - */ - -// debug stub -out vec4 frag_data[4]; - -void main() -{ - // emissive blue PBR material - frag_data[0] = vec4(0, 0, 0, 0); - frag_data[1] = vec4(0, 0, 0, 0); - frag_data[2] = vec4(1, 0, 0, GBUFFER_FLAG_HAS_PBR); - frag_data[3] = vec4(0, 0, 1, 0); -} |