diff options
author | Jonathan "Geenz" Goodman <geenz@geenzo.com> | 2023-09-25 09:27:49 -0700 |
---|---|---|
committer | Jonathan "Geenz" Goodman <geenz@geenzo.com> | 2023-09-25 09:27:49 -0700 |
commit | 73870cb0b41144dc9932947d13d6aa27952d8849 (patch) | |
tree | f712491a5baffb2e7be797d4d9110602687865d8 /indra/newview/app_settings/shaders/class3 | |
parent | 3ff3e1a3537a5d051180aaf6223f5ddd8b540d35 (diff) | |
parent | 3da26ee8df6cc7e57ba3acbb91437ec97e151002 (diff) |
Merge branch 'DRTVWR-559' into DRTVWR-583
Diffstat (limited to 'indra/newview/app_settings/shaders/class3')
5 files changed, 32 insertions, 30 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl index 1537714bb7..54a887262b 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl @@ -49,7 +49,7 @@ vec3 srgb_to_linear(vec3 c); // reflection probe interface void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent); + vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit_linear); void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3 norm, float envIntensity); @@ -80,7 +80,7 @@ void main() vec3 legacyenv; vec3 norm = normalize(vary_texcoord1.xyz); vec4 spec = vec4(0,0,0,0); - sampleReflectionProbesLegacy(ambenv, glossenv, legacyenv, vec2(0), pos.xyz, norm.xyz, spec.a, env_intensity, false); + sampleReflectionProbesLegacy(ambenv, glossenv, legacyenv, vec2(0), pos.xyz, norm.xyz, spec.a, env_intensity, false, amblit); color.rgb = legacy_adjust(color.rgb); color.rgb = srgb_to_linear(color.rgb); diff --git a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl index 82e2de0c0f..319f2f25b7 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl @@ -60,7 +60,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen); #endif void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent); + vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit_linear); 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); @@ -339,10 +339,9 @@ void main() vec3 ambenv; vec3 glossenv; vec3 legacyenv; - sampleReflectionProbesLegacy(ambenv, glossenv, legacyenv, pos.xy*0.5+0.5, pos.xyz, norm.xyz, glossiness, env, true); + sampleReflectionProbesLegacy(ambenv, glossenv, legacyenv, pos.xy*0.5+0.5, pos.xyz, norm.xyz, glossiness, env, true, amblit_linear); - // use sky settings ambient or irradiance map sample, whichever is brighter - color = max(amblit_linear, ambenv); + color = ambenv; float da = clamp(dot(norm.xyz, light_dir.xyz), 0.0, 1.0); vec3 sun_contrib = min(da, shadow) * sunlit_linear; diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl index 549ac50280..d9dc83bb10 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl @@ -531,7 +531,7 @@ vec3 tapRefMap(vec3 pos, vec3 dir, out float w, out float dw, float lod, vec3 c, // w - weight of sample (distance and angular attenuation) // dw - weight of sample (distance only) // i - index of probe -vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int i) +vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int i, vec3 amblit) { // parallax adjustment vec3 v; @@ -557,9 +557,12 @@ vec3 tapIrradianceMap(vec3 pos, vec3 dir, out float w, out float dw, vec3 c, int v -= c; v = env_mat * v; - { - return textureLod(irradianceProbes, vec4(v.xyz, refIndex[i].x), 0).rgb * refParams[i].x; - } + + vec3 col = textureLod(irradianceProbes, vec4(v.xyz, refIndex[i].x), 0).rgb * refParams[i].x; + + col = mix(amblit, col, min(refParams[i].x, 1.0)); + + return col; } vec3 sampleProbes(vec3 pos, vec3 dir, float lod) @@ -620,7 +623,7 @@ vec3 sampleProbes(vec3 pos, vec3 dir, float lod) return col[1]+col[0]; } -vec3 sampleProbeAmbient(vec3 pos, vec3 dir) +vec3 sampleProbeAmbient(vec3 pos, vec3 dir, vec3 amblit) { // modified copy/paste of sampleProbes follows, will likely diverge from sampleProbes further // as irradiance map mixing is tuned independently of radiance map mixing @@ -650,7 +653,7 @@ vec3 sampleProbeAmbient(vec3 pos, vec3 dir) float w = 0; float dw = 0; - vec3 refcol = tapIrradianceMap(pos, dir, w, dw, refSphere[i].xyz, i); + vec3 refcol = tapIrradianceMap(pos, dir, w, dw, refSphere[i].xyz, i, amblit); col[p] += refcol*w; wsum[p] += w; @@ -680,14 +683,14 @@ vec3 sampleProbeAmbient(vec3 pos, vec3 dir) } void doProbeSample(inout vec3 ambenv, inout vec3 glossenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent) + vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent, vec3 amblit) { // TODO - don't hard code lods float reflection_lods = max_probe_lod; vec3 refnormpersp = reflect(pos.xyz, norm.xyz); - ambenv = sampleProbeAmbient(pos, norm); + ambenv = sampleProbeAmbient(pos, norm, amblit); float lod = (1.0-glossiness)*reflection_lods; glossenv = sampleProbes(pos, normalize(refnormpersp), lod); @@ -713,14 +716,14 @@ void doProbeSample(inout vec3 ambenv, inout vec3 glossenv, } void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent) + vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent, vec3 amblit) { preProbeSample(pos); - doProbeSample(ambenv, glossenv, tc, pos, norm, glossiness, transparent); + doProbeSample(ambenv, glossenv, tc, pos, norm, glossiness, transparent, amblit); } void sampleReflectionProbesWater(inout vec3 ambenv, inout vec3 glossenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness) + vec2 tc, vec3 pos, vec3 norm, float glossiness, vec3 amblit) { // don't sample automatic probes for water sample_automatic = false; @@ -729,7 +732,7 @@ void sampleReflectionProbesWater(inout vec3 ambenv, inout vec3 glossenv, // always include void probe on water probeIndex[probeInfluences++] = 0; - doProbeSample(ambenv, glossenv, tc, pos, norm, glossiness, false); + doProbeSample(ambenv, glossenv, tc, pos, norm, glossiness, false, amblit); // fudge factor to get PBR water at a similar luminance ot legacy water glossenv *= 0.4; @@ -784,14 +787,14 @@ vec4 sampleReflectionProbesDebug(vec3 pos) } void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent) + vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit) { float reflection_lods = max_probe_lod; preProbeSample(pos); vec3 refnormpersp = reflect(pos.xyz, norm.xyz); - ambenv = sampleProbeAmbient(pos, norm); + ambenv = sampleProbeAmbient(pos, norm, amblit); if (glossiness > 0.0) { diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index 2483355205..20a5ad66b6 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -77,9 +77,9 @@ vec3 scaleSoftClipFragLinear(vec3 l); // reflection probe interface void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent); + vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent, vec3 amblit_linear); void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent); + vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit_linear); 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); float getDepth(vec2 pos_screen); @@ -125,10 +125,10 @@ vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor, vec3 l); //surface point to light -void adjustIrradiance(inout vec3 irradiance, vec3 amblit_linear, float ambocc) +void adjustIrradiance(inout vec3 irradiance, float ambocc) { // use sky settings ambient or irradiance map sample, whichever is brighter - irradiance = max(amblit_linear, irradiance); + //irradiance = max(amblit_linear, irradiance); #if defined(HAS_SSAO) irradiance = mix(ssao_effect_mat * min(irradiance.rgb*ssao_irradiance_scale, vec3(ssao_irradiance_max)), irradiance.rgb, ambocc); @@ -202,9 +202,9 @@ void main() // PBR IBL float gloss = 1.0 - perceptualRoughness; - sampleReflectionProbes(irradiance, radiance, tc, pos.xyz, norm.xyz, gloss, false); + sampleReflectionProbes(irradiance, radiance, tc, pos.xyz, norm.xyz, gloss, false, amblit_linear); - adjustIrradiance(irradiance, amblit_linear, ambocc); + adjustIrradiance(irradiance, ambocc); vec3 diffuseColor; vec3 specularColor; @@ -244,9 +244,9 @@ void main() vec3 glossenv = vec3(0); vec3 legacyenv = vec3(0); - sampleReflectionProbesLegacy(irradiance, glossenv, legacyenv, tc, pos.xyz, norm.xyz, spec.a, envIntensity, false); + sampleReflectionProbesLegacy(irradiance, glossenv, legacyenv, tc, pos.xyz, norm.xyz, spec.a, envIntensity, false, amblit_linear); - adjustIrradiance(irradiance, amblit_linear, ambocc); + adjustIrradiance(irradiance, ambocc); // apply lambertian IBL only (see pbrIbl) color.rgb = irradiance; diff --git a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl index 8fee259933..4f79dd1ac5 100644 --- a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl +++ b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl @@ -124,7 +124,7 @@ vec3 transform_normal(vec3 vNt) } void sampleReflectionProbesWater(inout vec3 ambenv, inout vec3 glossenv, - vec2 tc, vec3 pos, vec3 norm, float glossiness); + vec2 tc, vec3 pos, vec3 norm, float glossiness, vec3 amblit_linear); vec3 getPositionWithNDC(vec3 ndc); @@ -237,7 +237,7 @@ void main() vec3 irradiance = vec3(0); vec3 radiance = vec3(0); - sampleReflectionProbesWater(irradiance, radiance, distort2, pos.xyz, wave_ibl.xyz, gloss); + sampleReflectionProbesWater(irradiance, radiance, distort2, pos.xyz, wave_ibl.xyz, gloss, amblit); irradiance = vec3(0); |