diff options
author | Rye Mutt <rye@alchemyviewer.org> | 2023-05-25 16:09:22 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-25 15:09:22 -0500 |
commit | cbd17fce86cc30434d6d665338a7d771bddcad8b (patch) | |
tree | 91682cafd5e23d83e1071b6736528b8fefe2a626 /indra/newview/app_settings/shaders/class2 | |
parent | c12712aa9609325ba3247a67354e91e9342106d6 (diff) |
Fix underwater fog mismatch between opaque and alpha blend when local lights are nearby (#227)
* Fix water fog mismatch between alpha blend and opaque when local light is nearby
* Add PBR underwater alpha blend shader
Diffstat (limited to 'indra/newview/app_settings/shaders/class2')
-rw-r--r-- | indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl | 9 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl | 9 |
2 files changed, 13 insertions, 5 deletions
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl index ae8cd97b18..cd57b47eae 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl @@ -274,6 +274,10 @@ void main() color.rgb = atmosFragLightingLinear(color.rgb, additive, atten); +#ifdef WATER_FOG + color = applyWaterFogViewLinear(pos.xyz, color, sunlit_linear); +#endif // WATER_FOG + vec4 light = vec4(0,0,0,0); #define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, diffuse_linear.rgb, pos.xyz, norm, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, light_attenuation[i].w); @@ -291,11 +295,6 @@ void main() color.rgb += light.rgb; #endif // !defined(LOCAL_LIGHT_KILL) - -#ifdef WATER_FOG - color = applyWaterFogViewLinear(pos.xyz, color, sunlit_linear); -#endif // WATER_FOG - #endif // #else // FOR_IMPOSTOR #ifdef IS_HUD diff --git a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl index e6aef7abdc..9ac106149e 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl @@ -84,6 +84,10 @@ vec3 linear_to_srgb(vec3 c); void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive); vec3 atmosFragLightingLinear(vec3 color, vec3 additive, vec3 atten); +#ifdef WATER_FOG +vec4 applyWaterFogViewLinear(vec3 pos, vec4 color, vec3 sunlit); +#endif + void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float nh, out float nl, out float nv, out float vh, out float lightDist); float calcLegacyDistanceAttenuation(float distance, float falloff); float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen); @@ -237,6 +241,11 @@ void main() color.rgb = atmosFragLightingLinear(color.rgb, additive, atten); +#ifdef WATER_FOG + vec4 temp = applyWaterFogViewLinear(pos, vec4(color, 0.0), sunlit_linear); + color = temp.rgb; +#endif + vec3 light = vec3(0); // Punctual lights |