diff options
author | Dave Parks <davep@lindenlab.com> | 2022-09-28 16:49:11 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2022-09-28 16:49:11 -0500 |
commit | f887f65830c05d15517cbd8f15ca0e59210dfbee (patch) | |
tree | ea68a0c48699a965e3f28b781c38d497bac4e0a3 /indra/newview/app_settings/shaders/class3 | |
parent | a63fcfc9d584075bb263ccf10857852b3327be43 (diff) |
SL-18190 WIP - Linear space atmospherics take 2
Diffstat (limited to 'indra/newview/app_settings/shaders/class3')
-rw-r--r-- | indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl | 4 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl | 21 |
2 files changed, 14 insertions, 11 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl index de18251dc4..a1125cc1dd 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl @@ -551,7 +551,7 @@ void applyGlossEnv(inout vec3 color, vec3 glossenv, vec4 spec, vec3 pos, vec3 no fresnel *= spec.a; glossenv *= spec.rgb*fresnel; glossenv *= vec3(1.0) - color; // fake energy conservation - color.rgb += glossenv; + color.rgb += glossenv*0.5; } void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3 norm, float envIntensity) @@ -562,6 +562,6 @@ void applyGlossEnv(inout vec3 color, vec3 glossenv, vec4 spec, vec3 pos, vec3 no fresnel *= fresnel; fresnel = min(fresnel+envIntensity, 1.0); reflected_color *= (envIntensity*fresnel); - color = mix(color.rgb, reflected_color, envIntensity); + color = mix(color.rgb, reflected_color*0.5, envIntensity); } diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index c7ec1ddde9..1795f3fd1a 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -140,8 +140,7 @@ void main() vec3 glossenv; vec3 legacyenv; - bool hasPBR = GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR); - if (hasPBR) + if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR)) { norm.xyz = getNorm(tc); vec3 orm = texture2DRect(specularRect, tc).rgb; @@ -157,7 +156,7 @@ void main() vec3 radiance = vec3(0); sampleReflectionProbes(irradiance, radiance, pos.xyz, norm.xyz, gloss); - irradiance = max(amblit*ao,irradiance); + irradiance = max(amblit*2.0*ao,irradiance); vec3 f0 = vec3(0.04); vec3 baseColor = diffuse.rgb; @@ -170,13 +169,19 @@ void main() vec3 v = -normalize(pos.xyz); float NdotV = clamp(abs(dot(norm.xyz, v)), 0.001, 1.0); - color.rgb += pbrIbl(diffuseColor, specularColor, radiance, irradiance, ao, NdotV, perceptualRoughness); color.rgb += pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, norm.xyz, v, normalize(light_dir)) * sunlit*2.75 * scol; color.rgb += colorEmissive; + + color.rgb += pbrIbl(diffuseColor, specularColor, radiance, irradiance, ao, NdotV, perceptualRoughness); color = atmosFragLightingLinear(color, additive, atten); color = scaleSoftClipFragLinear(color); } + else if (!GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_ATMOS)) + { + //should only be true of WL sky, just port over diffuse value + color = srgb_to_linear(diffuse.rgb); + } else { // legacy shaders are still writng sRGB to gbuffer @@ -223,12 +228,10 @@ void main() if (envIntensity > 0.0) { // add environment map applyLegacyEnv(color, legacyenv, spec, pos.xyz, norm.xyz, envIntensity); - } - if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_ATMOS)) - { - color = mix(atmosFragLightingLinear(color, additive, atten), fullbrightAtmosTransportFragLinear(color, additive, atten), diffuse.a); - color = scaleSoftClipFragLinear(color); } + + color = mix(atmosFragLightingLinear(color, additive, atten), fullbrightAtmosTransportFragLinear(color, additive, atten), diffuse.a); + color = scaleSoftClipFragLinear(color); } #ifdef WATER_FOG |