diff options
| author | Dave Parks <davep@lindenlab.com> | 2022-09-20 19:09:26 -0500 |
|---|---|---|
| committer | Dave Parks <davep@lindenlab.com> | 2022-09-20 19:09:26 -0500 |
| commit | c466e44334fd60c8270b68c70b8ae999b8dbd395 (patch) | |
| tree | 6e5a5e79f9f8af154eee42fb85ed3e1f3c9bb048 /indra/newview/app_settings/shaders/class3 | |
| parent | a66a65e047fb662e35eaaa68de6da9e2786db8ed (diff) | |
SL-18190 Reduce banding (stay in linear space as much as possible, increase precision of reflection probes). Faster radiance and irradiance map generation.
Diffstat (limited to 'indra/newview/app_settings/shaders/class3')
7 files changed, 25 insertions, 16 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl index a04f611440..67f1fc4c18 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl @@ -115,8 +115,8 @@ void main() */ color.a = 1.0; - //color.rgb = linear_to_srgb(color.rgb); + color.rgb = srgb_to_linear(color.rgb); frag_color = color; } diff --git a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl index 7f8536cdab..fcda50c4de 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl @@ -433,9 +433,6 @@ void main() glare = min(glare, 1.0); float al = max(diffcol.a, glare)*vertex_color.a; - //convert to srgb as this color is being written post gamma correction - color = linear_to_srgb(color); - #ifdef WATER_FOG vec4 temp = applyWaterFogView(pos, vec4(color, al)); color = temp.rgb; diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl index 2ee439f61a..6dd446d9f7 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl @@ -95,8 +95,8 @@ void main() if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR)) { - vec3 colorEmissive = spec.rgb; // PBR sRGB Emissive. See: pbropaqueF.glsl - vec3 orm = texture2DRect(emissiveRect, tc).rgb; //orm is packed into "emissiveRect" to keep the data in linear color space + vec3 colorEmissive = texture2DRect(emissiveRect, tc).rgb; + vec3 orm = spec.rgb; float perceptualRoughness = orm.g; float metallic = orm.b; vec3 f0 = vec3(0.04); @@ -134,6 +134,9 @@ void main() float noise = texture2D(noiseMap, tc/128.0).b; + diffuse = srgb_to_linear(diffuse); + spec.rgb = srgb_to_linear(spec.rgb); + // As of OSX 10.6.7 ATI Apple's crash when using a variable size loop for (int i = 0; i < LIGHT_COUNT; ++i) { diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl index 6424e18079..cb8877ebe5 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/multiSpotLightF.glsl @@ -147,8 +147,8 @@ void main() if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR)) { - vec3 colorEmissive = spec.rgb; // PBR sRGB Emissive. See: pbropaqueF.glsl - vec3 orm = texture2DRect(emissiveRect, tc).rgb; //orm is packed into "emissiveRect" to keep the data in linear color space + vec3 colorEmissive = texture2DRect(emissiveRect, tc).rgb; + vec3 orm = spec.rgb; float perceptualRoughness = orm.g; float metallic = orm.b; vec3 f0 = vec3(0.04); @@ -182,6 +182,10 @@ void main() } else { + + diffuse = srgb_to_linear(diffuse); + spec.rgb = srgb_to_linear(spec.rgb); + float noise = texture2D(noiseMap, tc/128.0).b; if (proj_tc.z > 0.0 && proj_tc.x < 1.0 && diff --git a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl index 27fca64ab3..cdffcf103d 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/pointLightF.glsl @@ -99,8 +99,8 @@ void main() if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR)) { - vec3 colorEmissive = spec.rgb; // PBR sRGB Emissive. See: pbropaqueF.glsl - vec3 orm = texture2DRect(emissiveRect, tc).rgb; //orm is packed into "emissiveRect" to keep the data in linear color space + vec3 colorEmissive = texture2DRect(emissiveRect, tc).rgb; + vec3 orm = spec.rgb; float perceptualRoughness = orm.g; float metallic = orm.b; vec3 f0 = vec3(0.04); @@ -121,6 +121,9 @@ void main() discard; } + diffuse = srgb_to_linear(diffuse); + spec.rgb = srgb_to_linear(spec.rgb); + float noise = texture2D(noiseMap, tc/128.0).b; float lit = nl * dist_atten * noise; diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index a8a3b5d33f..5c049b6bd6 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -145,12 +145,12 @@ void main() if (hasPBR) { norm.xyz = getNorm(tc); - vec3 orm = texture2DRect(emissiveRect, tc).rgb; //orm is packed into "emissiveRect" to keep the data in linear color space + vec3 orm = texture2DRect(specularRect, tc).rgb; float perceptualRoughness = orm.g; float metallic = orm.b; float ao = orm.r * ambocc; - vec3 colorEmissive = texture2DRect(specularRect, tc).rgb; //specularRect is sRGB sampler, result is in linear space + vec3 colorEmissive = texture2DRect(emissiveRect, tc).rgb; // PBR IBL float gloss = 1.0 - perceptualRoughness; @@ -165,7 +165,6 @@ void main() //baseColor.rgb = vec3(0,0,0); //colorEmissive = srgb_to_linear(norm.xyz*0.5+0.5); - vec3 diffuseColor = baseColor.rgb*(vec3(1.0)-f0); diffuseColor *= 1.0 - metallic; @@ -195,7 +194,7 @@ void main() float da = clamp(dot(norm.xyz, light_dir.xyz), 0.0, 1.0); da = pow(da, light_gamma); - diffuse.rgb = linear_to_srgb(diffuse.rgb); // SL-14035 + //diffuse.rgb = linear_to_srgb(diffuse.rgb); // SL-14035 sampleReflectionProbes(ambenv, glossenv, legacyenv, pos.xyz, norm.xyz, spec.a, envIntensity); ambenv.rgb = linear_to_srgb(ambenv.rgb); diff --git a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl index c8d45eb429..3274153a46 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/spotLightF.glsl @@ -154,8 +154,8 @@ void main() vec3 amb_rgb = vec3(0); if (GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR)) { - vec3 colorEmissive = spec.rgb; // PBR sRGB Emissive. See: pbropaqueF.glsl - vec3 orm = texture2DRect(emissiveRect, tc).rgb; //orm is packed into "emissiveRect" to keep the data in linear color space + vec3 colorEmissive = texture2DRect(emissiveRect, tc).rgb; + vec3 orm = spec.rgb; float perceptualRoughness = orm.g; float metallic = orm.b; vec3 f0 = vec3(0.04); @@ -189,6 +189,9 @@ void main() } else { + diffuse = srgb_to_linear(diffuse); + spec.rgb = srgb_to_linear(spec.rgb); + float noise = texture2D(noiseMap, tc/128.0).b; if (proj_tc.z > 0.0 && proj_tc.x < 1.0 && |
