From e8114dbe14cc71664f6a27bbe727ff8c25fbc643 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 30 Mar 2023 14:53:01 -0500 Subject: SL-19517 Fix for RenderReflectionProbeCount other than 256 causing black reflections. --- .../app_settings/shaders/class3/deferred/reflectionProbeF.glsl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'indra/newview/app_settings/shaders/class3') diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl index 7a5676e0ab..ec7a2f4768 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl @@ -35,6 +35,8 @@ uniform sampler2D sceneMap; uniform int cube_snapshot; uniform float max_probe_lod; +#define MAX_REFMAP_COUNT 256 // must match LL_MAX_REFLECTION_PROBE_COUNT + layout (std140) uniform ReflectionProbes { // list of OBBs for user override probes @@ -42,18 +44,18 @@ layout (std140) uniform ReflectionProbes // for each box refBox[i]... /// box[0..2] - plane 0 .. 2 in [A,B,C,D] notation // box[3][0..2] - plane thickness - mat4 refBox[REFMAP_COUNT]; + mat4 refBox[MAX_REFMAP_COUNT]; // list of bounding spheres for reflection probes sorted by distance to camera (closest first) - vec4 refSphere[REFMAP_COUNT]; + vec4 refSphere[MAX_REFMAP_COUNT]; // extra parameters (currently only .x used for probe ambiance) - vec4 refParams[REFMAP_COUNT]; + vec4 refParams[MAX_REFMAP_COUNT]; // index of cube map in reflectionProbes for a corresponding reflection probe // e.g. cube map channel of refSphere[2] is stored in refIndex[2] // refIndex.x - cubemap channel in reflectionProbes // refIndex.y - index in refNeighbor of neighbor list (index is ivec4 index, not int index) // refIndex.z - number of neighbors // refIndex.w - priority, if negative, this probe has a box influence - ivec4 refIndex[REFMAP_COUNT]; + ivec4 refIndex[MAX_REFMAP_COUNT]; // neighbor list data (refSphere indices, not cubemap array layer) ivec4 refNeighbor[1024]; -- cgit v1.2.3 From 70bdf55439a57116cbd2c9bb32e78a8ada251d78 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 30 Mar 2023 16:24:04 -0500 Subject: SL-19517 Followup -- fix broken fallback probe. Adjust water brightness. --- .../newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/app_settings/shaders/class3') diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl index ec7a2f4768..94c40b1fa0 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl @@ -676,7 +676,7 @@ void sampleReflectionProbesWater(inout vec3 ambenv, inout vec3 glossenv, sampleReflectionProbes(ambenv, glossenv, tc, pos, norm, glossiness); // fudge factor to get PBR water at a similar luminance ot legacy water - glossenv *= 0.25; + glossenv *= 0.5; } void debugTapRefMap(vec3 pos, vec3 dir, float depth, int i, inout vec4 col) -- cgit v1.2.3 From 46702c4e80e96cd8dbe7f37d5c14fbb1830e798d Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 30 Mar 2023 18:19:32 -0500 Subject: DRTVWR-559 Auto exposure tuning. --- .../newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl | 2 +- indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/app_settings/shaders/class3') diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl index 94c40b1fa0..677d83a1fe 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl @@ -676,7 +676,7 @@ void sampleReflectionProbesWater(inout vec3 ambenv, inout vec3 glossenv, sampleReflectionProbes(ambenv, glossenv, tc, pos, norm, glossiness); // fudge factor to get PBR water at a similar luminance ot legacy water - glossenv *= 0.5; + glossenv *= 0.4; } void debugTapRefMap(vec3 pos, vec3 dir, float depth, int i, inout vec4 col) diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index 0e3ebd1534..b23741e574 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -212,6 +212,7 @@ void main() { //should only be true of WL sky, just port over base color value color = srgb_to_linear(texture2D(emissiveRect, tc).rgb); + color *= sun_up_factor + 1.0; } else { -- cgit v1.2.3 From c0958922c3b3015fd7f17781a79032050b2ed387 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 30 Mar 2023 18:41:34 -0500 Subject: DRTVWR-559 Auto exposure tuning (fix horizon). --- indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/app_settings/shaders/class3') diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index b23741e574..0e3ebd1534 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -212,7 +212,6 @@ void main() { //should only be true of WL sky, just port over base color value color = srgb_to_linear(texture2D(emissiveRect, tc).rgb); - color *= sun_up_factor + 1.0; } else { -- cgit v1.2.3 From 0fe09bd968b987605123e99efb2fa040a988a942 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 31 Mar 2023 11:57:21 -0500 Subject: SL-19485 Fix for sun shadows having no effect on water. Make sphere probes fade in. --- .../shaders/class3/deferred/reflectionProbeF.glsl | 6 ++++-- .../app_settings/shaders/class3/environment/waterF.glsl | 15 ++++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) (limited to 'indra/newview/app_settings/shaders/class3') diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl index 677d83a1fe..e73e396b8e 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl @@ -433,13 +433,15 @@ void boxIntersectDebug(vec3 origin, vec3 pos, int i, inout vec4 col) // dw - distance weight float sphereWeight(vec3 pos, vec3 dir, vec3 origin, float r, int i, out float dw) { - float r1 = r * 0.5; // 50% of radius (outer sphere to start interpolating down) + float r1 = r * 0.5; // 50% of radius (outer sphere to start interpolating down) vec3 delta = pos.xyz - origin; float d2 = max(length(delta), 0.001); float atten = 1.0 - max(d2 - r1, 0.0) / max((r - r1), 0.001); float w = 1.0 / d2; - + + w *= refParams[i].z; + dw = w * atten * max(r, 1.0)*4; w *= atten; diff --git a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl index 7524567f6b..9da86759c9 100644 --- a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl +++ b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl @@ -25,10 +25,10 @@ // class3/environment/waterF.glsl -#ifdef DEFINE_GL_FRAGCOLOR out vec4 frag_color; -#else -#define frag_color gl_FragColor + +#ifdef HAS_SUN_SHADOW +float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen); #endif vec3 scaleSoftClipFragLinear(vec3 l); @@ -199,6 +199,12 @@ void main() vec3 additive; vec3 atten; + float shadow = 1.0f; + +#ifdef HAS_SUN_SHADOW + shadow = sampleDirectionalShadow(pos.xyz, norm.xyz, distort); +#endif + calcAtmosphericVarsLinear(pos.xyz, wavef, vary_light_dir, sunlit, amblit, additive, atten); vec3 sunlit_linear = srgb_to_linear(sunlit); @@ -241,7 +247,6 @@ void main() vec3 v = -normalize(pos.xyz); - float scol = 1.0; vec3 colorEmissive = vec3(0); float ao = 1.0; vec3 light_dir = transform_normal(lightDir); @@ -253,7 +258,7 @@ void main() vec3 punctual = pbrPunctual(vec3(0), specularColor, 0.1, metallic, normalize(wavef+up*max(dist, 32.0)/32.0*(1.0-vdu)), v, normalize(light_dir)); - vec3 color = punctual * sunlit_linear * 2.75 * scol; + vec3 color = punctual * sunlit_linear * 2.75 * shadow; vec3 ibl = pbrIbl(vec3(0), vec3(1), radiance, vec3(0), ao, NdotV, 0.0); -- cgit v1.2.3