diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred')
53 files changed, 876 insertions, 876 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl index 4c9d813c9c..799b8767d5 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl @@ -1,24 +1,24 @@ -/** +/** * @file alphaV.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$ */ @@ -69,70 +69,70 @@ uniform float near_clip; void main() { - vec4 pos; - vec3 norm; - - //transform vertex + vec4 pos; + vec3 norm; + + //transform vertex #ifdef HAS_SKIN - mat4 trans = getObjectSkinnedTransform(); - trans = modelview_matrix * trans; - - pos = trans * vec4(position.xyz, 1.0); - - norm = position.xyz + normal.xyz; - norm = normalize((trans * vec4(norm, 1.0)).xyz - pos.xyz); - vec4 frag_pos = projection_matrix * pos; - gl_Position = frag_pos; + mat4 trans = getObjectSkinnedTransform(); + trans = modelview_matrix * trans; + + pos = trans * vec4(position.xyz, 1.0); + + norm = position.xyz + normal.xyz; + norm = normalize((trans * vec4(norm, 1.0)).xyz - pos.xyz); + vec4 frag_pos = projection_matrix * pos; + gl_Position = frag_pos; #else #ifdef IS_AVATAR_SKIN - mat4 trans = getSkinnedTransform(); - vec4 pos_in = vec4(position.xyz, 1.0); - pos.x = dot(trans[0], pos_in); - pos.y = dot(trans[1], pos_in); - pos.z = dot(trans[2], pos_in); - pos.w = 1.0; - - norm.x = dot(trans[0].xyz, normal); - norm.y = dot(trans[1].xyz, normal); - norm.z = dot(trans[2].xyz, normal); - norm = normalize(norm); - - vec4 frag_pos = projection_matrix * pos; - gl_Position = frag_pos; + mat4 trans = getSkinnedTransform(); + vec4 pos_in = vec4(position.xyz, 1.0); + pos.x = dot(trans[0], pos_in); + pos.y = dot(trans[1], pos_in); + pos.z = dot(trans[2], pos_in); + pos.w = 1.0; + + norm.x = dot(trans[0].xyz, normal); + norm.y = dot(trans[1].xyz, normal); + norm.z = dot(trans[2].xyz, normal); + norm = normalize(norm); + + vec4 frag_pos = projection_matrix * pos; + gl_Position = frag_pos; #else - norm = normalize(normal_matrix * normal); - vec4 vert = vec4(position.xyz, 1.0); - pos = (modelview_matrix * vert); - gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); + norm = normalize(normal_matrix * normal); + vec4 vert = vec4(position.xyz, 1.0); + pos = (modelview_matrix * vert); + gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); #endif //IS_AVATAR_SKIN - + #endif // HAS_SKIN #ifdef USE_INDEXED_TEX - passTextureIndex(); + passTextureIndex(); #endif - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; - - vary_norm = norm; - vary_position = pos.xyz; + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + + vary_norm = norm; + vary_position = pos.xyz; #ifdef USE_VERTEX_COLOR - vertex_color = diffuse_color; + vertex_color = diffuse_color; #endif - + #ifdef HAS_SKIN - vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip); + vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip); #else #ifdef IS_AVATAR_SKIN - vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); + vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); #else - pos = modelview_projection_matrix * vert; - vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); + pos = modelview_projection_matrix * vert; + vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); #endif - + #endif } diff --git a/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl index da467cd5da..49470f0e39 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/aoUtil.glsl @@ -1,24 +1,24 @@ -/** +/** * @file class1/deferred/aoUtil.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$ */ @@ -70,7 +70,7 @@ vec2 getKern(int i) kern[5] = vec2(-0.7071, -0.7071) * 0.750*0.750; kern[6] = vec2(-0.7071, 0.7071) * 0.875*0.875; kern[7] = vec2(0.7071, -0.7071) * 1.000*1.000; - + return kern[i] / screen_res; } @@ -83,33 +83,33 @@ float calcAmbientOcclusion(vec4 pos, vec3 norm, vec2 pos_screen) float angle_hidden = 0.0; float points = 0; - + float scale = min(ssao_radius / -pos_world.z, ssao_max_radius); - + // it was found that keeping # of samples a constant was the fastest, probably due to compiler optimizations (unrolling?) for (int i = 0; i < 8; i++) { vec2 samppos_screen = pos_screen + scale * reflect(getKern(i), noise_reflect); - vec3 samppos_world = getPositionAo(samppos_screen).xyz; + vec3 samppos_world = getPositionAo(samppos_screen).xyz; vec3 diff = pos_world - samppos_world; float dist2 = dot(diff, diff); - + // assume each sample corresponds to an occluding sphere with constant radius, constant x-sectional area // --> solid angle shrinking by the square of distance //radius is somewhat arbitrary, can approx with just some constant k * 1 / dist^2 //(k should vary inversely with # of samples, but this is taken care of later) - + float funky_val = (dot((samppos_world - 0.05*norm - pos_world), norm) > 0.0) ? 1.0 : 0.0; angle_hidden = angle_hidden + funky_val * min(1.0/dist2, ssao_factor_inv); - - // 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion" + + // 'blocked' samples (significantly closer to camera relative to pos_world) are "no data", not "no occlusion" float diffz_val = (diff.z > -1.0) ? 1.0 : 0.0; points = points + diffz_val; } - + angle_hidden = min(ssao_factor*angle_hidden/points, 1.0); - + float points_val = (points > 0.0) ? 1.0 : 0.0; ret = (1.0 - (points_val * angle_hidden)); diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaMaskShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaMaskShadowF.glsl index f1dc1159d0..f1e0295859 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaMaskShadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaMaskShadowF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file avatarAlphaMaskShadowF.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$ */ @@ -32,22 +32,22 @@ in float target_pos_x; in float pos_w; in vec2 vary_texcoord0; -void main() +void main() { - float alpha = texture(diffuseMap, vary_texcoord0.xy).a; + float alpha = texture(diffuseMap, vary_texcoord0.xy).a; - if (alpha < 0.05) // treat as totally transparent - { - discard; - } + if (alpha < 0.05) // treat as totally transparent + { + discard; + } - if (alpha < minimum_alpha) - { - if (fract(0.5*floor(target_pos_x / pos_w )) < 0.25) - { - discard; - } - } + if (alpha < minimum_alpha) + { + if (fract(0.5*floor(target_pos_x / pos_w )) < 0.25) + { + discard; + } + } - frag_color = vec4(1,1,1,1); + frag_color = vec4(1,1,1,1); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaShadowF.glsl index 097e28aa0c..18ce998cb6 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaShadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaShadowF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file avatarAlphaShadowF.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$ */ @@ -34,22 +34,22 @@ in float target_pos_x; in vec2 vary_texcoord0; uniform vec4 color; -void main() +void main() { - float alpha = texture(diffuseMap, vary_texcoord0.xy).a * color.a; - - if (alpha < 0.05) // treat as totally transparent - { - discard; - } - - if (alpha < minimum_alpha) // treat as semi-transparent - { - if (fract(0.5*floor(target_pos_x / pos_w )) < 0.25) - { - discard; - } - } - - frag_color = vec4(1,1,1,1); + float alpha = texture(diffuseMap, vary_texcoord0.xy).a * color.a; + + if (alpha < 0.05) // treat as totally transparent + { + discard; + } + + if (alpha < minimum_alpha) // treat as semi-transparent + { + if (fract(0.5*floor(target_pos_x / pos_w )) < 0.25) + { + discard; + } + } + + frag_color = vec4(1,1,1,1); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaShadowV.glsl index 57e0b2b59f..8d32dab911 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaShadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaShadowV.glsl @@ -1,28 +1,28 @@ -/** +/** * @file avatarAlphaShadowV.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 texture_matrix0; uniform mat4 projection_matrix; uniform float shadow_target_width; @@ -40,31 +40,31 @@ out vec2 vary_texcoord0; void main() { - vec4 pos; - vec3 norm; - - vec4 pos_in = vec4(position.xyz, 1.0); - mat4 trans = getSkinnedTransform(); - pos.x = dot(trans[0], pos_in); - pos.y = dot(trans[1], pos_in); - pos.z = dot(trans[2], pos_in); - pos.w = 1.0; - - norm.x = dot(trans[0].xyz, normal); - norm.y = dot(trans[1].xyz, normal); - norm.z = dot(trans[2].xyz, normal); - norm = normalize(norm); - - pos = projection_matrix * pos; + vec4 pos; + vec3 norm; + + vec4 pos_in = vec4(position.xyz, 1.0); + mat4 trans = getSkinnedTransform(); + pos.x = dot(trans[0], pos_in); + pos.y = dot(trans[1], pos_in); + pos.z = dot(trans[2], pos_in); + pos.w = 1.0; + + norm.x = dot(trans[0].xyz, normal); + norm.y = dot(trans[1].xyz, normal); + norm.z = dot(trans[2].xyz, normal); + norm = normalize(norm); + + pos = projection_matrix * pos; - target_pos_x = 0.5 * (shadow_target_width - 1.0) * pos.x; + target_pos_x = 0.5 * (shadow_target_width - 1.0) * pos.x; - pos_w = pos.w; + pos_w = pos.w; - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; - gl_Position = pos; + gl_Position = pos; - passTextureIndex(); + passTextureIndex(); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl index 0c386ade6c..438e1d1b33 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl @@ -1,36 +1,36 @@ -/** +/** * @file avatarShadowF.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]*/ +/*[EXTRA_CODE_HERE]*/ out vec4 frag_color; uniform sampler2D diffuseMap; -void main() +void main() { - frag_color = vec4(1,1,1,1); + frag_color = vec4(1,1,1,1); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl index 5c64d48399..95db062203 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl @@ -1,28 +1,28 @@ -/** +/** * @file avatarShadowV.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 projection_matrix; mat4 getSkinnedTransform(); @@ -33,23 +33,23 @@ in vec2 texcoord0; void main() { - vec4 pos; - vec3 norm; - - vec4 pos_in = vec4(position.xyz, 1.0); - mat4 trans = getSkinnedTransform(); - pos.x = dot(trans[0], pos_in); - pos.y = dot(trans[1], pos_in); - pos.z = dot(trans[2], pos_in); - pos.w = 1.0; - - norm.x = dot(trans[0].xyz, normal); - norm.y = dot(trans[1].xyz, normal); - norm.z = dot(trans[2].xyz, normal); - norm = normalize(norm); - - pos = projection_matrix * pos; - gl_Position = pos; + vec4 pos; + vec3 norm; + + vec4 pos_in = vec4(position.xyz, 1.0); + mat4 trans = getSkinnedTransform(); + pos.x = dot(trans[0], pos_in); + pos.y = dot(trans[1], pos_in); + pos.z = dot(trans[2], pos_in); + pos.w = 1.0; + + norm.x = dot(trans[0].xyz, normal); + norm.y = dot(trans[1].xyz, normal); + norm.z = dot(trans[2].xyz, normal); + norm = normalize(norm); + + pos = projection_matrix * pos; + gl_Position = pos; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl index 5abaa1f2a6..969fbc5a7d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl @@ -1,24 +1,24 @@ -/** +/** * @file blurLightF.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$ */ @@ -30,8 +30,8 @@ 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); + //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/cloudsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl index f6870c3ff0..450d4c4c4a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl @@ -1,28 +1,28 @@ -/** +/** * @file class1\deferred\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]*/ +/*[EXTRA_CODE_HERE]*/ out vec4 frag_data[4]; @@ -93,7 +93,7 @@ void main() // And smooth alpha1 = 1. - alpha1 * alpha1; - alpha1 = 1. - alpha1 * alpha1; + alpha1 = 1. - alpha1 * alpha1; alpha1 *= altitude_blend_factor; alpha1 = clamp(alpha1, 0.0, 1.0); @@ -105,7 +105,7 @@ void main() // And smooth alpha2 = 1. - alpha2; - alpha2 = 1. - alpha2 * alpha2; + alpha2 = 1. - alpha2 * alpha2; // Combine vec3 color; diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl index 98314d39d3..c019b5606a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl @@ -1,24 +1,24 @@ -/** +/** * @file WLCloudsV.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$ */ @@ -75,53 +75,53 @@ uniform float cloud_scale; // indra\newview\llsettingsvo.cpp void main() { - // World / view / projection - gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + // World / view / projection + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - // Texture coords + // 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_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_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.; + vary_texcoord2 = vary_texcoord0 * 16.; + vary_texcoord3 = vary_texcoord1 * 16.; - // Get relative position + // Get relative position vec3 rel_pos = position.xyz - camPosLocal.xyz + vec3(0, 50, 0); altitude_blend_factor = clamp((rel_pos.y + 512.0) / max_y, 0.0, 1.0); - // Set altitude + // Set altitude if (rel_pos.y > 0) - { + { rel_pos *= (max_y / rel_pos.y); - } + } if (rel_pos.y < 0) - { - altitude_blend_factor = 0; // SL-11589 Fix clouds drooping below horizon + { + altitude_blend_factor = 0; // SL-11589 Fix clouds drooping below horizon rel_pos *= (-32000. / rel_pos.y); - } + } - // Can normalize then + // Can normalize then vec3 rel_pos_norm = normalize(rel_pos); float rel_pos_len = length(rel_pos); - // Initialize temp variables - vec3 sunlight = sunlight_color; - vec3 light_atten; + // Initialize temp variables + vec3 sunlight = sunlight_color; + vec3 light_atten; - // Sunlight attenuation effect (hue and brightness) due to atmosphere - // this is used later for sunlight modulation at various altitudes + // Sunlight attenuation effect (hue and brightness) due to atmosphere + // this is used later for sunlight modulation at various altitudes light_atten = (blue_density + vec3(haze_density * 0.25)) * (density_multiplier * max_y); - // Calculate relative weights + // Calculate relative weights vec3 combined_haze = abs(blue_density) + vec3(abs(haze_density)); vec3 blue_weight = blue_density / combined_haze; vec3 haze_weight = haze_density / combined_haze; @@ -130,64 +130,64 @@ void main() float off_axis = 1.0 / max(1e-6, max(0., rel_pos_norm.y) + lightnorm.y); sunlight *= exp(-light_atten * off_axis); - // Distance + // 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. + // compiler gets confused. combined_haze = exp(-combined_haze * density_dist); - // Compute haze glow + // 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) + // 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") + // 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 + // 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" + // 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 - vec3 tmpAmbient = ambient_color; - tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5; + // Increase ambient when there are more clouds + vec3 tmpAmbient = ambient_color; + tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5; - // Dim sunlight by cloud shadow percentage - sunlight *= (1. - cloud_shadow); + // Dim sunlight by cloud shadow percentage + sunlight *= (1. - cloud_shadow); - // Haze color below cloud + // Haze color below cloud vec3 additiveColorBelowCloud = (blue_horizon * blue_weight * (sunlight + tmpAmbient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + tmpAmbient)); - // CLOUDS + // CLOUDS sunlight = sunlight_color; off_axis = 1.0 / max(1e-6, lightnorm.y * 2.); sunlight *= exp(-light_atten * off_axis); - // Cloud color out + // Cloud color out vary_CloudColorSun = (sunlight * haze_glow) * cloud_color; - vary_CloudColorAmbient = tmpAmbient * cloud_color; - - // Attenuate cloud color by atmosphere + 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; vec3 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); + // 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; + // Combine these to minimize register use + vary_CloudColorAmbient += oHazeColorBelowCloud; - // needs this to compile on mac - //vary_AtmosAttenuation = vec3(0.0,0.0,0.0); + // needs this to compile on mac + //vary_AtmosAttenuation = vec3(0.0,0.0,0.0); - // END CLOUDS + // END CLOUDS } diff --git a/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl index d95a33a6be..0a0fa0a374 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file cofF.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$ */ @@ -45,35 +45,35 @@ in vec2 vary_fragcoord; float calc_cof(float depth) { - float sc = (depth-focal_distance)/-depth*blur_constant; - - sc /= magnification; - - // tan_pixel_angle = pixel_length/-depth; - float pixel_length = tan_pixel_angle*-focal_distance; - - sc = sc/pixel_length; - sc *= 1.414; - - return sc; + float sc = (depth-focal_distance)/-depth*blur_constant; + + sc /= magnification; + + // tan_pixel_angle = pixel_length/-depth; + float pixel_length = tan_pixel_angle*-focal_distance; + + sc = sc/pixel_length; + sc *= 1.414; + + return sc; } -void main() +void main() { - vec2 tc = vary_fragcoord.xy; + vec2 tc = vary_fragcoord.xy; float z = texture(depthMap, tc).r; - z = z*2.0-1.0; - vec4 ndc = vec4(0.0, 0.0, z, 1.0); - vec4 p = inv_proj*ndc; - float depth = p.z/p.w; - - vec4 diff = texture(diffuseRect, vary_fragcoord.xy); - - float sc = calc_cof(depth); - sc = min(sc, max_cof); - sc = max(sc, -max_cof); - - frag_color.rgb = diff.rgb; - frag_color.a = sc/max_cof*0.5+0.5; + z = z*2.0-1.0; + vec4 ndc = vec4(0.0, 0.0, z, 1.0); + vec4 p = inv_proj*ndc; + float depth = p.z/p.w; + + vec4 diff = texture(diffuseRect, vary_fragcoord.xy); + + float sc = calc_cof(depth); + sc = min(sc, max_cof); + sc = max(sc, -max_cof); + + frag_color.rgb = diff.rgb; + frag_color.a = sc/max_cof*0.5+0.5; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl index 13cc612fab..9ee34a2d77 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl @@ -1,31 +1,31 @@ -/** +/** * @file diffuseNoColorV.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 mat3 normal_matrix; uniform mat4 texture_matrix0; -uniform mat4 modelview_projection_matrix; +uniform mat4 modelview_projection_matrix; in vec3 position; in vec3 normal; @@ -37,9 +37,9 @@ out vec2 vary_texcoord0; void main() { - //transform vertex - gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; - - vary_normal = normalize(normal_matrix * normal); + //transform vertex + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + + vary_normal = normalize(normal_matrix * normal); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl b/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl index 3b9b8ae696..65476c24ff 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file dofCombineF.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$ */ @@ -42,34 +42,34 @@ in vec2 vary_fragcoord; vec4 dofSample(sampler2D tex, vec2 tc) { - tc.x = min(tc.x, dof_width); - tc.y = min(tc.y, dof_height); + tc.x = min(tc.x, dof_width); + tc.y = min(tc.y, dof_height); - return texture(tex, tc); + return texture(tex, tc); } -void main() +void main() { - vec2 tc = vary_fragcoord.xy; - - vec4 dof = dofSample(diffuseRect, vary_fragcoord.xy*res_scale); - - vec4 diff = texture(lightMap, vary_fragcoord.xy); - - float a = min(abs(diff.a*2.0-1.0) * max_cof*res_scale*res_scale, 1.0); - - if (a > 0.25 && a < 0.75) - { //help out the transition a bit - float sc = a/res_scale; - - vec4 col; - col = texture(lightMap, vary_fragcoord.xy+vec2(sc,sc)/screen_res); - col += texture(lightMap, vary_fragcoord.xy+vec2(-sc,sc)/screen_res); - col += texture(lightMap, vary_fragcoord.xy+vec2(sc,-sc)/screen_res); - col += texture(lightMap, vary_fragcoord.xy+vec2(-sc,-sc)/screen_res); - - diff = mix(diff, col*0.25, a); - } - - frag_color = mix(diff, dof, a); + vec2 tc = vary_fragcoord.xy; + + vec4 dof = dofSample(diffuseRect, vary_fragcoord.xy*res_scale); + + vec4 diff = texture(lightMap, vary_fragcoord.xy); + + float a = min(abs(diff.a*2.0-1.0) * max_cof*res_scale*res_scale, 1.0); + + if (a > 0.25 && a < 0.75) + { //help out the transition a bit + float sc = a/res_scale; + + vec4 col; + col = texture(lightMap, vary_fragcoord.xy+vec2(sc,sc)/screen_res); + col += texture(lightMap, vary_fragcoord.xy+vec2(-sc,sc)/screen_res); + col += texture(lightMap, vary_fragcoord.xy+vec2(sc,-sc)/screen_res); + col += texture(lightMap, vary_fragcoord.xy+vec2(-sc,-sc)/screen_res); + + diff = mix(diff, col*0.25, a); + } + + frag_color = mix(diff, dof, a); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl index c95f791dbf..0c86ec4563 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl @@ -1,28 +1,28 @@ -/** +/** * @file emissiveF.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]*/ out vec4 frag_color; @@ -30,10 +30,10 @@ out vec4 frag_color; in vec4 vertex_color; in vec2 vary_texcoord0; -void main() +void main() { // NOTE: when this shader is used, only alpha is being written to - float a = diffuseLookup(vary_texcoord0.xy).a*vertex_color.a; - frag_color = max(vec4(0, 0, 0, a), vec4(0)); + float a = diffuseLookup(vary_texcoord0.xy).a*vertex_color.a; + frag_color = max(vec4(0, 0, 0, a), vec4(0)); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl index 5a0913a970..fc8f873e8e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl @@ -1,24 +1,24 @@ -/** +/** * @file emissiveV.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$ */ @@ -47,8 +47,8 @@ uniform mat4 projection_matrix; void main() { - //transform vertex - passTextureIndex(); + //transform vertex + passTextureIndex(); #ifdef HAS_SKIN mat4 mat = getObjectSkinnedTransform(); @@ -57,15 +57,15 @@ void main() vec4 pos = mat * vec4(position.xyz, 1.0); gl_Position = projection_matrix * pos; #else - gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0)); #endif - - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; - - calcAtmospherics(pos.xyz); - - vertex_color = emissive; - + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + + calcAtmospherics(pos.xyz); + + vertex_color = emissive; + + } diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyV.glsl index 5795384b47..3b55c4645c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyV.glsl @@ -4,21 +4,21 @@ * $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$ */ @@ -54,28 +54,28 @@ uniform mat4 projection_matrix; void main() { - //transform vertex - vec4 vert = vec4(position.xyz,1.0); - passTextureIndex(); + //transform vertex + vec4 vert = vec4(position.xyz,1.0); + passTextureIndex(); #ifdef HAS_SKIN mat4 mat = getObjectSkinnedTransform(); mat = modelview_matrix * mat; vec4 pos = mat * vert; gl_Position = projection_matrix * pos; - vec3 norm = normalize((mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz); + vec3 norm = normalize((mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz); #else - vec4 pos = (modelview_matrix * vert); - gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); - vec3 norm = normalize(normal_matrix * normal); + vec4 pos = (modelview_matrix * vert); + gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); + vec3 norm = normalize(normal_matrix * normal); #endif vary_position = pos.xyz; - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; vary_texcoord1 = norm; - calcAtmospherics(pos.xyz); + calcAtmospherics(pos.xyz); - vertex_color = diffuse_color; + vertex_color = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl index 77e63e6360..9304ed6dfa 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl @@ -1,24 +1,24 @@ -/** +/** * @file fullbrightV.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$ */ @@ -50,9 +50,9 @@ uniform mat4 projection_matrix; void main() { - //transform vertex - vec4 vert = vec4(position.xyz, 1.0); - passTextureIndex(); + //transform vertex + vec4 vert = vec4(position.xyz, 1.0); + passTextureIndex(); #ifdef HAS_SKIN mat4 mat = getObjectSkinnedTransform(); @@ -60,15 +60,15 @@ void main() vec4 pos = mat * vert; gl_Position = projection_matrix * pos; #else - vec4 pos = (modelview_matrix * vert); - gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); + vec4 pos = (modelview_matrix * vert); + gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); #endif - vary_position = pos.xyz; + vary_position = pos.xyz; + + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; - - calcAtmospherics(pos.xyz); + calcAtmospherics(pos.xyz); - vertex_color = diffuse_color; + vertex_color = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl index cd56ed0adf..94dac7e5a9 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fxaaF.glsl @@ -1,28 +1,28 @@ -/** +/** * @file fxaaF.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 @@ -70,11 +70,11 @@ Example, Or, #define FXAA_360 1 - + Or, #define FXAA_PS3 1 - + Etc. (2.) @@ -85,7 +85,7 @@ Then include this file, (3.) Then call the FXAA pixel shader from within your desired shader. Look at the FXAA Quality FxaaPixelShader() for docs on inputs. -As for FXAA 3.11 all inputs for all shaders are the same +As for FXAA 3.11 all inputs for all shaders are the same to enable easy porting between platforms. return FxaaPixelShader(...); @@ -116,7 +116,7 @@ Look at the FXAA Quality FxaaPixelShader() for docs on inputs. (6.) Have FXAA vertex shader run as a full screen triangle, -and output "pos" and "fxaaConsolePosPos" +and output "pos" and "fxaaConsolePosPos" such that inputs in the pixel shader provide, // {xy} = center of pixel @@ -133,7 +133,7 @@ Insure the texture sampler(s) used by FXAA are set to bilinear filtering. ------------------------------------------------------------------------------ INTEGRATION - RGBL AND COLORSPACE ------------------------------------------------------------------------------ -FXAA3 requires RGBL as input unless the following is set, +FXAA3 requires RGBL as input unless the following is set, #define FXAA_GREEN_AS_LUMA 1 @@ -186,7 +186,7 @@ Getting luma correct is required for the algorithm to work correctly. ------------------------------------------------------------------------------ Applying FXAA to a framebuffer with linear RGB color will look worse. This is very counter intuitive, but happends to be true in this case. -The reason is because dithering artifacts will be more visiable +The reason is because dithering artifacts will be more visiable in a linear colorspace. @@ -281,7 +281,7 @@ A. Or use FXAA_GREEN_AS_LUMA. // Might want to lower the settings for both, // fxaaConsoleEdgeThresholdMin // fxaaQualityEdgeThresholdMin - // In order to insure AA does not get turned off on colors + // In order to insure AA does not get turned off on colors // which contain a minor amount of green. // // 1 = On. @@ -342,23 +342,23 @@ A. Or use FXAA_GREEN_AS_LUMA. // 1 = API supports gather4 on alpha channel. // 0 = API does not support gather4 on alpha channel. // - #if (FXAA_GLSL_130 == 0) - #define FXAA_GATHER4_ALPHA 0 - #endif + #if (FXAA_GLSL_130 == 0) + #define FXAA_GATHER4_ALPHA 0 + #endif #if (FXAA_HLSL_5 == 1) #define FXAA_GATHER4_ALPHA 1 #endif #ifndef FXAA_GATHER4_ALPHA - #ifdef GL_ARB_gpu_shader5 - #define FXAA_GATHER4_ALPHA 1 - #endif - #ifdef GL_NV_gpu_shader5 - #define FXAA_GATHER4_ALPHA 1 - #endif - #ifndef FXAA_GATHER4_ALPHA - #define FXAA_GATHER4_ALPHA 0 - #endif - #endif + #ifdef GL_ARB_gpu_shader5 + #define FXAA_GATHER4_ALPHA 1 + #endif + #ifdef GL_NV_gpu_shader5 + #define FXAA_GATHER4_ALPHA 1 + #endif + #ifndef FXAA_GATHER4_ALPHA + #define FXAA_GATHER4_ALPHA 0 + #endif + #endif #endif /*============================================================================ @@ -421,14 +421,14 @@ NOTE the other tuning knobs are now in the shader function inputs! // // Choose the quality preset. // This needs to be compiled into the shader as it effects code. - // Best option to include multiple presets is to + // Best option to include multiple presets is to // in each shader define the preset, then include this file. - // + // // OPTIONS // ----------------------------------------------------------------------- // 10 to 15 - default medium dither (10=fastest, 15=highest quality) // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality) - // 39 - no dither, very expensive + // 39 - no dither, very expensive // // NOTES // ----------------------------------------------------------------------- @@ -437,7 +437,7 @@ NOTE the other tuning knobs are now in the shader function inputs! // 23 = closest to FXAA 3.9 visually and performance wise // _ = the lowest digit is directly related to performance // _ = the highest digit is directly related to style - // + // #define FXAA_QUALITY__PRESET 12 #endif @@ -747,7 +747,7 @@ NOTE the other tuning knobs are now in the shader function inputs! FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; } #else FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; } -#endif +#endif @@ -801,28 +801,28 @@ FxaaFloat4 FxaaPixelShader( // Where N ranges between, // N = 0.50 (default) // N = 0.33 (sharper) - // {x___} = -N/screenWidthInPixels + // {x___} = -N/screenWidthInPixels // {_y__} = -N/screenHeightInPixels - // {__z_} = N/screenWidthInPixels - // {___w} = N/screenHeightInPixels + // {__z_} = N/screenWidthInPixels + // {___w} = N/screenHeightInPixels FxaaFloat4 fxaaConsoleRcpFrameOpt, // // Only used on FXAA Console. // Not used on 360, but used on PS3 and PC. // This must be from a constant/uniform. - // {x___} = -2.0/screenWidthInPixels + // {x___} = -2.0/screenWidthInPixels // {_y__} = -2.0/screenHeightInPixels - // {__z_} = 2.0/screenWidthInPixels - // {___w} = 2.0/screenHeightInPixels + // {__z_} = 2.0/screenWidthInPixels + // {___w} = 2.0/screenHeightInPixels FxaaFloat4 fxaaConsoleRcpFrameOpt2, // // Only used on FXAA Console. // Only used on 360 in place of fxaaConsoleRcpFrameOpt2. // This must be from a constant/uniform. - // {x___} = 8.0/screenWidthInPixels + // {x___} = 8.0/screenWidthInPixels // {_y__} = 8.0/screenHeightInPixels - // {__z_} = -4.0/screenWidthInPixels - // {___w} = -4.0/screenHeightInPixels + // {__z_} = -4.0/screenWidthInPixels + // {___w} = -4.0/screenHeightInPixels FxaaFloat4 fxaaConsole360RcpFrameOpt2, // // Only used on FXAA Quality. @@ -844,7 +844,7 @@ FxaaFloat4 FxaaPixelShader( // 0.333 - too little (faster) // 0.250 - low quality // 0.166 - default - // 0.125 - high quality + // 0.125 - high quality // 0.063 - overkill (slower) FxaaFloat fxaaQualityEdgeThreshold, // @@ -862,7 +862,7 @@ FxaaFloat4 FxaaPixelShader( // Tune by looking at mostly non-green content, // then start at zero and increase until aliasing is a problem. FxaaFloat fxaaQualityEdgeThresholdMin, - // + // // Only used on FXAA Console. // This used to be the FXAA_CONSOLE__EDGE_SHARPNESS define. // It is here now to allow easier tuning. @@ -897,7 +897,7 @@ FxaaFloat4 FxaaPixelShader( // Trims the algorithm from processing darks. // The console setting has a different mapping than the quality setting. // This only applies when FXAA_EARLY_EXIT is 1. - // This does not apply to PS3, + // This does not apply to PS3, // PS3 was simplified to avoid more shader instructions. // 0.06 - faster but more aliasing in darks // 0.05 - default @@ -909,7 +909,7 @@ FxaaFloat4 FxaaPixelShader( // Tune by looking at mostly non-green content, // then start at zero and increase until aliasing is a problem. FxaaFloat fxaaConsoleEdgeThresholdMin, - // + // // Extra constants for 360 FXAA Console only. // Use zeros or anything else for other platforms. // These must be in physical constant registers and NOT immedates. @@ -1286,11 +1286,11 @@ FxaaFloat4 FxaaPixelShader( /*============================================================================ FXAA3 CONSOLE - PC VERSION - + ------------------------------------------------------------------------------ Instead of using this on PC, I'd suggest just using FXAA Quality with #define FXAA_QUALITY__PRESET 10 -Or +Or #define FXAA_QUALITY__PRESET 20 Either are higher qualilty and almost as fast as this on modern PC GPUs. ============================================================================*/ @@ -1379,7 +1379,7 @@ FxaaFloat4 FxaaPixelShader( /*============================================================================ - FXAA3 CONSOLE - 360 PIXEL SHADER + FXAA3 CONSOLE - 360 PIXEL SHADER ------------------------------------------------------------------------------ This optimized version thanks to suggestions from Andy Luedke. @@ -1414,14 +1414,14 @@ float4 FxaaPixelShader( /*--------------------------------------------------------------------------*/ float4 lumaNwNeSwSe; #if (FXAA_GREEN_AS_LUMA == 0) - asm { + asm { tfetch2D lumaNwNeSwSe.w___, tex, pos.xy, OffsetX = -0.5, OffsetY = -0.5, UseComputedLOD=false tfetch2D lumaNwNeSwSe._w__, tex, pos.xy, OffsetX = 0.5, OffsetY = -0.5, UseComputedLOD=false tfetch2D lumaNwNeSwSe.__w_, tex, pos.xy, OffsetX = -0.5, OffsetY = 0.5, UseComputedLOD=false tfetch2D lumaNwNeSwSe.___w, tex, pos.xy, OffsetX = 0.5, OffsetY = 0.5, UseComputedLOD=false }; #else - asm { + asm { tfetch2D lumaNwNeSwSe.y___, tex, pos.xy, OffsetX = -0.5, OffsetY = -0.5, UseComputedLOD=false tfetch2D lumaNwNeSwSe._y__, tex, pos.xy, OffsetX = 0.5, OffsetY = -0.5, UseComputedLOD=false tfetch2D lumaNwNeSwSe.__y_, tex, pos.xy, OffsetX = -0.5, OffsetY = 0.5, UseComputedLOD=false @@ -1442,7 +1442,7 @@ float4 FxaaPixelShader( #else float lumaMinM = min(lumaMin, rgbyM.y); float lumaMaxM = max(lumaMax, rgbyM.y); - #endif + #endif if((lumaMaxM - lumaMinM) < max(fxaaConsoleEdgeThresholdMin, lumaMax * fxaaConsoleEdgeThreshold)) return rgbyM; /*--------------------------------------------------------------------------*/ float2 dir; @@ -1591,7 +1591,7 @@ Pass | Unit | uOp | PC: Op | | | 13 | SCT0 | mad | 48: ADDxc0_s rc, h2, h2.w---; | SCB0/1 | mul | 49: MOVh h0(NE0.xxxx), h1; - + Pass SCT TEX SCB 1: 0% 100% 25% 2: 0% 100% 25% @@ -1677,7 +1677,7 @@ half4 FxaaPixelShader( #else dir.x += lumaSw.y; dir.z += lumaSw.y; - #endif + #endif /*--------------------------------------------------------------------------*/ // (3) half4 lumaNw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xy, 0, 0)); @@ -1740,7 +1740,7 @@ half4 FxaaPixelShader( #else half lumaMin = min(min(lumaNw.y, lumaSw.y), min(lumaNe.y, lumaSe.y)); half lumaMax = max(max(lumaNw.y, lumaSw.y), max(lumaNe.y, lumaSe.y)); - #endif + #endif rgby2 = (rgby2 + rgby1) * 0.5; /*--------------------------------------------------------------------------*/ // (12) @@ -1896,7 +1896,7 @@ Pass | Unit | uOp | PC: Op | | | 15 | SCT0/1 | mul | 55: MOVh h0(NE0.wwww), h2; | SCB0/1 | mul | 56: MOVh h0(NE0.xxxx), h1; - + Pass SCT TEX SCB 1: 0% 100% 25% 2: 0% 100% 25% @@ -2096,28 +2096,28 @@ uniform vec4 rcp_frame_opt2; in vec2 vary_fragcoord; in vec2 vary_tc; -void main() +void main() { - vec4 diff = FxaaPixelShader(vary_tc, //pos - vec4(vary_fragcoord.xy, 0, 0), //fxaaConsolePosPos - diffuseMap, //tex - diffuseMap, - diffuseMap, - rcp_screen_res, //fxaaQualityRcpFrame - vec4(0,0,0,0), //fxaaConsoleRcpFrameOpt - rcp_frame_opt, //fxaaConsoleRcpFrameOpt2 - rcp_frame_opt2, //fxaaConsole360RcpFrameOpt2 - 0.75, //fxaaQualitySubpix - 0.07, //fxaaQualityEdgeThreshold - 0.03, //fxaaQualityEdgeThresholdMin - 8.0, //fxaaConsoleEdgeSharpness - 0.125, //fxaaConsoleEdgeThreshold - 0.05, //fxaaConsoleEdgeThresholdMin - vec4(0,0,0,0)); //fxaaConsole360ConstDir + vec4 diff = FxaaPixelShader(vary_tc, //pos + vec4(vary_fragcoord.xy, 0, 0), //fxaaConsolePosPos + diffuseMap, //tex + diffuseMap, + diffuseMap, + rcp_screen_res, //fxaaQualityRcpFrame + vec4(0,0,0,0), //fxaaConsoleRcpFrameOpt + rcp_frame_opt, //fxaaConsoleRcpFrameOpt2 + rcp_frame_opt2, //fxaaConsole360RcpFrameOpt2 + 0.75, //fxaaQualitySubpix + 0.07, //fxaaQualityEdgeThreshold + 0.03, //fxaaQualityEdgeThresholdMin + 8.0, //fxaaConsoleEdgeSharpness + 0.125, //fxaaConsoleEdgeThreshold + 0.05, //fxaaConsoleEdgeThresholdMin + vec4(0,0,0,0)); //fxaaConsole360ConstDir frag_color = diff; - + gl_FragDepth = texture(depthMap, vary_fragcoord.xy).r; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/genbrdflutF.glsl b/indra/newview/app_settings/shaders/class1/deferred/genbrdflutF.glsl index e40d070268..f57b10b720 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/genbrdflutF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/genbrdflutF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file class1/deferred/genbrdflut.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$ */ @@ -60,82 +60,82 @@ const float PI = 3.1415926536; // Based omn http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/ float random(vec2 co) { - float a = 12.9898; - float b = 78.233; - float c = 43758.5453; - float dt= dot(co.xy ,vec2(a,b)); - float sn= mod(dt,3.14); - return fract(sin(sn) * c); + float a = 12.9898; + float b = 78.233; + float c = 43758.5453; + float dt= dot(co.xy ,vec2(a,b)); + float sn= mod(dt,3.14); + return fract(sin(sn) * c); } -vec2 hammersley2d(uint i, uint N) +vec2 hammersley2d(uint i, uint N) { - // Radical inverse based on http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html - uint bits = (i << 16u) | (i >> 16u); - bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); - bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); - bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); - bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); - float rdi = float(bits) * 2.3283064365386963e-10; - return vec2(float(i) /float(N), rdi); + // Radical inverse based on http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html + uint bits = (i << 16u) | (i >> 16u); + bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u); + bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u); + bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u); + bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u); + float rdi = float(bits) * 2.3283064365386963e-10; + return vec2(float(i) /float(N), rdi); } // Based on http://blog.selfshadow.com/publications/s2013-shading-course/karis/s2013_pbs_epic_slides.pdf -vec3 importanceSample_GGX(vec2 Xi, float roughness, vec3 normal) +vec3 importanceSample_GGX(vec2 Xi, float roughness, vec3 normal) { - // Maps a 2D point to a hemisphere with spread based on roughness - float alpha = roughness * roughness; - float phi = 2.0 * PI * Xi.x + random(normal.xz) * 0.1; - float cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (alpha*alpha - 1.0) * Xi.y)); - float sinTheta = sqrt(1.0 - cosTheta * cosTheta); - vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta); - - // Tangent space - vec3 up = abs(normal.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); - vec3 tangentX = normalize(cross(up, normal)); - vec3 tangentY = normalize(cross(normal, tangentX)); - - // Convert to world Space - return normalize(tangentX * H.x + tangentY * H.y + normal * H.z); + // Maps a 2D point to a hemisphere with spread based on roughness + float alpha = roughness * roughness; + float phi = 2.0 * PI * Xi.x + random(normal.xz) * 0.1; + float cosTheta = sqrt((1.0 - Xi.y) / (1.0 + (alpha*alpha - 1.0) * Xi.y)); + float sinTheta = sqrt(1.0 - cosTheta * cosTheta); + vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta); + + // Tangent space + vec3 up = abs(normal.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0); + vec3 tangentX = normalize(cross(up, normal)); + vec3 tangentY = normalize(cross(normal, tangentX)); + + // Convert to world Space + return normalize(tangentX * H.x + tangentY * H.y + normal * H.z); } // Geometric Shadowing function float G_SchlicksmithGGX(float dotNL, float dotNV, float roughness) { - float k = (roughness * roughness) / 2.0; - float GL = dotNL / (dotNL * (1.0 - k) + k); - float GV = dotNV / (dotNV * (1.0 - k) + k); - return GL * GV; + float k = (roughness * roughness) / 2.0; + float GL = dotNL / (dotNL * (1.0 - k) + k); + float GV = dotNV / (dotNV * (1.0 - k) + k); + return GL * GV; } vec2 BRDF(float NoV, float roughness) { - // Normal always points along z-axis for the 2D lookup - const vec3 N = vec3(0.0, 0.0, 1.0); - vec3 V = vec3(sqrt(1.0 - NoV*NoV), 0.0, NoV); - - vec2 LUT = vec2(0.0); - for(uint i = 0u; i < NUM_SAMPLES; i++) { - vec2 Xi = hammersley2d(i, NUM_SAMPLES); - vec3 H = importanceSample_GGX(Xi, roughness, N); - vec3 L = 2.0 * dot(V, H) * H - V; - - float dotNL = max(dot(N, L), 0.0); - float dotNV = max(dot(N, V), 0.0); - float dotVH = max(dot(V, H), 0.0); - float dotNH = max(dot(H, N), 0.0); - - if (dotNL > 0.0) { - float G = G_SchlicksmithGGX(dotNL, dotNV, roughness); - float G_Vis = (G * dotVH) / (dotNH * dotNV); - float Fc = pow(1.0 - dotVH, 5.0); - LUT += vec2((1.0 - Fc) * G_Vis, Fc * G_Vis); - } - } - return LUT / float(NUM_SAMPLES); + // Normal always points along z-axis for the 2D lookup + const vec3 N = vec3(0.0, 0.0, 1.0); + vec3 V = vec3(sqrt(1.0 - NoV*NoV), 0.0, NoV); + + vec2 LUT = vec2(0.0); + for(uint i = 0u; i < NUM_SAMPLES; i++) { + vec2 Xi = hammersley2d(i, NUM_SAMPLES); + vec3 H = importanceSample_GGX(Xi, roughness, N); + vec3 L = 2.0 * dot(V, H) * H - V; + + float dotNL = max(dot(N, L), 0.0); + float dotNV = max(dot(N, V), 0.0); + float dotVH = max(dot(V, H), 0.0); + float dotNH = max(dot(H, N), 0.0); + + if (dotNL > 0.0) { + float G = G_SchlicksmithGGX(dotNL, dotNV, roughness); + float G_Vis = (G * dotVH) / (dotNH * dotNV); + float Fc = pow(1.0 - dotVH, 5.0); + LUT += vec2((1.0 - Fc) * G_Vis, Fc * G_Vis); + } + } + return LUT / float(NUM_SAMPLES); } -void main() +void main() { - outColor = vec4(BRDF(vary_uv.s, 1.0-vary_uv.t), 0.0, 1.0); + outColor = vec4(BRDF(vary_uv.s, 1.0-vary_uv.t), 0.0, 1.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/genbrdflutV.glsl b/indra/newview/app_settings/shaders/class1/deferred/genbrdflutV.glsl index 3a1572996f..a609776176 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/genbrdflutV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/genbrdflutV.glsl @@ -1,24 +1,24 @@ -/** +/** * @file class3\deferred\genbrdflutV.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$ */ @@ -31,9 +31,9 @@ out vec2 vary_uv; void main() { - //transform vertex - vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0); - vary_uv = position.xy*0.5+0.5; + //transform vertex + vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0); + vary_uv = position.xy*0.5+0.5; - gl_Position = vec4(position.xyz, 1.0); + gl_Position = vec4(position.xyz, 1.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/highlightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/highlightF.glsl index 748fcbed80..5c09950712 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/highlightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/highlightF.glsl @@ -1,28 +1,28 @@ -/** +/** * @file highlightF.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$ */ - + out vec4 frag_data[4]; uniform vec4 color; @@ -30,10 +30,10 @@ uniform sampler2D diffuseMap; in vec2 vary_texcoord0; -void main() +void main() { - frag_data[0] = color*texture(diffuseMap, vary_texcoord0.xy); - frag_data[1] = vec4(0.0); - frag_data[2] = vec4(0.0, 1.0, 0.0, GBUFFER_FLAG_SKIP_ATMOS); + frag_data[0] = color*texture(diffuseMap, vary_texcoord0.xy); + frag_data[1] = vec4(0.0); + frag_data[2] = vec4(0.0, 1.0, 0.0, GBUFFER_FLAG_SKIP_ATMOS); frag_data[3] = vec4(0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl index 444c54a31e..6af0757143 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl @@ -1,24 +1,24 @@ -/** +/** * @file impostorV.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$ */ @@ -33,7 +33,7 @@ out vec2 vary_texcoord0; void main() { - //transform vertex - gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + //transform vertex + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 4dee23372f..c23729ef30 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -39,7 +39,7 @@ void main() { #if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND) frag_color = vec4(0.5, 0, 1, 0.5); -#else // mode is not DIFFUSE_ALPHA_MODE_BLEND, encode to gbuffer +#else // mode is not DIFFUSE_ALPHA_MODE_BLEND, encode to gbuffer // deferred path // See: C++: addDeferredAttachment(), shader: softenLightF.glsl frag_data[0] = vec4(0.5, 0, 1, 0); // gbuffer is sRGB for legacy materials frag_data[1] = vec4(0); // XYZ = Specular color. W = Specular exponent. diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonV.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonV.glsl index c2a1dccb33..8d9df7e926 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/moonV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/moonV.glsl @@ -1,24 +1,24 @@ -/** +/** * @file class1\deferred\moonV.glsl * * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2007, 2020 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$ */ diff --git a/indra/newview/app_settings/shaders/class1/deferred/normgenF.glsl b/indra/newview/app_settings/shaders/class1/deferred/normgenF.glsl index 05dced0026..902746366d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/normgenF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/normgenF.glsl @@ -1,28 +1,28 @@ -/** +/** * @file normgenF.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]*/ out vec4 frag_color; @@ -37,18 +37,18 @@ uniform float norm_scale; void main() { - float c = texture(alphaMap, vary_texcoord0).r; - - vec3 right = vec3(norm_scale, 0, (texture(alphaMap, vary_texcoord0+vec2(stepX, 0)).r-c)*255); - vec3 left = vec3(-norm_scale, 0, (texture(alphaMap, vary_texcoord0-vec2(stepX, 0)).r-c)*255); - vec3 up = vec3(0, -norm_scale, (texture(alphaMap, vary_texcoord0-vec2(0, stepY)).r-c)*255); - vec3 down = vec3(0, norm_scale, (texture(alphaMap, vary_texcoord0+vec2(0, stepY)).r-c)*255); - - vec3 norm = cross(right, down) + cross(down, left) + cross(left,up) + cross(up, right); - - norm = normalize(norm); - norm *= 0.5; - norm += 0.5; - - frag_color = vec4(norm, c); + float c = texture(alphaMap, vary_texcoord0).r; + + vec3 right = vec3(norm_scale, 0, (texture(alphaMap, vary_texcoord0+vec2(stepX, 0)).r-c)*255); + vec3 left = vec3(-norm_scale, 0, (texture(alphaMap, vary_texcoord0-vec2(stepX, 0)).r-c)*255); + vec3 up = vec3(0, -norm_scale, (texture(alphaMap, vary_texcoord0-vec2(0, stepY)).r-c)*255); + vec3 down = vec3(0, norm_scale, (texture(alphaMap, vary_texcoord0+vec2(0, stepY)).r-c)*255); + + vec3 norm = cross(right, down) + cross(down, left) + cross(left,up) + cross(up, right); + + norm = normalize(norm); + norm *= 0.5; + norm += 0.5; + + frag_color = vec4(norm, c); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/normgenV.glsl b/indra/newview/app_settings/shaders/class1/deferred/normgenV.glsl index 7896659ad3..135ebf9418 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/normgenV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/normgenV.glsl @@ -1,28 +1,28 @@ -/** +/** * @file normgenV.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$ */ - + in vec3 position; in vec2 texcoord0; @@ -31,6 +31,6 @@ out vec2 vary_texcoord0; void main() { - gl_Position = vec4(position.x*2.0-1.0, position.y*2.0-1.0, -1.0, 1.0); - vary_texcoord0 = texcoord0; + gl_Position = vec4(position.x*2.0-1.0, position.y*2.0-1.0, -1.0, 1.0); + vary_texcoord0 = texcoord0; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaBlendF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaBlendF.glsl index 79425ad716..dbaab9bbda 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaBlendF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaBlendF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file pbrShadowAlphaBlendF.glsl * * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2023, 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$ */ @@ -33,7 +33,7 @@ in vec4 vertex_color; in vec2 vary_texcoord0; uniform float minimum_alpha; -void main() +void main() { float alpha = texture(diffuseMap,vary_texcoord0.xy).a; @@ -52,5 +52,5 @@ void main() } } - frag_color = vec4(1,1,1,1); + frag_color = vec4(1,1,1,1); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaMaskF.glsl index 1d1545be7e..c1fb9f5d84 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaMaskF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file pbrShadowAlphaMaskF.glsl * * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2023, 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$ */ @@ -33,7 +33,7 @@ in vec4 vertex_color; in vec2 vary_texcoord0; uniform float minimum_alpha; -void main() +void main() { float alpha = texture(diffuseMap,vary_texcoord0.xy).a; diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaMaskV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaMaskV.glsl index 4fb5fbcf06..0cfe3c9a5f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaMaskV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbrShadowAlphaMaskV.glsl @@ -1,24 +1,24 @@ -/** +/** * @file pbrShadowAlphaMaskV.glsl * * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2023, 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$ */ @@ -67,7 +67,7 @@ void main() post_pos = pos; gl_Position = pos; - + passTextureIndex(); vary_texcoord0 = texture_transform(texcoord0, texture_base_color_transform, texture_matrix0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbralphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbralphaF.glsl index 2ccd3fd962..566f4f9c2a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbralphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbralphaF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file pbralphaF.glsl * * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2023, 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$ */ diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl index 6b960fae33..d0fc362db9 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl @@ -1,24 +1,24 @@ -/** +/** * @file class1\deferred\pbralphaV.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$ */ @@ -77,13 +77,13 @@ vec3 tangent_space_transform(vec4 vertex_tangent, vec3 vertex_normal, vec4[2] kh void main() { #ifdef HAS_SKIN - mat4 mat = getObjectSkinnedTransform(); - mat = modelview_matrix * mat; - vec3 pos = (mat*vec4(position.xyz,1.0)).xyz; - vary_position = pos; + mat4 mat = getObjectSkinnedTransform(); + mat = modelview_matrix * mat; + vec3 pos = (mat*vec4(position.xyz,1.0)).xyz; + vary_position = pos; vec4 vert = projection_matrix * vec4(pos,1.0); #else - //transform vertex + //transform vertex vec4 vert = modelview_projection_matrix * vec4(position.xyz, 1.0); #endif gl_Position = vert; @@ -96,11 +96,11 @@ void main() emissive_texcoord = texture_transform(texcoord0, texture_emissive_transform, texture_matrix0); #ifdef HAS_SKIN - vec3 n = (mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz; - vec3 t = (mat*vec4(tangent.xyz+position.xyz,1.0)).xyz-pos.xyz; + vec3 n = (mat*vec4(normal.xyz+position.xyz,1.0)).xyz-pos.xyz; + vec3 t = (mat*vec4(tangent.xyz+position.xyz,1.0)).xyz-pos.xyz; #else //HAS_SKIN - vec3 n = normal_matrix * normal; - vec3 t = normal_matrix * tangent.xyz; + vec3 n = normal_matrix * normal; + vec3 t = normal_matrix * tangent.xyz; #endif //HAS_SKIN n = normalize(n); @@ -109,10 +109,10 @@ void main() vary_sign = tangent.w; vary_normal = n; - vertex_color = diffuse_color; + vertex_color = diffuse_color; #if !defined(HAS_SKIN) - vary_position = (modelview_matrix*vec4(position.xyz, 1.0)).xyz; + vary_position = (modelview_matrix*vec4(position.xyz, 1.0)).xyz; #endif } @@ -145,7 +145,7 @@ vec2 texture_transform(vec2 vertex_texcoord, vec4[2] khr_gltf_transform, mat4 sl void main() { - //transform vertex + //transform vertex vec4 vert = modelview_projection_matrix * vec4(position.xyz, 1.0); gl_Position = vert; vary_position = vert.xyz; @@ -153,7 +153,7 @@ void main() base_color_texcoord = texture_transform(texcoord0, texture_base_color_transform, texture_matrix0); emissive_texcoord = texture_transform(texcoord0, texture_emissive_transform, texture_matrix0); - vertex_color = diffuse_color; + vertex_color = diffuse_color; } #endif diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrglowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrglowF.glsl index b74b2e6a83..0c52c924b0 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbrglowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbrglowF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file pbrglowF.glsl * * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2023, 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$ */ diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbrglowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbrglowV.glsl index 82a50a115c..f739099359 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pbrglowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pbrglowV.glsl @@ -1,24 +1,24 @@ -/** +/** * @file pbgglowV.glsl * * $LicenseInfo:firstyear=2023&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2023, 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$ */ @@ -44,7 +44,7 @@ in vec2 texcoord0; out vec2 base_color_texcoord; out vec2 emissive_texcoord; - + out vec4 vertex_emissive; vec2 texture_transform(vec2 vertex_texcoord, vec4[2] khr_gltf_transform, mat4 sl_animation_transform); @@ -61,7 +61,7 @@ void main() gl_Position = projection_matrix*vec4(pos,1.0); #else //transform vertex - gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); #endif base_color_texcoord = texture_transform(texcoord0, texture_base_color_transform, texture_matrix0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl index 86e3f1acda..9797bcd2ce 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file postDeferredF.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$ */ @@ -38,87 +38,87 @@ in vec2 vary_fragcoord; void dofSample(inout vec4 diff, inout float w, float min_sc, vec2 tc) { - vec4 s = texture(diffuseRect, tc); - - float sc = abs(s.a*2.0-1.0)*max_cof; - - if (sc > min_sc) //sampled pixel is more "out of focus" than current sample radius - { - float wg = 0.25; - - // de-weight dull areas to make highlights 'pop' - wg += s.r+s.g+s.b; - - diff += wg*s; - - w += wg; - } + vec4 s = texture(diffuseRect, tc); + + float sc = abs(s.a*2.0-1.0)*max_cof; + + if (sc > min_sc) //sampled pixel is more "out of focus" than current sample radius + { + float wg = 0.25; + + // de-weight dull areas to make highlights 'pop' + wg += s.r+s.g+s.b; + + diff += wg*s; + + w += wg; + } } void dofSampleNear(inout vec4 diff, inout float w, float min_sc, vec2 tc) { - vec4 s = texture(diffuseRect, tc); + vec4 s = texture(diffuseRect, tc); - float wg = 0.25; + float wg = 0.25; - // de-weight dull areas to make highlights 'pop' - wg += s.r+s.g+s.b; + // de-weight dull areas to make highlights 'pop' + wg += s.r+s.g+s.b; - diff += wg*s; - - w += wg; + diff += wg*s; + + w += wg; } -void main() +void main() { - vec2 tc = vary_fragcoord.xy; - - vec4 diff = texture(diffuseRect, vary_fragcoord.xy); - - { - float w = 1.0; - - float sc = (diff.a*2.0-1.0)*max_cof; - - float PI = 3.14159265358979323846264; - - // sample quite uniformly spaced points within a circle, for a circular 'bokeh' - if (sc > 0.5) - { - while (sc > 0.5) - { - int its = int(max(1.0,(sc*3.7))); - for (int i=0; i<its; ++i) - { - float ang = sc+i*2*PI/its; // sc is added for rotary perturbance - float samp_x = sc*sin(ang); - float samp_y = sc*cos(ang); - // you could test sample coords against an interesting non-circular aperture shape here, if desired. - dofSampleNear(diff, w, sc, vary_fragcoord.xy + (vec2(samp_x,samp_y) / screen_res)); - } - sc -= 1.0; - } - } - else if (sc < -0.5) - { - sc = abs(sc); - while (sc > 0.5) - { - int its = int(max(1.0,(sc*3.7))); - for (int i=0; i<its; ++i) - { - float ang = sc+i*2*PI/its; // sc is added for rotary perturbance - float samp_x = sc*sin(ang); - float samp_y = sc*cos(ang); - // you could test sample coords against an interesting non-circular aperture shape here, if desired. - dofSample(diff, w, sc, vary_fragcoord.xy + (vec2(samp_x,samp_y) / screen_res)); - } - sc -= 1.0; - } - } - - diff /= w; - } - - frag_color = diff; + vec2 tc = vary_fragcoord.xy; + + vec4 diff = texture(diffuseRect, vary_fragcoord.xy); + + { + float w = 1.0; + + float sc = (diff.a*2.0-1.0)*max_cof; + + float PI = 3.14159265358979323846264; + + // sample quite uniformly spaced points within a circle, for a circular 'bokeh' + if (sc > 0.5) + { + while (sc > 0.5) + { + int its = int(max(1.0,(sc*3.7))); + for (int i=0; i<its; ++i) + { + float ang = sc+i*2*PI/its; // sc is added for rotary perturbance + float samp_x = sc*sin(ang); + float samp_y = sc*cos(ang); + // you could test sample coords against an interesting non-circular aperture shape here, if desired. + dofSampleNear(diff, w, sc, vary_fragcoord.xy + (vec2(samp_x,samp_y) / screen_res)); + } + sc -= 1.0; + } + } + else if (sc < -0.5) + { + sc = abs(sc); + while (sc > 0.5) + { + int its = int(max(1.0,(sc*3.7))); + for (int i=0; i<its; ++i) + { + float ang = sc+i*2*PI/its; // sc is added for rotary perturbance + float samp_x = sc*sin(ang); + float samp_y = sc*cos(ang); + // you could test sample coords against an interesting non-circular aperture shape here, if desired. + dofSample(diff, w, sc, vary_fragcoord.xy + (vec2(samp_x,samp_y) / screen_res)); + } + sc -= 1.0; + } + } + + diff /= w; + } + + frag_color = diff; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl index bace9b8c90..07384ebe9b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl @@ -1,28 +1,28 @@ -/** +/** * @file postDeferredNoDoFF.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]*/ out vec4 frag_color; @@ -33,11 +33,11 @@ uniform sampler2D depthMap; uniform vec2 screen_res; in vec2 vary_fragcoord; -void main() +void main() { - vec4 diff = texture(diffuseRect, vary_fragcoord.xy); - - frag_color = diff; + vec4 diff = texture(diffuseRect, vary_fragcoord.xy); + + frag_color = diff; gl_FragDepth = texture(depthMap, vary_fragcoord.xy).r; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoTCV.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoTCV.glsl index 7e8a5d68d4..87f28621ae 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoTCV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoTCV.glsl @@ -1,24 +1,24 @@ -/** +/** * @file postDeferredV.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$ */ @@ -31,8 +31,8 @@ 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); + //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/postDeferredV.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl index 10b4b3e76c..09fe443e2d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl @@ -1,24 +1,24 @@ -/** +/** * @file postDeferredV.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$ */ @@ -34,9 +34,9 @@ uniform vec2 screen_res; void main() { - //transform vertex - vec4 pos = vec4(position.xyz, 1.0); - gl_Position = pos; - vary_tc = (pos.xy*0.5+0.5)*tc_scale; - vary_fragcoord = (pos.xy*0.5+0.5); + //transform vertex + vec4 pos = vec4(position.xyz, 1.0); + gl_Position = pos; + vary_tc = (pos.xy*0.5+0.5)*tc_scale; + vary_fragcoord = (pos.xy*0.5+0.5); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredVisualizeBuffers.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredVisualizeBuffers.glsl index 2c17de311c..a539d5af90 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredVisualizeBuffers.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredVisualizeBuffers.glsl @@ -1,28 +1,28 @@ -/** +/** * @file postDeferredNoDoFF.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]*/ out vec4 frag_color; @@ -32,10 +32,10 @@ uniform float mipLevel; in vec2 vary_fragcoord; -void main() +void main() { - vec4 diff = textureLod(diffuseRect, vary_fragcoord.xy, mipLevel); - - frag_color = diff; + vec4 diff = textureLod(diffuseRect, vary_fragcoord.xy, mipLevel); + + frag_color = diff; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl index 1a85d70256..cf0595ee45 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/screenSpaceReflUtil.glsl @@ -25,7 +25,7 @@ // debug stub -float random (vec2 uv) +float random (vec2 uv) { return 0; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl index a8febabcc6..9db8f461dd 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file shadowAlphaMaskF.glsl * * $LicenseInfo:firstyear=2011&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2011, 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$ */ @@ -35,9 +35,9 @@ in vec4 vertex_color; in vec2 vary_texcoord0; uniform float minimum_alpha; -void main() +void main() { - float alpha = diffuseLookup(vary_texcoord0.xy).a; + float alpha = diffuseLookup(vary_texcoord0.xy).a; if (alpha < minimum_alpha) { @@ -61,5 +61,5 @@ void main() } } - frag_color = vec4(1,1,1,1); + frag_color = vec4(1,1,1,1); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl index 26db1a5d4d..665ff6d3df 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl @@ -1,24 +1,24 @@ -/** +/** * @file shadowAlphaMaskV.glsl * * $LicenseInfo:firstyear=2011&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2011, 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$ */ @@ -47,26 +47,26 @@ void passTextureIndex(); void main() { - //transform vertex + //transform vertex #if defined(HAS_SKIN) - vec4 pre_pos = vec4(position.xyz, 1.0); - mat4 mat = getObjectSkinnedTransform(); - mat = modelview_matrix * mat; - vec4 pos = mat * pre_pos; - pos = projection_matrix * pos; + vec4 pre_pos = vec4(position.xyz, 1.0); + mat4 mat = getObjectSkinnedTransform(); + mat = modelview_matrix * mat; + vec4 pos = mat * pre_pos; + pos = projection_matrix * pos; #else - vec4 pre_pos = vec4(position.xyz, 1.0); - vec4 pos = modelview_projection_matrix * pre_pos; + vec4 pre_pos = vec4(position.xyz, 1.0); + vec4 pos = modelview_projection_matrix * pre_pos; #endif - target_pos_x = 0.5 * (shadow_target_width - 1.0) * pos.x; + target_pos_x = 0.5 * (shadow_target_width - 1.0) * pos.x; + + post_pos = pos; - post_pos = pos; + gl_Position = pos; - gl_Position = pos; - - passTextureIndex(); + passTextureIndex(); - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; - vertex_color = diffuse_color; + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + vertex_color = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowCubeV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowCubeV.glsl index 0f5f9ed289..1c169b3cc9 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowCubeV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowCubeV.glsl @@ -1,24 +1,24 @@ -/** +/** * @file shadowCubeV.glsl * * $LicenseInfo:firstyear=2011&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$ */ @@ -32,9 +32,9 @@ uniform vec3 box_size; void main() { - //transform vertex - vec3 p = position*box_size+box_center; - vec4 pos = modelview_projection_matrix*vec4(p.xyz, 1.0); + //transform vertex + vec3 p = position*box_size+box_center; + vec4 pos = modelview_projection_matrix*vec4(p.xyz, 1.0); - gl_Position = pos; + gl_Position = pos; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl index 370aa75d04..b55d769fd6 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl @@ -1,31 +1,31 @@ -/** +/** * @file shadowF.glsl * * $LicenseInfo:firstyear=2011&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$ */ - + out vec4 frag_color; -void main() +void main() { - frag_color = vec4(1,1,1,1); + frag_color = vec4(1,1,1,1); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowSkinnedV.glsl index 9bbc63bce1..1485ea9121 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowSkinnedV.glsl @@ -1,24 +1,24 @@ -/** +/** * @file shadowSkinnedV.glsl * * $LicenseInfo:firstyear=2021&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$ */ @@ -32,12 +32,12 @@ mat4 getObjectSkinnedTransform(); void main() { - //transform vertex - mat4 mat = getObjectSkinnedTransform(); - - mat = modelview_matrix * mat; - vec4 pos = (mat*vec4(position.xyz, 1.0)); - pos = projection_matrix*pos; + //transform vertex + mat4 mat = getObjectSkinnedTransform(); + + mat = modelview_matrix * mat; + vec4 pos = (mat*vec4(position.xyz, 1.0)); + pos = projection_matrix*pos; - gl_Position = pos; + gl_Position = pos; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl index ee3a5f1f31..16cc7cfbbc 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl @@ -1,24 +1,24 @@ -/** +/** * @file class1/deferred/shadowUtil.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$ */ @@ -83,7 +83,7 @@ float pcfSpotShadow(sampler2DShadow shadowMap, vec4 stc, float bias_scale, vec2 vec2 off = 1.0/proj_shadow_res; off.y *= 1.5; - + shadow += texture(shadowMap, stc.xyz+vec3(off.x*2.0, off.y, 0.0)); shadow += texture(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)); shadow += texture(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)); @@ -112,7 +112,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen) vec4 spos = vec4(shadow_pos.xyz, 1.0); if (spos.z > -shadow_clip.w) - { + { vec4 lpos; vec4 near_split = shadow_clip*-0.75; vec4 far_split = shadow_clip*-1.25; @@ -122,7 +122,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen) if (spos.z < near_split.z) { lpos = shadow_matrix[3]*spos; - + float w = 1.0; w -= max(spos.z-far_split.z, 0.0)/transition_domain.z; //w = clamp(w, 0.0, 1.0); @@ -138,7 +138,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen) if (spos.z < near_split.y && spos.z > far_split.z) { lpos = shadow_matrix[2]*spos; - + float w = 1.0; w -= max(spos.z-far_split.y, 0.0)/transition_domain.y; w -= max(near_split.z-spos.z, 0.0)/transition_domain.z; @@ -154,7 +154,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen) if (spos.z < near_split.x && spos.z > far_split.y) { lpos = shadow_matrix[1]*spos; - + float w = 1.0; w -= max(spos.z-far_split.x, 0.0)/transition_domain.x; w -= max(near_split.y-spos.z, 0.0)/transition_domain.y; @@ -170,7 +170,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen) if (spos.z > far_split.x) { lpos = shadow_matrix[0]*spos; - + float w = 1.0; w -= max(near_split.x-spos.z, 0.0)/transition_domain.x; //w = clamp(w, 0.0, 1.0); @@ -203,9 +203,9 @@ float sampleSpotShadow(vec3 pos, vec3 norm, int index, vec2 pos_screen) vec4 spos = vec4(pos,1.0); if (spos.z > -shadow_clip.w) - { + { vec4 lpos; - + vec4 near_split = shadow_clip*-0.75; vec4 far_split = shadow_clip*-1.25; vec4 transition_domain = near_split-far_split; @@ -216,7 +216,7 @@ float sampleSpotShadow(vec3 pos, vec3 norm, int index, vec2 pos_screen) w -= max(spos.z-far_split.z, 0.0)/transition_domain.z; if (index == 0) - { + { lpos = shadow_matrix[4]*spos; shadow += pcfSpotShadow(shadowMap4, lpos, 0.8, spos.xy)*w; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl index bd62954ff8..5e1c502822 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl @@ -1,24 +1,24 @@ -/** +/** * @file shadowV.glsl * * $LicenseInfo:firstyear=2011&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$ */ @@ -29,6 +29,6 @@ in vec3 position; void main() { - //transform vertex - gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); + //transform vertex + gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl index b35d10c8a0..6f45adc68d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file starsF.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$ */ @@ -44,15 +44,15 @@ float twinkle(){ // See: // ALM off: class1/environment/starsF.glsl // ALM on : class1/deferred/starsF.glsl -void main() +void main() { - // camera above water: class1\deferred\starsF.glsl - // camera below water: class1\environment\starsF.glsl + // camera above water: class1\deferred\starsF.glsl + // camera below water: class1\environment\starsF.glsl vec4 col_a = texture(diffuseMap, vary_texcoord0.xy); vec4 col_b = texture(diffuseMap, vary_texcoord0.xy); vec4 col = mix(col_b, col_a, blend_factor); col.rgb *= vertex_color.rgb; - + float factor = smoothstep(0.0f, 0.9f, custom_alpha); col.a = (col.a * factor) * 32.0f; diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl index 726508607d..97ee437870 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl @@ -1,24 +1,24 @@ -/** +/** * @file starsV.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$ */ @@ -37,18 +37,18 @@ out vec2 screenpos; void main() { - //transform vertex + //transform vertex vec4 pos = modelview_projection_matrix * vec4(position, 1.0); - - // smash to far clip plane to + + // smash to far clip plane to // avoid rendering on top of moon (do NOT write to gl_FragDepth, it's slow) pos.z = pos.w; - gl_Position = pos; + gl_Position = pos; float t = mod(time, 1.25f); screenpos = position.xy * vec2(t, t); - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; - vertex_color = diffuse_color; + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + vertex_color = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl index fd343ed2dc..e3441add35 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunDiscF.glsl @@ -1,28 +1,28 @@ -/** +/** * @file sunDiscF.glsl * * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2005, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ - + /*[EXTRA_CODE_HERE]*/ out vec4 frag_data[4]; @@ -35,7 +35,7 @@ uniform float blend_factor; // interp factor between sunDisc A/B in vec2 vary_texcoord0; in float sun_fade; -void main() +void main() { vec4 sunDiscA = texture(diffuseMap, vary_texcoord0.xy); vec4 sunDiscB = texture(altDiffuseMap, vary_texcoord0.xy); diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunDiscV.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunDiscV.glsl index 9a8d791a1d..ef45e6ab32 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunDiscV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunDiscV.glsl @@ -1,24 +1,24 @@ -/** +/** * @file sunDiscV.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$ */ @@ -47,7 +47,7 @@ void main() // smash to *almost* far clip plane -- behind clouds but in front of stars pos.z = pos.w*0.999999; gl_Position = pos; - + calcAtmospherics(pos.xyz); vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl index 7dcab640f2..33a5efa45d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl @@ -1,24 +1,24 @@ -/** +/** * @file treeShadowF.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$ */ @@ -34,14 +34,14 @@ uniform sampler2D diffuseMap; in vec2 vary_texcoord0; -void main() +void main() { - float alpha = texture(diffuseMap, vary_texcoord0.xy).a; + float alpha = texture(diffuseMap, vary_texcoord0.xy).a; - if (alpha < minimum_alpha) - { - discard; - } + if (alpha < minimum_alpha) + { + discard; + } - frag_color = vec4(1,1,1,1); + frag_color = vec4(1,1,1,1); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeShadowSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeShadowSkinnedV.glsl index f5192c3009..f2c80072dc 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/treeShadowSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/treeShadowSkinnedV.glsl @@ -1,24 +1,24 @@ -/** +/** * @file treeShadowV.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$ */ @@ -26,7 +26,7 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 projection_matrix; - + in vec3 position; in vec2 texcoord0; @@ -36,13 +36,13 @@ mat4 getObjectSkinnedTransform(); void main() { - //transform vertex + //transform vertex mat4 mat = getObjectSkinnedTransform(); - - mat = modelview_matrix * mat; - - vec4 pos = mat * vec4(position.xyz, 1.0); + + mat = modelview_matrix * mat; + + vec4 pos = mat * vec4(position.xyz, 1.0); gl_Position = projection_matrix * pos; - - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl index 3102c870fc..8f359a0a3d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl @@ -1,31 +1,31 @@ -/** +/** * @file treeShadowV.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 texture_matrix0; uniform mat4 modelview_projection_matrix; - + in vec3 position; in vec2 texcoord0; @@ -33,8 +33,8 @@ out vec2 vary_texcoord0; void main() { - //transform vertex - gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); - - vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + //transform vertex + gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); + + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; } |