diff options
| author | Jonathan "Geenz" Goodman <geenz@lindenlab.com> | 2025-02-07 05:55:47 -0500 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-07 05:55:47 -0500 | 
| commit | 93a88e602545828c0298b20ff0375f191d1f6d9a (patch) | |
| tree | cb098bfa5eeb4b0d784a9ed6aec3b5fe7f1a0245 /indra/newview/app_settings/shaders/class3/deferred | |
| parent | 317cd6e66e65256eda6441c06fa32e55eee99fa3 (diff) | |
Water Exclusion Surfaces (#3517)
* #3455 Add support for water exclusion surfaces
Diffstat (limited to 'indra/newview/app_settings/shaders/class3/deferred')
| -rw-r--r-- | indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl | 14 | 
1 files changed, 14 insertions, 0 deletions
| diff --git a/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl index ee49b4baae..091c25d15e 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/waterHazeF.glsl @@ -35,13 +35,25 @@ vec4 getWaterFogView(vec3 pos);  uniform int above_water; +uniform sampler2D exclusionTex; +  void main()  {      vec2  tc           = vary_fragcoord.xy/vary_fragcoord.w*0.5+0.5;      float depth        = getDepth(tc.xy); +    float mask = texture(exclusionTex, tc.xy).r;      if (above_water > 0)      { +        // Just discard if we're in the exclusion mask. +        // The previous invisiprim hack we're replacing would also crank up water fog desntiy. +        // But doing that makes exclusion surfaces very slow as we'd need to render even more into the mask. +        // - Geenz 2025-02-06 +        if (mask < 1) +        { +            discard; +        } +          // 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 @@ -51,12 +63,14 @@ void main()          {              discard;          } +      }      vec4  pos          = getPositionWithDepth(tc, depth);      vec4 fogged = getWaterFogView(pos.xyz);      fogged.a = max(pow(fogged.a, 1.7), 0); +      frag_color = max(fogged, vec4(0)); //output linear since local lights will be added to this shader's results  } | 
