diff options
| author | Ansariel <ansariel.hiller@phoenixviewer.com> | 2024-05-22 19:04:52 +0200 | 
|---|---|---|
| committer | Ansariel <ansariel.hiller@phoenixviewer.com> | 2024-05-22 19:04:52 +0200 | 
| commit | 1b67dd855c41f5a0cda7ec2a68d98071986ca703 (patch) | |
| tree | ab243607f74f78200787bba5b9b88f07ef1b966f /indra/newview/app_settings/shaders/class3 | |
| parent | 6d6eabca44d08d5b97bfe3e941d2b9687c2246ea (diff) | |
| parent | e1623bb276f83a43ce7a197e388720c05bdefe61 (diff) | |
Merge remote-tracking branch 'origin/main' into DRTVWR-600-maint-A
# Conflicts:
#	autobuild.xml
#	indra/cmake/CMakeLists.txt
#	indra/cmake/GoogleMock.cmake
#	indra/llaudio/llaudioengine_fmodstudio.cpp
#	indra/llaudio/llaudioengine_fmodstudio.h
#	indra/llaudio/lllistener_fmodstudio.cpp
#	indra/llaudio/lllistener_fmodstudio.h
#	indra/llaudio/llstreamingaudio_fmodstudio.cpp
#	indra/llaudio/llstreamingaudio_fmodstudio.h
#	indra/llcharacter/llmultigesture.cpp
#	indra/llcharacter/llmultigesture.h
#	indra/llimage/llimage.cpp
#	indra/llimage/llimagepng.cpp
#	indra/llimage/llimageworker.cpp
#	indra/llimage/tests/llimageworker_test.cpp
#	indra/llmessage/tests/llmockhttpclient.h
#	indra/llprimitive/llgltfmaterial.h
#	indra/llrender/llfontfreetype.cpp
#	indra/llui/llcombobox.cpp
#	indra/llui/llfolderview.cpp
#	indra/llui/llfolderviewmodel.h
#	indra/llui/lllineeditor.cpp
#	indra/llui/lllineeditor.h
#	indra/llui/lltextbase.cpp
#	indra/llui/lltextbase.h
#	indra/llui/lltexteditor.cpp
#	indra/llui/lltextvalidate.cpp
#	indra/llui/lltextvalidate.h
#	indra/llui/lluictrl.h
#	indra/llui/llview.cpp
#	indra/llwindow/llwindowmacosx.cpp
#	indra/newview/app_settings/settings.xml
#	indra/newview/llappearancemgr.cpp
#	indra/newview/llappearancemgr.h
#	indra/newview/llavatarpropertiesprocessor.cpp
#	indra/newview/llavatarpropertiesprocessor.h
#	indra/newview/llbreadcrumbview.cpp
#	indra/newview/llbreadcrumbview.h
#	indra/newview/llbreastmotion.cpp
#	indra/newview/llbreastmotion.h
#	indra/newview/llconversationmodel.h
#	indra/newview/lldensityctrl.cpp
#	indra/newview/lldensityctrl.h
#	indra/newview/llface.inl
#	indra/newview/llfloatereditsky.cpp
#	indra/newview/llfloatereditwater.cpp
#	indra/newview/llfloateremojipicker.h
#	indra/newview/llfloaterimsessiontab.cpp
#	indra/newview/llfloaterprofiletexture.cpp
#	indra/newview/llfloaterprofiletexture.h
#	indra/newview/llgesturemgr.cpp
#	indra/newview/llgesturemgr.h
#	indra/newview/llimpanel.cpp
#	indra/newview/llimpanel.h
#	indra/newview/llinventorybridge.cpp
#	indra/newview/llinventorybridge.h
#	indra/newview/llinventoryclipboard.cpp
#	indra/newview/llinventoryclipboard.h
#	indra/newview/llinventoryfunctions.cpp
#	indra/newview/llinventoryfunctions.h
#	indra/newview/llinventorygallery.cpp
#	indra/newview/lllistbrowser.cpp
#	indra/newview/lllistbrowser.h
#	indra/newview/llpanelobjectinventory.cpp
#	indra/newview/llpanelprofile.cpp
#	indra/newview/llpanelprofile.h
#	indra/newview/llpreviewgesture.cpp
#	indra/newview/llsavedsettingsglue.cpp
#	indra/newview/llsavedsettingsglue.h
#	indra/newview/lltooldraganddrop.cpp
#	indra/newview/llurllineeditorctrl.cpp
#	indra/newview/llvectorperfoptions.cpp
#	indra/newview/llvectorperfoptions.h
#	indra/newview/llviewerparceloverlay.cpp
#	indra/newview/llviewertexlayer.cpp
#	indra/newview/llviewertexturelist.cpp
#	indra/newview/macmain.h
#	indra/test/test.cpp
Diffstat (limited to 'indra/newview/app_settings/shaders/class3')
19 files changed, 253 insertions, 253 deletions
| diff --git a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl index 8430cca325..22408387b1 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl @@ -1,28 +1,28 @@ -/**  +/**   * @file fullbrightShinyF.glsl   *   * $LicenseInfo:firstyear=2007&license=viewerlgpl$   * Second Life Viewer Source Code   * Copyright (C) 2007, Linden Research, Inc. - *  + *   * This library is free software; you can redistribute it and/or   * modify it under the terms of the GNU Lesser General Public   * License as published by the Free Software Foundation;   * version 2.1 of the License only. - *  + *   * This library is distributed in the hope that it will be useful,   * but WITHOUT ANY WARRANTY; without even the implied warranty of   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU   * Lesser General Public License for more details. - *  + *   * You should have received a copy of the GNU Lesser General Public   * License along with this library; if not, write to the Free Software   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA - *  + *   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  +  /*[EXTRA_CODE_HERE]*/  out vec4 frag_color; @@ -56,16 +56,16 @@ void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3  void main()  {  #ifdef HAS_DIFFUSE_LOOKUP -	vec4 color = diffuseLookup(vary_texcoord0.xy); +    vec4 color = diffuseLookup(vary_texcoord0.xy);  #else -	vec4 color = texture(diffuseMap, vary_texcoord0.xy); +    vec4 color = texture(diffuseMap, vary_texcoord0.xy);  #endif -	 -	color.rgb *= vertex_color.rgb; -	// SL-9632 HUDs are affected by Atmosphere +    color.rgb *= vertex_color.rgb; + +    // SL-9632 HUDs are affected by Atmosphere  #ifndef IS_HUD -	 +      vec3 sunlit;      vec3 amblit;      vec3 additive; @@ -87,8 +87,8 @@ void main()      applyLegacyEnv(color.rgb, legacyenv, spec, pos, norm, env_intensity);  #endif -	color.a = 1.0; +    color.a = 1.0; -	frag_color = max(color, vec4(0)); +    frag_color = max(color, vec4(0));  } diff --git a/indra/newview/app_settings/shaders/class3/deferred/hazeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/hazeF.glsl index 0b154e82ad..7f75b16cf0 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/hazeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/hazeF.glsl @@ -68,16 +68,16 @@ void main()      calcAtmosphericVarsLinear(pos.xyz, norm.xyz, light_dir, sunlit, amblit, additive, atten);      vec3 sunlit_linear = srgb_to_linear(sunlit); -     +      // mask off atmospherics below water (when camera is under water)      bool do_atmospherics = false; -         +      if (dot(vec3(0), waterPlane.xyz) + waterPlane.w > 0.0 ||          dot(pos.xyz, waterPlane.xyz) + waterPlane.w > 0.0)      {          do_atmospherics = true;      } -     +      vec3  irradiance = vec3(0);      vec3  radiance  = vec3(0); @@ -102,5 +102,5 @@ void main()      }      frag_color = max(vec4(color.rgb, alpha), vec4(0)); //output linear since local lights will be added to this shader's results -     +  } diff --git a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl index ec1e49eeb4..20f063fe3e 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl @@ -93,7 +93,7 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe      float falloff_factor = (12.0 * fa) - 9.0;      float inverted_la = falloff_factor / la;      // Yes, it makes me want to cry as well. DJH -     +      vec3 col = vec3(0);      //get light vector @@ -215,19 +215,19 @@ vec2 encode_normal(vec3 n);  vec3 getNormal(inout float glossiness)  {  #ifdef HAS_NORMAL_MAP -	vec4 vNt = texture(bumpMap, vary_texcoord1.xy); +    vec4 vNt = texture(bumpMap, vary_texcoord1.xy);      glossiness *= vNt.a; -	vNt.xyz = vNt.xyz * 2 - 1; +    vNt.xyz = vNt.xyz * 2 - 1;      float sign = vary_sign;      vec3 vN = vary_normal;      vec3 vT = vary_tangent.xyz; -     +      vec3 vB = sign * cross(vN, vT);      vec3 tnorm = normalize( vNt.x * vT + vNt.y * vB + vNt.z * vN ); -	return tnorm; +    return tnorm;  #else -	return normalize(vary_normal); +    return normalize(vary_normal);  #endif  } @@ -264,9 +264,9 @@ void waterClip()  float getEmissive(vec4 diffcol)  {  #if (DIFFUSE_ALPHA_MODE != DIFFUSE_ALPHA_MODE_EMISSIVE) -	return emissive_brightness; +    return emissive_brightness;  #else -	return max(diffcol.a, emissive_brightness); +    return max(diffcol.a, emissive_brightness);  #endif  } @@ -289,7 +289,7 @@ void main()      // diffcol == diffuse map combined with vertex color      vec4 diffcol = texture(diffuseMap, vary_texcoord0.xy); -	diffcol.rgb *= vertex_color.rgb; +    diffcol.rgb *= vertex_color.rgb;      alphaMask(diffcol.a); @@ -325,7 +325,7 @@ void main()      vec3 additive;      vec3 atten;      calcAtmosphericVarsLinear(pos.xyz, norm.xyz, light_dir, sunlit, amblit, additive, atten); -     +      vec3 sunlit_linear = srgb_to_linear(sunlit);      vec3 amblit_linear = amblit; @@ -333,7 +333,7 @@ void main()      vec3 glossenv;      vec3 legacyenv;      sampleReflectionProbesLegacy(ambenv, glossenv, legacyenv, pos.xy*0.5+0.5, pos.xyz, norm.xyz, glossiness, env, true, amblit_linear); -     +      color = ambenv;      float da          = clamp(dot(norm.xyz, light_dir.xyz), 0.0, 1.0); @@ -405,7 +405,7 @@ void main()      frag_color = max(vec4(color, al), vec4(0)); -#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(diffcol.rgb, emissive);        // gbuffer is sRGB for legacy materials      frag_data[1] = vec4(spec.rgb, glossiness);           // XYZ = Specular color. W = Specular exponent. diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl index ec8168465e..31aca8a745 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl @@ -56,8 +56,8 @@ vec3 srgb_to_linear(vec3 c);  // Util  vec3 hue_to_rgb(float hue); -vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,  -                    float perceptualRoughness,  +vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, +                    float perceptualRoughness,                      float metallic,                      vec3 n, // normal                      vec3 v, // surface point to camera @@ -92,7 +92,7 @@ void main()          float metallic = orm.b;          vec3 f0 = vec3(0.04);          vec3 baseColor = diffuse.rgb; -         +          vec3 diffuseColor = baseColor.rgb*(vec3(1.0)-f0);          diffuseColor *= 1.0 - metallic; diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightV.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightV.glsl index c2b9ed3d96..09fd389370 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightV.glsl @@ -1,24 +1,24 @@ -/**  +/**   * @file class3\deferred\multiPointLightV.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$   */ @@ -29,9 +29,9 @@ out vec4 vary_fragcoord;  void main()  { -	//transform vertex -	vec4 pos = vec4(position.xyz, 1.0); -	vary_fragcoord = pos; +    //transform vertex +    vec4 pos = vec4(position.xyz, 1.0); +    vary_fragcoord = pos; -	gl_Position = pos; +    gl_Position = pos;  } diff --git a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl index 31af1208bd..c27310cf89 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl @@ -1,28 +1,28 @@ -/**  +/**   * @file class3\deferred\pointLightF.glsl   *   * $LicenseInfo:firstyear=2022&license=viewerlgpl$   * Second Life Viewer Source Code   * Copyright (C) 2022, Linden Research, Inc. - *  + *   * This library is free software; you can redistribute it and/or   * modify it under the terms of the GNU Lesser General Public   * License as published by the Free Software Foundation;   * version 2.1 of the License only. - *  + *   * This library is distributed in the hope that it will be useful,   * but WITHOUT ANY WARRANTY; without even the implied warranty of   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU   * Lesser General Public License for more details. - *  + *   * You should have received a copy of the GNU Lesser General Public   * License along with this library; if not, write to the Free Software   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA - *  + *   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  +  /*[EXTRA_CODE_HERE]*/  out vec4 frag_color; @@ -59,8 +59,8 @@ vec2 getScreenCoord(vec4 clip);  vec3 srgb_to_linear(vec3 c);  float getDepth(vec2 tc); -vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,  -                    float perceptualRoughness,  +vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, +                    float perceptualRoughness,                      float metallic,                      vec3 n, // normal                      vec3 v, // surface point to camera @@ -94,13 +94,13 @@ void main()      if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))      { -        vec3 colorEmissive = texture(emissiveRect, tc).rgb;  +        vec3 colorEmissive = texture(emissiveRect, tc).rgb;          vec3 orm = spec.rgb;          float perceptualRoughness = orm.g;          float metallic = orm.b;          vec3 f0 = vec3(0.04);          vec3 baseColor = diffuse.rgb; -         +          vec3 diffuseColor = baseColor.rgb*(vec3(1.0)-f0);          diffuseColor *= 1.0 - metallic; @@ -137,7 +137,7 @@ void main()                  final_color += lit*scol*color.rgb*spec.rgb;              }          } -     +          if (dot(final_color, final_color) <= 0.0)          {              discard; diff --git a/indra/newview/app_settings/shaders/class3/deferred/pointLightV.glsl b/indra/newview/app_settings/shaders/class3/deferred/pointLightV.glsl index 8d23f1b427..6111f0bf77 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/pointLightV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/pointLightV.glsl @@ -1,24 +1,24 @@ -/**  +/**   * @file class3\deferred\pointLightV.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$   */ @@ -36,10 +36,10 @@ out vec3 trans_center;  void main()  { -	//transform vertex -	vec3 p = position*size+center; -	vec4 pos = modelview_projection_matrix * vec4(p.xyz, 1.0); -	vary_fragcoord = pos; -	trans_center = (modelview_matrix*vec4(center.xyz, 1.0)).xyz; -	gl_Position = pos; +    //transform vertex +    vec3 p = position*size+center; +    vec4 pos = modelview_projection_matrix * vec4(p.xyz, 1.0); +    vary_fragcoord = pos; +    trans_center = (modelview_matrix*vec4(center.xyz, 1.0)).xyz; +    gl_Position = pos;  } diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl index 906e66ecc8..ae81a4b472 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl @@ -49,7 +49,7 @@ layout (std140) uniform ReflectionProbes      mat4 refBox[MAX_REFMAP_COUNT];      // list of bounding spheres for reflection probes sorted by distance to camera (closest first)      vec4 refSphere[MAX_REFMAP_COUNT]; -    // extra parameters  +    // extra parameters      //  x - irradiance scale      //  y - radiance scale      //  z - fade in @@ -95,7 +95,7 @@ bool shouldSampleProbe(int i, vec3 pos)      if (refIndex[i].w < 0)      {          vec4 v = refBox[i] * vec4(pos, 1.0); -        if (abs(v.x) > 1 ||  +        if (abs(v.x) > 1 ||              abs(v.y) > 1 ||              abs(v.z) > 1)          { @@ -222,7 +222,7 @@ void preProbeSample(vec3 pos)                          }                      }                      count++; -                     +                      ++neighborIdx;                  } @@ -244,56 +244,56 @@ void preProbeSample(vec3 pos)  // original reference implementation:  /* -bool intersect(const Ray &ray) const  -{  -        float t0, t1; // solutions for t if the ray intersects  -#if 0  +bool intersect(const Ray &ray) const +{ +        float t0, t1; // solutions for t if the ray intersects +#if 0          // geometric solution -        Vec3f L = center - orig;  -        float tca = L.dotProduct(dir);  +        Vec3f L = center - orig; +        float tca = L.dotProduct(dir);          // if (tca < 0) return false; -        float d2 = L.dotProduct(L) - tca * tca;  -        if (d2 > radius2) return false;  -        float thc = sqrt(radius2 - d2);  -        t0 = tca - thc;  -        t1 = tca + thc;  -#else  +        float d2 = L.dotProduct(L) - tca * tca; +        if (d2 > radius2) return false; +        float thc = sqrt(radius2 - d2); +        t0 = tca - thc; +        t1 = tca + thc; +#else          // analytic solution -        Vec3f L = orig - center;  -        float a = dir.dotProduct(dir);  -        float b = 2 * dir.dotProduct(L);  -        float c = L.dotProduct(L) - radius2;  -        if (!solveQuadratic(a, b, c, t0, t1)) return false;  -#endif  -        if (t0 > t1) std::swap(t0, t1);  -  -        if (t0 < 0) {  -            t0 = t1; // if t0 is negative, let's use t1 instead  -            if (t0 < 0) return false; // both t0 and t1 are negative  -        }  -  -        t = t0;  -  -        return true;  +        Vec3f L = orig - center; +        float a = dir.dotProduct(dir); +        float b = 2 * dir.dotProduct(L); +        float c = L.dotProduct(L) - radius2; +        if (!solveQuadratic(a, b, c, t0, t1)) return false; +#endif +        if (t0 > t1) std::swap(t0, t1); + +        if (t0 < 0) { +            t0 = t1; // if t0 is negative, let's use t1 instead +            if (t0 < 0) return false; // both t0 and t1 are negative +        } + +        t = t0; + +        return true;  } */  // adapted -- assume that origin is inside sphere, return intersection of ray with edge of sphere  vec3 sphereIntersect(vec3 origin, vec3 dir, vec3 center, float radius2) -{  -        float t0, t1; // solutions for t if the ray intersects  +{ +        float t0, t1; // solutions for t if the ray intersects -        vec3 L = center - origin;  +        vec3 L = center - origin;          float tca = dot(L,dir); -        float d2 = dot(L,L) - tca * tca;  +        float d2 = dot(L,L) - tca * tca; + +        float thc = sqrt(radius2 - d2); +        t0 = tca - thc; +        t1 = tca + thc; -        float thc = sqrt(radius2 - d2);  -        t0 = tca - thc;  -        t1 = tca + thc;  -           vec3 v = origin + dir * t1; -        return v;  -}  +        return v; +}  void swap(inout float a, inout float b)  { @@ -305,17 +305,17 @@ void swap(inout float a, inout float b)  // debug implementation, make no assumptions about origin  void sphereIntersectDebug(vec3 origin, vec3 dir, vec3 center, float radius2, float depth, inout vec4 col)  { -    float t[2]; // solutions for t if the ray intersects  +    float t[2]; // solutions for t if the ray intersects      // geometric solution -    vec3 L = center - origin;  +    vec3 L = center - origin;      float tca = dot(L, dir);      // if (tca < 0) return false; -    float d2 = dot(L, L) - tca * tca;  -    if (d2 > radius2) return;  -    float thc = sqrt(radius2 - d2);  -    t[0] = tca - thc;  -    t[1] = tca + thc;  +    float d2 = dot(L, L) - tca * tca; +    if (d2 > radius2) return; +    float thc = sqrt(radius2 - d2); +    t[0] = tca - thc; +    t[1] = tca + thc;      for (int i = 0; i < 2; ++i)      { @@ -404,8 +404,8 @@ void debugBoxCol(vec3 ro, vec3 rd, float t, vec3 p, inout vec4 col)      bool behind = dot(v,v) > dot(pos,pos);      float w = 0.25; -    -    if (behind)  + +    if (behind)      {          w *= 0.5;          w /= (length(v)-length(pos))*0.5+1.0; @@ -419,7 +419,7 @@ void debugBoxCol(vec3 ro, vec3 rd, float t, vec3 p, inout vec4 col)  // cribbed from https://iquilezles.org/articles/intersectors/  // axis aligned box centered at the origin, with size boxSize -void boxIntersectionDebug( in vec3 ro, in vec3 p, vec3 boxSize, inout vec4 col)  +void boxIntersectionDebug( in vec3 ro, in vec3 p, vec3 boxSize, inout vec4 col)  {      vec3 rd = normalize(p-ro); @@ -446,7 +446,7 @@ void boxIntersectionDebug( in vec3 ro, in vec3 p, vec3 boxSize, inout vec4 col)  void boxIntersectDebug(vec3 origin, vec3 pos, int i, inout vec4 col)  {      mat4 clipToLocal = refBox[i]; -     +      // transform into unit cube space      origin = (clipToLocal * vec4(origin, 1.0)).xyz;      pos = (clipToLocal * vec4(pos, 1.0)).xyz; @@ -464,7 +464,7 @@ void boxIntersectDebug(vec3 origin, vec3 pos, int i, inout vec4 col)  // dw - distance weight  float sphereWeight(vec3 pos, vec3 dir, vec3 origin, float r, int i, out float dw)  { -    float r1 = r * 0.5; // 50% of radius (outer sphere to start interpolating down)  +    float r1 = r * 0.5; // 50% of radius (outer sphere to start interpolating down)      vec3 delta = pos.xyz - origin;      float d2 = max(length(delta), 0.001); @@ -488,7 +488,7 @@ float sphereWeight(vec3 pos, vec3 dir, vec3 origin, float r, int i, out float dw  // lod - which mip to sample (lower is higher res, sharper reflections)  // c - center of probe  // r2 - radius of probe squared -// i - index of probe  +// i - index of probe  vec3 tapRefMap(vec3 pos, vec3 dir, out float w, out float dw, float lod, vec3 c, int i)  {      // parallax adjustment @@ -507,7 +507,7 @@ vec3 tapRefMap(vec3 pos, vec3 dir, out float w, out float dw, float lod, vec3 c,          float rr = r * r; -        v = sphereIntersect(pos, dir, c,  +        v = sphereIntersect(pos, dir, c,          refIndex[i].w < 1 ? 4096.0*4096.0 : // <== effectively disable parallax correction for automatically placed probes to keep from bombing the world with obvious spheres                  rr); @@ -518,7 +518,7 @@ vec3 tapRefMap(vec3 pos, vec3 dir, out float w, out float dw, float lod, vec3 c,      vec3 d = normalize(v);      v = env_mat * v; -     +      vec4 ret = textureLod(reflectionProbes, vec4(v.xyz, refIndex[i].x), lod) * refParams[i].y;      return ret.rgb; @@ -529,7 +529,7 @@ vec3 tapRefMap(vec3 pos, vec3 dir, out float w, out float dw, float lod, vec3 c,  // dir - pixel normal  // w - weight of sample (distance and angular attenuation)  // dw - weight of sample (distance only) -// i - index of probe  +// i - index of probe  vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int i, vec3 amblit)  {      // parallax adjustment @@ -547,7 +547,7 @@ vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int          // pad sphere for manual probe extending into automatic probe space          float rr = r * r; -        v = sphereIntersect(pos, dir, c,  +        v = sphereIntersect(pos, dir, c,          refIndex[i].w < 1 ? 4096.0*4096.0 : // <== effectively disable parallax correction for automatically placed probes to keep from bombing the world with obvious spheres                  rr); @@ -556,7 +556,7 @@ vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int      v -= c;      v = env_mat * v; -     +      vec3 col = textureLod(irradianceProbes, vec4(v.xyz, refIndex[i].x), 0).rgb * refParams[i].x;      col = mix(amblit, col, min(refParams[i].x, 1.0)); @@ -618,7 +618,7 @@ vec3 sampleProbes(vec3 pos, vec3 dir, float lod)          col[1] *= 1.0/wsum[1];          col[0] = vec3(0);      } -     +      return col[1]+col[0];  } @@ -647,7 +647,7 @@ vec3 sampleProbeAmbient(vec3 pos, vec3 dir, vec3 amblit)          {              continue;          } -         +          {              float w = 0;              float dw = 0; @@ -677,7 +677,7 @@ vec3 sampleProbeAmbient(vec3 pos, vec3 dir, vec3 amblit)          col[1] *= 1.0/wsum[1];          col[0] = vec3(0);      } -     +      return col[1]+col[0];  } @@ -800,7 +800,7 @@ void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout          float lod = (1.0-glossiness)*reflection_lods;          glossenv = sampleProbes(pos, normalize(refnormpersp), lod);      } -     +      if (envIntensity > 0.0)      {          legacyenv = sampleProbes(pos, normalize(refnormpersp), 0.0); diff --git a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl index dbf20fe2d8..63fa4ecc55 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostF.glsl @@ -53,7 +53,7 @@ float random (vec2 uv);  float tapScreenSpaceReflection(int totalSamples, vec2 tc, vec3 viewPos, vec3 n, inout vec4 collectedColor, sampler2D source, float glossiness); -void main()  +void main()  {      vec2  tc = vary_fragcoord.xy;      float depth = linearDepth01(getDepth(tc), zNear, zFar); @@ -63,13 +63,13 @@ void main()      vec3 pos = getPositionWithDepth(tc, getDepth(tc)).xyz;      vec4 spec    = texture(specularRect, tc);      vec2 hitpixel; -     +      vec4 diffuse = texture(diffuseRect, tc);      vec3 specCol = spec.rgb;      vec4 fcol = texture(diffuseMap, tc); -    if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))  +    if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))      {          vec3 orm = specCol.rgb;          float perceptualRoughness = orm.g; diff --git a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostV.glsl b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostV.glsl index f7e7268cc3..5555024b03 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflPostV.glsl @@ -36,13 +36,13 @@ out vec3 camera_ray;  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; -	vec4 rayOrig = inv_proj * vec4(pos.xy, 1, 1); +    vary_fragcoord = pos.xy * 0.5 + 0.5; + +    vec4 rayOrig = inv_proj * vec4(pos.xy, 1, 1);      camera_ray = rayOrig.xyz / rayOrig.w;  } diff --git a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflUtil.glsl b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflUtil.glsl index f14f7eac8d..e8901c7ba2 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflUtil.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflUtil.glsl @@ -92,7 +92,7 @@ bool traceScreenRay(vec3 position, vec3 reflection, out vec4 hitColor, out float      vec2 screenPosition;      bool hit = false;      hitColor = vec4(0); -     +      int i = 0;      if (depth > depthRejectBias)      { @@ -107,7 +107,7 @@ bool traceScreenRay(vec3 position, vec3 reflection, out vec4 hitColor, out float              }              depthFromScreen = getLinearDepth(screenPosition);              delta = abs(marchingPosition.z) - depthFromScreen; -             +              if (depth < depthFromScreen + epsilon && depth > depthFromScreen - epsilon)              {                  break; @@ -151,7 +151,7 @@ bool traceScreenRay(vec3 position, vec3 reflection, out vec4 hitColor, out float              {                  step *= 0.5;                  marchingPosition = marchingPosition - step * sign(delta); -                 +                  screenPosition = generateProjectedPosition(marchingPosition);                  if (screenPosition.x > 1 || screenPosition.x < 0 ||                      screenPosition.y > 1 || screenPosition.y < 0) @@ -180,7 +180,7 @@ bool traceScreenRay(vec3 position, vec3 reflection, out vec4 hitColor, out float              }          }      } -     +      return hit;  } @@ -335,18 +335,18 @@ collectedColor = vec4(1, 0, 1, 1);      vec2 uv2 = tc * screen_res;      float c = (uv2.x + uv2.y) * 0.125;      float jitter = mod( c, 1.0); -     +      vec2 screenpos = 1 - abs(tc * 2 - 1);      float vignette = clamp((abs(screenpos.x) * abs(screenpos.y)) * 16,0, 1);      vignette *= clamp((dot(normalize(viewPos), n) * 0.5 + 0.5) * 5.5 - 0.8, 0, 1); -     +      float zFar = 128.0;      vignette *= clamp(1.0+(viewPos.z/zFar), 0.0, 1.0);      vignette *= clamp(glossiness * 3 - 1.7, 0, 1);      vec4 hitpoint; -     +      glossiness = 1 - glossiness;      totalSamples = int(max(glossySampleCount, glossySampleCount * glossiness * vignette)); @@ -376,7 +376,7 @@ collectedColor = vec4(1, 0, 1, 1);                      collectedColor.a += 1;                  }              } -             +              if (hits > 0)              {                  collectedColor /= hits; diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index 5e8fe9301a..47b5934b84 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -104,8 +104,8 @@ vec3 pbrBaseLight(vec3 diffuseColor,                    vec3 additive,                    vec3 atten); -vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,  -                    float perceptualRoughness,  +vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, +                    float perceptualRoughness,                      float metallic,                      vec3 n, // normal                      vec3 v, // surface point to camera @@ -168,7 +168,7 @@ void main()      if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))      { -        vec3 orm = texture(specularRect, tc).rgb;  +        vec3 orm = texture(specularRect, tc).rgb;          float perceptualRoughness = orm.g;          float metallic = orm.b;          float ao = orm.r; @@ -176,9 +176,9 @@ void main()          vec3 colorEmissive = texture(emissiveRect, tc).rgb;          // PBR IBL          float gloss      = 1.0 - perceptualRoughness; -         +          sampleReflectionProbes(irradiance, radiance, tc, pos.xyz, norm.xyz, gloss, false, amblit_linear); -         +          adjustIrradiance(irradiance, ambocc);          vec3 diffuseColor; @@ -199,7 +199,7 @@ void main()      {          // legacy shaders are still writng sRGB to gbuffer          baseColor.rgb = srgb_to_linear(baseColor.rgb); -         +          spec.rgb = srgb_to_linear(spec.rgb);          float da          = clamp(dot(norm.xyz, light_dir.xyz), 0.0, 1.0); @@ -209,7 +209,7 @@ void main()          vec3 legacyenv = vec3(0);          sampleReflectionProbesLegacy(irradiance, glossenv, legacyenv, tc, pos.xyz, norm.xyz, spec.a, envIntensity, false, amblit_linear); -         +          adjustIrradiance(irradiance, ambocc);          // apply lambertian IBL only (see pbrIbl) @@ -218,7 +218,7 @@ void main()          vec3 sun_contrib = min(da, scol) * sunlit_linear;          color.rgb += sun_contrib;          color.rgb *= baseColor.rgb; -         +          vec3 refnormpersp = reflect(pos.xyz, norm.xyz);          if (spec.a > 0.0) @@ -247,7 +247,7 @@ void main()          }          color.rgb = mix(color.rgb, baseColor.rgb, baseColor.a); -         +          if (envIntensity > 0.0)          {  // add environment map              applyLegacyEnv(color, legacyenv, spec, pos.xyz, norm.xyz, envIntensity); diff --git a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl index d31b37fb60..871c7ce812 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl @@ -1,28 +1,28 @@ -/**  +/**   * @file class3\deferred\spotLightF.glsl   *   * $LicenseInfo:firstyear=2022&license=viewerlgpl$   * Second Life Viewer Source Code   * Copyright (C) 2022, Linden Research, Inc. - *  + *   * This library is free software; you can redistribute it and/or   * modify it under the terms of the GNU Lesser General Public   * License as published by the Free Software Foundation;   * version 2.1 of the License only. - *  + *   * This library is distributed in the hope that it will be useful,   * but WITHOUT ANY WARRANTY; without even the implied warranty of   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU   * Lesser General Public License for more details. - *  + *   * You should have received a copy of the GNU Lesser General Public   * License along with this library; if not, write to the Free Software   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA - *  + *   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  +  /*[EXTRA_CODE_HERE]*/  out vec4 frag_color; @@ -83,8 +83,8 @@ vec4 getPosition(vec2 pos_screen);  const float M_PI = 3.14159265; -vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,  -                    float perceptualRoughness,  +vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, +                    float perceptualRoughness,                      float metallic,                      vec3 n, // normal                      vec3 v, // surface point to camera @@ -112,13 +112,13 @@ void main()      }      float shadow = 1.0; -     +      if (proj_shadow_idx >= 0)      {          vec4 shd = texture(lightMap, tc);          shadow = (proj_shadow_idx==0)?shd.b:shd.a;          shadow += shadow_fade; -        shadow = clamp(shadow, 0.0, 1.0);         +        shadow = clamp(shadow, 0.0, 1.0);      }      float envIntensity; @@ -145,13 +145,13 @@ void main()      if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR))      { -        vec3 colorEmissive = texture(emissiveRect, tc).rgb;  +        vec3 colorEmissive = texture(emissiveRect, tc).rgb;          vec3 orm = spec.rgb;          float perceptualRoughness = orm.g;          float metallic = orm.b;          vec3 f0 = vec3(0.04);          vec3 baseColor = diffuse.rgb; -         +          vec3 diffuseColor = baseColor.rgb*(vec3(1.0)-f0);          diffuseColor *= 1.0 - metallic; @@ -169,7 +169,7 @@ void main()              if (nl > 0.0)              {                  amb_da += (nl*0.5 + 0.5) * proj_ambiance; -                 +                  dlit = getProjectedLightDiffuseColor( l_dist, proj_tc.xy );                  vec3 intensity = dist_atten * dlit * 3.25 * shadow; // Legacy attenuation, magic number to balance with legacy materials @@ -205,11 +205,11 @@ void main()                  // unshadowed for consistency between forward and deferred?                  amb_da += (nl*0.5+0.5) /* * (1.0-shadow) */ * proj_ambiance;              } -         +              amb_rgb = getProjectedLightAmbiance( amb_da, dist_atten, lit, nl, 1.0, proj_tc.xy );              final_color += diffuse.rgb * amb_rgb * max(dot(-normalize(lv), n), 0.0);          } -     +          if (spec.a > 0.0)          {              dlit *= min(nl*6.0, 1.0) * dist_atten; @@ -218,7 +218,7 @@ void main()              float gtdenom = 2 * nh;              float gt = max(0, min(gtdenom * nv / vh, gtdenom * nl / vh)); -                                 +              if (nh > 0.0)              {                  float scol = fres*texture(lightFunc, vec2(nh, spec.a)).r*gt/(nh*nl); @@ -226,26 +226,26 @@ void main()                  speccol = clamp(speccol, vec3(0), vec3(1));                  final_color += speccol;              } -        }    +        }          if (envIntensity > 0.0)          {              vec3 ref = reflect(normalize(pos), n); -         +              //project from point pos in direction ref to plane proj_p, proj_n              vec3 pdelta = proj_p-pos;              float ds = dot(ref, proj_n); -         +              if (ds < 0.0)              {                  vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds; -             +                  vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0));                  if (stc.z > 0.0)                  {                      stc /= stc.w; -                                 +                      if (stc.x < 1.0 &&                          stc.y < 1.0 &&                          stc.x > 0.0 && diff --git a/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl index f6b8299f91..61059e2339 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl @@ -43,7 +43,7 @@ void main()      float depth        = getDepth(tc.xy);      if (above_water > 0) -    {  +    {          // we want to depth test when the camera is above water, but some GPUs have a hard time          // with depth testing against render targets that are bound for sampling in the same shader          // so we do it manually here @@ -61,5 +61,5 @@ void main()      vec4 fogged = getWaterFogView(pos.xyz);      frag_color = max(fogged, vec4(0)); //output linear since local lights will be added to this shader's results -     +  } diff --git a/indra/newview/app_settings/shaders/class3/deferred/waterHazeV.glsl b/indra/newview/app_settings/shaders/class3/deferred/waterHazeV.glsl index 16381a5d51..9c2b367158 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/waterHazeV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/waterHazeV.glsl @@ -41,19 +41,19 @@ uniform mat4 modelview_projection_matrix;  void main()  { -	//transform vertex -	vec4 pos = vec4(position.xyz, 1.0); +    //transform vertex +    vec4 pos = vec4(position.xyz, 1.0);      if (above_water > 0)      {          pos = modelview_projection_matrix*pos;      } -    gl_Position = pos;  +    gl_Position = pos;      // appease OSX GLSL compiler/linker by touching all the varyings we said we would      setAtmosAttenuation(vec3(1));      setAdditiveColor(vec3(0)); -	vary_fragcoord = pos; +    vary_fragcoord = pos;  } diff --git a/indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl b/indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl index 223e55eb69..3bf606a252 100644 --- a/indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl +++ b/indra/newview/app_settings/shaders/class3/environment/underWaterF.glsl @@ -4,25 +4,25 @@   * $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_color;  uniform sampler2D diffuseMap; @@ -56,26 +56,26 @@ in vec3 vary_position;  vec4 applyWaterFogViewLinearNoClip(vec3 pos, vec4 color); -void main()  +void main()  { -	vec4 color; +    vec4 color;      //get detail normals -	vec3 wave1 = texture(bumpMap, vec2(refCoord.w, view.w)).xyz*2.0-1.0; -	vec3 wave2 = texture(bumpMap, littleWave.xy).xyz*2.0-1.0; -	vec3 wave3 = texture(bumpMap, littleWave.zw).xyz*2.0-1.0;     -	vec3 wavef = normalize(wave1+wave2+wave3); -	 -	//figure out distortion vector (ripply)    -	vec2 distort = (refCoord.xy/refCoord.z) * 0.5 + 0.5; -	distort = distort+wavef.xy*refScale; +    vec3 wave1 = texture(bumpMap, vec2(refCoord.w, view.w)).xyz*2.0-1.0; +    vec3 wave2 = texture(bumpMap, littleWave.xy).xyz*2.0-1.0; +    vec3 wave3 = texture(bumpMap, littleWave.zw).xyz*2.0-1.0; +    vec3 wavef = normalize(wave1+wave2+wave3); + +    //figure out distortion vector (ripply) +    vec2 distort = (refCoord.xy/refCoord.z) * 0.5 + 0.5; +    distort = distort+wavef.xy*refScale;  #ifdef TRANSPARENT_WATER -	vec4 fb = texture(screenTex, distort); +    vec4 fb = texture(screenTex, distort);  #else      vec4 fb = vec4(waterFogColorLinear, 0.0);  #endif -     +      fb = applyWaterFogViewLinearNoClip(vary_position, fb);      frag_color = max(fb, vec4(0)); diff --git a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl index b364e454e8..88c38c46a2 100644 --- a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl +++ b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl @@ -1,28 +1,28 @@ -/**  +/**   * @file waterF.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$   */ -  +  // class3/environment/waterF.glsl  out vec4 frag_color; @@ -127,7 +127,7 @@ void sampleReflectionProbesWater(inout vec3 ambenv, inout vec3 glossenv,  vec3 getPositionWithNDC(vec3 ndc); -void main()  +void main()  {      vN = vary_normal;      vT = vary_tangent; @@ -157,7 +157,7 @@ void main()      vec3 wave3 = BlendNormal(wave3_a, wave3_b);      vec2 distort = (refCoord.xy/refCoord.z) * 0.5 + 0.5; -      +      //wave1 = transform_normal(wave1);      //wave2 = transform_normal(wave2);      //wave3 = transform_normal(wave3); @@ -168,7 +168,7 @@ void main()      vec3 up = transform_normal(vec3(0,0,1));      float vdu = -dot(viewVec, up)*2; -     +      vec3 wave_ibl = wavef;      wave_ibl.z *= 2.0;      wave_ibl = transform_normal(normalize(wave_ibl)); @@ -182,13 +182,13 @@ void main()      //wavef = vec3(0, 0, 1);      wavef = transform_normal(wavef); -     -	float dist2 = dist; -	dist = max(dist, 5.0); -	 -	float dmod = sqrt(dist); -	 -	//figure out distortion vector (ripply)    + +    float dist2 = dist; +    dist = max(dist, 5.0); + +    float dmod = sqrt(dist); + +    //figure out distortion vector (ripply)      vec2 distort2 = distort + waver.xy * refScale / max(dmod, 1.0);      distort2 = clamp(distort2, vec2(0), vec2(0.999)); @@ -232,7 +232,7 @@ void main()      float metallic = 0.0;      float perceptualRoughness = 0.05;      float gloss      = 1.0 - perceptualRoughness; -     +      vec3  irradiance = vec3(0);      vec3  radiance  = vec3(0);      sampleReflectionProbesWater(irradiance, radiance, distort2, pos.xyz, wave_ibl.xyz, gloss, amblit); @@ -248,7 +248,7 @@ void main()      vec3 colorEmissive = vec3(0);      float ao = 1.0;      vec3 light_dir = transform_normal(lightDir); -     +      perceptualRoughness = 0.0;      metallic = 1.0; @@ -281,7 +281,7 @@ void main()      color = ((1.0 - f) * color) + fb.rgb;      float spec = min(max(max(punctual.r, punctual.g), punctual.b), 0.05); -     +      frag_color = max(vec4(color, spec), vec4(0));  } diff --git a/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl b/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl index 77bbbabfae..8d6b5cf890 100644 --- a/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl +++ b/indra/newview/app_settings/shaders/class3/lighting/lightV.glsl @@ -1,34 +1,34 @@ -/**  +/**   * @file class3\lighting\lightV.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$   */ -  +  // used for preview renders only  vec4 sumLights(vec3 pos, vec3 norm, vec4 color);  vec4 calcLighting(vec3 pos, vec3 norm, vec4 color)  { -	vec4 c = sumLights(pos, norm, color); +    vec4 c = sumLights(pos, norm, color);      return c;  } diff --git a/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl b/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl index c1aee69c30..85b05ca034 100644 --- a/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl +++ b/indra/newview/app_settings/shaders/class3/lighting/sumLightsSpecularV.glsl @@ -4,25 +4,25 @@   * $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$   */ -  +  float calcDirectionalLightSpecular(inout vec4 specular, vec3 view, vec3 n, vec3 l, vec3 lightCol, float da);  vec3 calcPointLightSpecular(inout vec4 specular, vec3 view, vec3 v, vec3 n, vec3 l, float r, float pw, vec3 lightCol); @@ -32,35 +32,35 @@ vec3 atmosGetDiffuseSunlightColor();  vec3 scaleDownLight(vec3 light);  uniform vec4 light_position[8]; -uniform vec4 light_attenuation[8];  +uniform vec4 light_attenuation[8];  uniform vec3 light_diffuse[8];  vec4 sumLightsSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor)  { -	vec4 col = vec4(0.0, 0.0, 0.0, color.a); -	 -	vec3 view = normalize(pos); -	 -	/// collect all the specular values from each calcXXXLightSpecular() function -	vec4 specularSum = vec4(0.0); -	 -	// Collect normal lights (need to be divided by two, as we later multiply by 2) -	col.rgb += light_diffuse[1].rgb * calcDirectionalLightSpecular(specularColor, view, norm, light_position[1].xyz,light_diffuse[1].rgb, 1.0); -	col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[2].xyz, light_attenuation[2].x, light_attenuation[2].y, light_diffuse[2].rgb);  -	col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[3].xyz, light_attenuation[3].x, light_attenuation[3].y, light_diffuse[3].rgb);  -	col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[4].xyz, light_attenuation[4].x, light_attenuation[4].y, light_diffuse[4].rgb);  -	col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[5].xyz, light_attenuation[5].x, light_attenuation[5].y, light_diffuse[5].rgb);  -	col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[6].xyz, light_attenuation[6].x, light_attenuation[6].y, light_diffuse[6].rgb);  -	col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[7].xyz, light_attenuation[7].x, light_attenuation[7].y, light_diffuse[7].rgb);  -	col.rgb = scaleDownLight(col.rgb); -						 -	// Add windlight lights -	col.rgb += atmosAmbient(); -	col.rgb += atmosAffectDirectionalLight(calcDirectionalLightSpecular(specularSum, view, norm, light_position[0].xyz,atmosGetDiffuseSunlightColor(), 1.0)); +    vec4 col = vec4(0.0, 0.0, 0.0, color.a); + +    vec3 view = normalize(pos); + +    /// collect all the specular values from each calcXXXLightSpecular() function +    vec4 specularSum = vec4(0.0); + +    // Collect normal lights (need to be divided by two, as we later multiply by 2) +    col.rgb += light_diffuse[1].rgb * calcDirectionalLightSpecular(specularColor, view, norm, light_position[1].xyz,light_diffuse[1].rgb, 1.0); +    col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[2].xyz, light_attenuation[2].x, light_attenuation[2].y, light_diffuse[2].rgb); +    col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[3].xyz, light_attenuation[3].x, light_attenuation[3].y, light_diffuse[3].rgb); +    col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[4].xyz, light_attenuation[4].x, light_attenuation[4].y, light_diffuse[4].rgb); +    col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[5].xyz, light_attenuation[5].x, light_attenuation[5].y, light_diffuse[5].rgb); +    col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[6].xyz, light_attenuation[6].x, light_attenuation[6].y, light_diffuse[6].rgb); +    col.rgb += calcPointLightSpecular(specularSum, view, pos, norm, light_position[7].xyz, light_attenuation[7].x, light_attenuation[7].y, light_diffuse[7].rgb); +    col.rgb = scaleDownLight(col.rgb); + +    // Add windlight lights +    col.rgb += atmosAmbient(); +    col.rgb += atmosAffectDirectionalLight(calcDirectionalLightSpecular(specularSum, view, norm, light_position[0].xyz,atmosGetDiffuseSunlightColor(), 1.0)); -	col.rgb = min(col.rgb*color.rgb, 1.0); -	specularColor.rgb = min(specularColor.rgb*specularSum.rgb, 1.0); +    col.rgb = min(col.rgb*color.rgb, 1.0); +    specularColor.rgb = min(specularColor.rgb*specularSum.rgb, 1.0); -	col.rgb += specularColor.rgb; -	return col;	 +    col.rgb += specularColor.rgb; +    return col;  } | 
