diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class2/windlight')
14 files changed, 0 insertions, 1122 deletions
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl deleted file mode 100644 index ee9c990b12..0000000000 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @file class2\wl\atmosphericsF.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$ - */ - -vec3 getAdditiveColor(); -vec3 getAtmosAttenuation(); -vec3 scaleSoftClipFrag(vec3 light); - -uniform int no_atmo; - -vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten) -{ - if (no_atmo == 1) - { - return light; - } - light *= atten.r; - light += additive; - return light * 2.0; -} - -vec3 atmosLighting(vec3 light) -{ - return atmosFragLighting(light, getAdditiveColor(), getAtmosAttenuation()); -} diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl deleted file mode 100644 index 5788871744..0000000000 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @file class2\wl\atmosphericsHelpersV.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$ - */ - -// Output variables - -uniform float scene_light_strength; -uniform int no_atmo; - -vec3 atmosFragAmbient(vec3 light, vec3 amblit) -{ - if (no_atmo == 1) return light; - return amblit + light / 2.0; -} - -vec3 atmosFragAffectDirectionalLight(float lightIntensity, vec3 sunlit) -{ - return sunlit * lightIntensity; -} - -vec3 scaleDownLightFrag(vec3 light) -{ - return (light / scene_light_strength ); -} - diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl deleted file mode 100644 index 9c42b84eca..0000000000 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl +++ /dev/null @@ -1,63 +0,0 @@ -/** - * @file class2\wl\atmosphericsHelpersV.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$ - */ - - - -// Output variables -vec3 getSunlitColor(); -vec3 getAmblitColor(); -vec3 getAdditiveColor(); -vec3 getAtmosAttenuation(); -vec3 getPositionEye(); - -uniform float scene_light_strength; -uniform int no_atmo; - -vec3 atmosAmbient() -{ - if (no_atmo == 1) return vec3(0.16); - return getAmblitColor(); -} - -vec3 atmosAffectDirectionalLight(float lightIntensity) -{ - return getSunlitColor() * lightIntensity; -} - -vec3 atmosGetDiffuseSunlightColor() -{ - return getSunlitColor(); -} - -vec3 scaleDownLight(vec3 light) -{ - return (light / scene_light_strength ); -} - -vec3 scaleUpLight(vec3 light) -{ - return (light * scene_light_strength); -} - diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl deleted file mode 100644 index 4c418e414f..0000000000 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl +++ /dev/null @@ -1,56 +0,0 @@ -/** - * @file class2\wl\atmosphericsV.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$ - */ - -// VARYING param funcs - - -uniform vec3 sun_dir; -uniform vec3 moon_dir; -uniform int sun_up_factor; - -void setSunlitColor(vec3 v); -void setAmblitColor(vec3 v); -void setAdditiveColor(vec3 v); -void setAtmosAttenuation(vec3 v); -void setPositionEye(vec3 v); - -vec3 getAdditiveColor(); - -void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao); - -void calcAtmospherics(vec3 inPositionEye) { - vec3 P = inPositionEye; - setPositionEye(P); - vec3 tmpsunlit = vec3(1); - vec3 tmpamblit = vec3(1); - vec3 tmpaddlit = vec3(1); - vec3 tmpattenlit = vec3(1); - vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir; - calcAtmosphericVars(inPositionEye, light_dir, 1, tmpsunlit, tmpamblit, tmpaddlit, tmpattenlit, false); - setSunlitColor(tmpsunlit); - setAmblitColor(tmpamblit); - setAdditiveColor(tmpaddlit); - setAtmosAttenuation(tmpattenlit); -} diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl deleted file mode 100644 index 07733bda18..0000000000 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @file class2\wl\atmosphericVarsF.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$ - */ - - -VARYING vec3 vary_AdditiveColor; -VARYING vec3 vary_AtmosAttenuation; - -vec3 getSunlitColor() -{ - return vec3(0,0,0); -} - -vec3 getAmblitColor() -{ - return vec3(0,0,0); -} - -vec3 getAdditiveColor() -{ - return vary_AdditiveColor; -} - -vec3 getAtmosAttenuation() -{ - return vec3(vary_AtmosAttenuation); -} diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl deleted file mode 100644 index 31109aed31..0000000000 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl +++ /dev/null @@ -1,84 +0,0 @@ -/** - * @file class2\wl\atmosphericVars.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$ - */ - - -VARYING vec3 vary_AdditiveColor; -VARYING vec3 vary_AtmosAttenuation; - -vec3 additive_color; -vec3 atmos_attenuation; -vec3 sunlit_color; -vec3 amblit_color; -vec3 position_eye; - -vec3 getSunlitColor() -{ - return sunlit_color; -} -vec3 getAmblitColor() -{ - return amblit_color; -} - -vec3 getAdditiveColor() -{ - return additive_color; -} -vec3 getAtmosAttenuation() -{ - return atmos_attenuation; -} - -vec3 getPositionEye() -{ - return position_eye; -} - -void setPositionEye(vec3 v) -{ - position_eye = v; -} - -void setSunlitColor(vec3 v) -{ - sunlit_color = v; -} - -void setAmblitColor(vec3 v) -{ - amblit_color = v; -} - -void setAdditiveColor(vec3 v) -{ - additive_color = v; - vary_AdditiveColor = v; -} - -void setAtmosAttenuation(vec3 v) -{ - atmos_attenuation = v; - vary_AtmosAttenuation = v; -} diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterF.glsl deleted file mode 100644 index 22e16b7e0f..0000000000 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterF.glsl +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @file class2\wl\atmosphericVarsWaterF.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$ - */ - -VARYING vec3 vary_PositionEye; -VARYING vec3 vary_AdditiveColor; -VARYING vec3 vary_AtmosAttenuation; - -vec3 getSunlitColor() -{ - return vec3(0,0,0); -} -vec3 getAmblitColor() -{ - return vec3(0,0,0); -} -vec3 getAdditiveColor() -{ - return vary_AdditiveColor; -} -vec3 getAtmosAttenuation() -{ - return vary_AtmosAttenuation; -} -vec3 getPositionEye() -{ - return vary_PositionEye; -} - diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterV.glsl deleted file mode 100644 index 0f2a3ee527..0000000000 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsWaterV.glsl +++ /dev/null @@ -1,81 +0,0 @@ -/** - * @file class2\wl\atmosphericVarsWaterV.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$ - */ - -VARYING vec3 vary_PositionEye; -VARYING vec3 vary_AdditiveColor; -VARYING vec3 vary_AtmosAttenuation; - -vec3 atmos_attenuation; -vec3 sunlit_color; -vec3 amblit_color; - -vec3 getSunlitColor() -{ - return sunlit_color; -} -vec3 getAmblitColor() -{ - return amblit_color; -} - -vec3 getAdditiveColor() -{ - return vary_AdditiveColor; -} -vec3 getAtmosAttenuation() -{ - return atmos_attenuation; -} - -vec3 getPositionEye() -{ - return vary_PositionEye; -} - -void setPositionEye(vec3 v) -{ - vary_PositionEye = v; -} - -void setSunlitColor(vec3 v) -{ - sunlit_color = v; -} - -void setAmblitColor(vec3 v) -{ - amblit_color = v; -} - -void setAdditiveColor(vec3 v) -{ - vary_AdditiveColor = v; -} - -void setAtmosAttenuation(vec3 v) -{ - atmos_attenuation = v; - vary_AtmosAttenuation = v; -} diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl deleted file mode 100644 index fa928d993e..0000000000 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl +++ /dev/null @@ -1,131 +0,0 @@ -/** - * @file class2\wl\cloudsF.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$ - */ - -/*[EXTRA_CODE_HERE]*/ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -///////////////////////////////////////////////////////////////////////// -// The fragment shader for the sky -///////////////////////////////////////////////////////////////////////// - -VARYING vec4 vary_CloudColorSun; -VARYING vec4 vary_CloudColorAmbient; -VARYING float vary_CloudDensity; - -uniform sampler2D cloud_noise_texture; -uniform sampler2D cloud_noise_texture_next; -uniform float blend_factor; -uniform vec4 cloud_pos_density1; -uniform vec4 cloud_pos_density2; -uniform float cloud_scale; -uniform float cloud_variance; - -VARYING vec2 vary_texcoord0; -VARYING vec2 vary_texcoord1; -VARYING vec2 vary_texcoord2; -VARYING vec2 vary_texcoord3; -VARYING float altitude_blend_factor; - -/// Soft clips the light with a gamma correction -vec3 scaleSoftClip(vec3 light); - -vec4 cloudNoise(vec2 uv) -{ - vec4 a = texture2D(cloud_noise_texture, uv); - vec4 b = texture2D(cloud_noise_texture_next, uv); - vec4 cloud_noise_sample = mix(a, b, blend_factor); - return cloud_noise_sample; -} - -void main() -{ - // Set variables - vec2 uv1 = vary_texcoord0.xy; - vec2 uv2 = vary_texcoord1.xy; - - vec4 cloudColorSun = vary_CloudColorSun; - vec4 cloudColorAmbient = vary_CloudColorAmbient; - float cloudDensity = vary_CloudDensity; - vec2 uv3 = vary_texcoord2.xy; - vec2 uv4 = vary_texcoord3.xy; - - if (cloud_scale < 0.001) - { - discard; - } - - vec2 disturbance = vec2(cloudNoise(uv1 / 8.0f).x, cloudNoise((uv3 + uv1) / 16.0f).x) * cloud_variance * (1.0f - cloud_scale * 0.25f); - vec2 disturbance2 = vec2(cloudNoise((uv1 + uv3) / 4.0f).x, cloudNoise((uv4 + uv2) / 8.0f).x) * cloud_variance * (1.0f - cloud_scale * 0.25f); - - // Offset texture coords - uv1 += cloud_pos_density1.xy + (disturbance * 0.2); //large texture, visible density - uv2 += cloud_pos_density1.xy; //large texture, self shadow - uv3 += cloud_pos_density2.xy; //small texture, visible density - uv4 += cloud_pos_density2.xy; //small texture, self shadow - - float density_variance = min(1.0, (disturbance.x* 2.0 + disturbance.y* 2.0 + disturbance2.x + disturbance2.y) * 4.0); - - cloudDensity *= 1.0 - (density_variance * density_variance); - - // Compute alpha1, the main cloud opacity - - float alpha1 = (cloudNoise(uv1).x - 0.5) + (cloudNoise(uv3).x - 0.5) * cloud_pos_density2.z; - alpha1 = min(max(alpha1 + cloudDensity, 0.) * 10 * cloud_pos_density1.z, 1.); - - // And smooth - alpha1 = 1. - alpha1 * alpha1; - alpha1 = 1. - alpha1 * alpha1; - - alpha1 *= altitude_blend_factor; - - //if (alpha1 < 0.001f) - //{ - // discard; - //} - - // Compute alpha2, for self shadowing effect - // (1 - alpha2) will later be used as percentage of incoming sunlight - float alpha2 = (cloudNoise(uv2).x - 0.5); - alpha2 = min(max(alpha2 + cloudDensity, 0.) * 2.5 * cloud_pos_density1.z, 1.); - - // And smooth - alpha2 = 1. - alpha2; - alpha2 = 1. - alpha2 * alpha2; - - // Combine - vec4 color; - color = (cloudColorSun*(1.-alpha2) + cloudColorAmbient); - color.rgb *= 2.; - color.rgb = scaleSoftClip(color.rgb); - - /// Gamma correct for WL (soft clip effect). - frag_color = vec4(color.rgb, alpha1); -} - diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl deleted file mode 100644 index 97ffa9feef..0000000000 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl +++ /dev/null @@ -1,193 +0,0 @@ -/** - * @file class2\wl\cloudsV.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$ - */ - -uniform mat4 modelview_projection_matrix; - -ATTRIBUTE vec3 position; -ATTRIBUTE vec2 texcoord0; - -////////////////////////////////////////////////////////////////////////// -// The vertex shader for creating the atmospheric sky -/////////////////////////////////////////////////////////////////////////////// - -// Output parameters -VARYING vec4 vary_CloudColorSun; -VARYING vec4 vary_CloudColorAmbient; -VARYING float vary_CloudDensity; - -VARYING vec2 vary_texcoord0; -VARYING vec2 vary_texcoord1; -VARYING vec2 vary_texcoord2; -VARYING vec2 vary_texcoord3; -VARYING float altitude_blend_factor; - -// Inputs -uniform vec3 camPosLocal; - -uniform vec4 lightnorm; -uniform vec4 sunlight_color; -uniform vec4 moonlight_color; -uniform int sun_up_factor; -uniform vec4 ambient_color; -uniform vec4 blue_horizon; -uniform vec4 blue_density; -uniform float haze_horizon; -uniform float haze_density; - -uniform float cloud_shadow; -uniform float density_multiplier; -uniform float max_y; - -uniform vec4 glow; -uniform float sun_moon_glow_factor; - -uniform vec4 cloud_color; - -uniform float cloud_scale; - -// NOTE: Keep these in sync! -// indra\newview\app_settings\shaders\class1\deferred\skyV.glsl -// indra\newview\app_settings\shaders\class1\deferred\cloudsV.glsl -// indra\newview\app-settings\shaders\class2\windlight\cloudsV.glsl -// indra\newview\lllegacyatmospherics.cpp -// indra\newview\llsettingsvo.cpp -void main() -{ - // World / view / projection - gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - - // Texture coords - // SL-13084 EEP added support for custom cloud textures -- flip them horizontally to match the preview of Clouds > Cloud Scroll - vary_texcoord0 = vec2(-texcoord0.x, texcoord0.y); // See: LLSettingsVOSky::applySpecial - - vary_texcoord0.xy -= 0.5; - vary_texcoord0.xy /= cloud_scale; - vary_texcoord0.xy += 0.5; - - vary_texcoord1 = vary_texcoord0; - vary_texcoord1.x += lightnorm.x * 0.0125; - vary_texcoord1.y += lightnorm.z * 0.0125; - - vary_texcoord2 = vary_texcoord0 * 16.; - vary_texcoord3 = vary_texcoord1 * 16.; - - // Get relative position - vec3 rel_pos = position.xyz - camPosLocal.xyz + vec3(0, 50, 0); - - // fade clouds beyond a certain point so the bottom of the sky dome doesn't look silly at high altitude - altitude_blend_factor = clamp((rel_pos.y + 512.0) / max_y, 0.0, 1.0); - - // Adj position vector to clamp altitude - if (rel_pos.y > 0.) - { - rel_pos *= (max_y / rel_pos.y); - } - if (rel_pos.y < 0.) - { - rel_pos *= (-32000. / rel_pos.y); - } - - // Can normalize then - vec3 rel_pos_norm = normalize(rel_pos); - float rel_pos_len = length(rel_pos); - - // Initialize temp variables - vec4 sunlight = sunlight_color; - vec4 light_atten; - - // Sunlight attenuation effect (hue and brightness) due to atmosphere - // this is used later for sunlight modulation at various altitudes - light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y); - - // Calculate relative weights - vec4 combined_haze = abs(blue_density) + vec4(abs(haze_density)); - vec4 blue_weight = blue_density / combined_haze; - vec4 haze_weight = haze_density / combined_haze; - - // Compute sunlight from rel_pos & lightnorm (for long rays like sky) - float off_axis = 1.0 / max(1e-6, max(0., rel_pos_norm.y) + lightnorm.y); - sunlight *= exp(-light_atten * off_axis); - - // Distance - float density_dist = rel_pos_len * density_multiplier; - - // Transparency (-> combined_haze) - // ATI Bugfix -- can't store combined_haze*density_dist in a variable because the ati - // compiler gets confused. - combined_haze = exp(-combined_haze * density_dist); - - // Compute haze glow - float haze_glow = 1.0 - dot(rel_pos_norm, lightnorm.xyz); - // haze_glow is 0 at the sun and increases away from sun - haze_glow = max(haze_glow, .001); - // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) - haze_glow *= glow.x; - // Higher glow.x gives dimmer glow (because next step is 1 / "angle") - haze_glow = pow(haze_glow, glow.z); - // glow.z should be negative, so we're doing a sort of (1 / "angle") function - - haze_glow *= sun_moon_glow_factor; - - // Add "minimum anti-solar illumination" - // For sun, add to glow. For moon, remove glow entirely. SL-13768 - haze_glow = (sun_moon_glow_factor < 1.0) ? 0.0 : (haze_glow + 0.25); - - // Increase ambient when there are more clouds - vec4 tmpAmbient = ambient_color; - tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5; - - // Dim sunlight by cloud shadow percentage - sunlight *= (1. - cloud_shadow); - - // Haze color below cloud - vec4 additiveColorBelowCloud = - (blue_horizon * blue_weight * (sunlight + tmpAmbient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + tmpAmbient)); - - // CLOUDS - sunlight = sunlight_color; // SL-14707 reset color -- Clouds are unusually dim in EEP - off_axis = 1.0 / max(1e-6, lightnorm.y * 2.); - sunlight *= exp(-light_atten * off_axis); - - // Cloud color out - vary_CloudColorSun = (sunlight * haze_glow) * cloud_color; - vary_CloudColorAmbient = tmpAmbient * cloud_color; - - // Attenuate cloud color by atmosphere - combined_haze = sqrt(combined_haze); // less atmos opacity (more transparency) below clouds - vary_CloudColorSun *= combined_haze; - vary_CloudColorAmbient *= combined_haze; - vec4 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - combined_haze); - - // Make a nice cloud density based on the cloud_shadow value that was passed in. - vary_CloudDensity = 2. * (cloud_shadow - 0.25); - - // Combine these to minimize register use - vary_CloudColorAmbient += oHazeColorBelowCloud; - - // needs this to compile on mac - //vary_AtmosAttenuation = vec3(0.0,0.0,0.0); - - // END CLOUDS -} diff --git a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl deleted file mode 100644 index 68db7fcbb1..0000000000 --- a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl +++ /dev/null @@ -1,58 +0,0 @@ -/** - * @file class2\wl\gammaF.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 float gamma; -uniform int no_atmo; - -vec3 getAtmosAttenuation(); -vec3 getAdditiveColor(); - -vec3 scaleSoftClipFrag(vec3 light) -{ - if (no_atmo == 1) - { - return light; - } - //soft clip effect: - light = 1. - clamp(light, vec3(0.), vec3(1.)); - light = 1. - pow(light, vec3(gamma)); // s/b inverted already CPU-side - return light; -} - -vec3 scaleSoftClip(vec3 light) -{ - return scaleSoftClipFrag(light); -} - -vec3 fullbrightScaleSoftClipFrag(vec3 light, vec3 add, vec3 atten) -{ - //return mix(scaleSoftClipFrag(light.rgb), add, atten); - return scaleSoftClipFrag(light.rgb); -} - -vec3 fullbrightScaleSoftClip(vec3 light) -{ - return fullbrightScaleSoftClipFrag(light, getAdditiveColor(), getAtmosAttenuation()); -} - diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl deleted file mode 100644 index 7146349453..0000000000 --- a/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl +++ /dev/null @@ -1,55 +0,0 @@ -/** - * @file class2/windlight/skyF.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$ - */ - -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -///////////////////////////////////////////////////////////////////////// -// The fragment shader for the sky -///////////////////////////////////////////////////////////////////////// - -VARYING vec4 vary_HazeColor; - -/// Soft clips the light with a gamma correction -vec3 scaleSoftClip(vec3 light); - -void main() -{ - // Potential Fill-rate optimization. Add cloud calculation - // back in and output alpha of 0 (so that alpha culling kills - // the fragment) if the sky wouldn't show up because the clouds - // are fully opaque. - - vec4 color; - color = vary_HazeColor; - color.rgb *= 2.; - /// Gamma correct for WL (soft clip effect). - frag_color.rgb = scaleSoftClip(color.rgb); - frag_color.a = 1.0; -} - diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl deleted file mode 100644 index a0a33b8642..0000000000 --- a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl +++ /dev/null @@ -1,149 +0,0 @@ -/** - * @file class2\wl\skyV.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$ - */ - -uniform mat4 modelview_projection_matrix; - -ATTRIBUTE vec3 position; - -// SKY //////////////////////////////////////////////////////////////////////// -// The vertex shader for creating the atmospheric sky -/////////////////////////////////////////////////////////////////////////////// - -// Output parameters -VARYING vec4 vary_HazeColor; - -// Inputs -uniform vec3 camPosLocal; - -uniform vec4 lightnorm; -uniform vec4 sunlight_color; -uniform vec4 moonlight_color; -uniform int sun_up_factor; -uniform vec4 ambient_color; -uniform vec4 blue_horizon; -uniform vec4 blue_density; -uniform float haze_horizon; -uniform float haze_density; - -uniform float cloud_shadow; -uniform float density_multiplier; -uniform float distance_multiplier; -uniform float max_y; - -uniform vec4 glow; -uniform float sun_moon_glow_factor; - -uniform vec4 cloud_color; - -void main() -{ - // World / view / projection - vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0); - - gl_Position = pos; - - // Get relative position - vec3 rel_pos = position.xyz - camPosLocal.xyz + vec3(0, 50, 0); - - // Adj position vector to clamp altitude - if (rel_pos.y > 0.) - { - rel_pos *= (max_y / rel_pos.y); - } - if (rel_pos.y < 0.) - { - rel_pos *= (-32000. / rel_pos.y); - } - - // Can normalize then - vec3 rel_pos_norm = normalize(rel_pos); - - float rel_pos_len = length(rel_pos); - - // Initialize temp variables - vec4 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color; - vec4 light_atten; - - // Sunlight attenuation effect (hue and brightness) due to atmosphere - // this is used later for sunlight modulation at various altitudes - light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y); - - // Calculate relative weights - vec4 combined_haze = abs(blue_density) + vec4(abs(haze_density)); - vec4 blue_weight = blue_density / combined_haze; - vec4 haze_weight = haze_density / combined_haze; - - // Compute sunlight from rel_pos & lightnorm (for long rays like sky) - float off_axis = 1.0 / max(1e-6, max(0., rel_pos_norm.y) + lightnorm.y); - sunlight *= exp(-light_atten * off_axis); - - // Distance - float density_dist = rel_pos_len * density_multiplier; - - // Transparency (-> combined_haze) - // ATI Bugfix -- can't store combined_haze*density_dist in a variable because the ati - // compiler gets confused. - combined_haze = exp(-combined_haze * density_dist); - - // Compute haze glow - float haze_glow = 1.0 - dot(rel_pos_norm, lightnorm.xyz); - // haze_glow is 0 at the sun and increases away from sun - haze_glow = max(haze_glow, .001); - // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) - haze_glow *= glow.x; - // Higher glow.x gives dimmer glow (because next step is 1 / "angle") - haze_glow = pow(haze_glow, glow.z); - // glow.z should be negative, so we're doing a sort of (1 / "angle") function - - // Add "minimum anti-solar illumination" - // For sun, add to glow. For moon, remove glow entirely. SL-13768 - haze_glow = (sun_moon_glow_factor < 1.0) ? 0.0 : (haze_glow + 0.25); - - vec4 color = - (blue_horizon * blue_weight * (sunlight + ambient_color) + (haze_horizon * haze_weight) * (sunlight * haze_glow + ambient_color)); - - // Final atmosphere additive - color *= (1. - combined_haze); - - // Increase ambient when there are more clouds - vec4 tmpAmbient = ambient_color; - tmpAmbient += max(vec4(0), (1. - ambient_color)) * cloud_shadow * 0.5; - - // Dim sunlight by cloud shadow percentage - sunlight *= max(0.0, (1. - cloud_shadow)); - - // Haze color below cloud - vec4 additiveColorBelowCloud = - (blue_horizon * blue_weight * (sunlight + tmpAmbient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + tmpAmbient)); - - // Attenuate cloud color by atmosphere - combined_haze = sqrt(combined_haze); // less atmos opacity (more transparency) below clouds - - // At horizon, blend high altitude sky color towards the darker color below the clouds - color += (additiveColorBelowCloud - color) * (1. - sqrt(combined_haze)); - - // Haze color above cloud - vary_HazeColor = color; -} diff --git a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl deleted file mode 100644 index b53a2e237f..0000000000 --- a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl +++ /dev/null @@ -1,62 +0,0 @@ -/** - * @file class2\wl\transportF.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$ - */ - -////////////////////////////////////////////////////////// -// The fragment shader for the terrain atmospherics -////////////////////////////////////////////////////////// - -vec3 getAdditiveColor(); -vec3 getAtmosAttenuation(); - -uniform int no_atmo; - -vec3 atmosTransportFrag(vec3 light, vec3 additive, vec3 atten) -{ - light *= atten.r; - light += additive * 2.0; - return light; -} - -vec3 atmosTransport(vec3 light) -{ - return atmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation()); -} - -vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten) -{ - float brightness = dot(light.rgb * 0.5, vec3(0.3333)) + 0.1; - return mix(atmosTransportFrag(light.rgb, additive, atten), light.rgb + additive, brightness * brightness); -} - -vec3 fullbrightAtmosTransport(vec3 light) -{ - return fullbrightAtmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation()); -} - -vec3 fullbrightShinyAtmosTransport(vec3 light) -{ - float brightness = dot(light.rgb, vec3(0.33333)); - return mix(atmosTransport(light.rgb), (light.rgb + getAdditiveColor().rgb) * (2.0 - brightness), brightness * brightness); -} |