diff options
Diffstat (limited to 'indra/newview/app_settings/shaders/class2/deferred')
3 files changed, 25 insertions, 21 deletions
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl index 7357e27117..bc13e7d1ec 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl @@ -36,6 +36,7 @@ out vec4 frag_color; uniform mat3 env_mat; uniform vec3 sun_dir; uniform vec3 moon_dir; +uniform int classic_mode; #ifdef USE_DIFFUSE_TEX uniform sampler2D diffuseMap; @@ -241,10 +242,10 @@ void main() calcAtmosphericVarsLinear(pos.xyz, norm, light_dir, sunlit, amblit, additive, atten); - vec3 sunlit_linear = srgb_to_linear(sunlit); + vec3 sunlit_linear = sunlit; vec3 amblit_linear = amblit; - vec3 irradiance; + vec3 irradiance = amblit; vec3 glossenv; vec3 legacyenv; sampleReflectionProbesLegacy(irradiance, glossenv, legacyenv, frag, pos.xyz, norm.xyz, 0.0, 0.0, true, amblit_linear); @@ -260,11 +261,20 @@ void main() color.a = final_alpha; - vec3 sun_contrib = min(final_da, shadow) * sunlit_linear; - color.rgb = irradiance; + if (classic_mode > 0) + { + final_da = pow(final_da,1.2); + vec3 sun_contrib = vec3(min(final_da, shadow)); - color.rgb += sun_contrib; + color.rgb = srgb_to_linear(color.rgb * 0.9 + linear_to_srgb(sun_contrib) * sunlit_linear * 0.7); + sunlit_linear = srgb_to_linear(sunlit_linear); + } + else + { + vec3 sun_contrib = min(final_da, shadow) * sunlit_linear; + color.rgb += sun_contrib; + } color.rgb *= diffuse_linear.rgb; diff --git a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl index f4a8051427..cec844559f 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl @@ -111,13 +111,6 @@ vec3 pbrBaseLight(vec3 diffuseColor, vec3 additive, vec3 atten); -vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, - float perceptualRoughness, - float metallic, - vec3 n, // normal - vec3 v, // surface point to camera - vec3 l); //surface point to light - vec3 pbrCalcPointLightOrSpotLight(vec3 diffuseColor, vec3 specularColor, float perceptualRoughness, float metallic, @@ -168,7 +161,7 @@ void main() vec3 atten; calcAtmosphericVarsLinear(pos.xyz, norm, light_dir, sunlit, amblit, additive, atten); - vec3 sunlit_linear = srgb_to_linear(sunlit); + vec3 sunlit_linear = sunlit; vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5; @@ -189,7 +182,7 @@ void main() // PBR IBL float gloss = 1.0 - perceptualRoughness; - vec3 irradiance = vec3(0); + vec3 irradiance = amblit; vec3 radiance = vec3(0); sampleReflectionProbes(irradiance, radiance, vary_position.xy*0.5+0.5, pos.xyz, norm.xyz, gloss, true, amblit); diff --git a/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl index 35848ff4cd..2657b2b54e 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl @@ -32,12 +32,13 @@ uniform samplerCube environmentMap; uniform mat3 env_mat; vec3 srgb_to_linear(vec3 c); +vec3 linear_to_srgb(vec3 c); void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv, vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent, vec3 amblit_linear) { - ambenv = vec3(reflection_probe_ambiance * 0.25); - + ambenv = mix(ambenv, vec3(reflection_probe_ambiance * 0.25), reflection_probe_ambiance); + vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); vec3 env_vec = env_mat * refnormpersp; glossenv = srgb_to_linear(texture(environmentMap, env_vec).rgb); @@ -58,23 +59,23 @@ vec4 sampleReflectionProbesDebug(vec3 pos) void sampleReflectionProbesLegacy(out vec3 ambenv, out vec3 glossenv, out vec3 legacyenv, vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit_linear) { - ambenv = vec3(reflection_probe_ambiance * 0.25); - + ambenv = mix(ambenv, vec3(reflection_probe_ambiance * 0.25), reflection_probe_ambiance); + vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); vec3 env_vec = env_mat * refnormpersp; - legacyenv = srgb_to_linear(texture(environmentMap, env_vec).rgb); + legacyenv = texture(environmentMap, env_vec).rgb; glossenv = legacyenv; } void applyGlossEnv(inout vec3 color, vec3 glossenv, vec4 spec, vec3 pos, vec3 norm) { - + } void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3 norm, float envIntensity) { - color = mix(color.rgb, legacyenv*1.5, envIntensity); + color = srgb_to_linear(mix(linear_to_srgb(color.rgb), legacyenv*2.0, envIntensity)); } |