summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoward Stearns <howard.stearns@gmail.com>2022-08-29 10:17:09 -0700
committerHoward Stearns <howard.stearns@gmail.com>2022-08-29 10:17:09 -0700
commit6c4ff3f9c8dc51f5fc18a5ef34fed7a4063d37fa (patch)
tree40c2cc9157864c4bdd0b3da534b5753f0b2d9cb9
parent1b5c13fd446dbf9193aca9baa66f62edb1393875 (diff)
parentd6e8a6c98aa426e8f1ee92cd7bc65703cf0a22aa (diff)
Merge branch 'DRTVWR-559' of bitbucket.org:lindenlab/viewer into SL-17967
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl5
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl33
3 files changed, 24 insertions, 17 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
index c4d1e7d1a7..449cbeaa28 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
@@ -52,6 +52,9 @@ float calcLegacyDistanceAttenuation(float distance, float falloff)
{
float dist_atten = 1.0 - clamp((distance + falloff)/(1.0 + falloff), 0.0, 1.0);
dist_atten *= dist_atten;
+
+ // Tweak falloff slightly to match pre-EEP attenuation
+ // NOTE: this magic number also shows up in a great many other places, search for dist_atten *= to audit
dist_atten *= 2.0;
return dist_atten;
}
@@ -303,7 +306,7 @@ vec2 getScreenXY(vec4 clip)
// Color utils
-vec3 colorized_dot(float x)
+vec3 colorize_dot(float x)
{
if (x > 0.0) return vec3( 0, x, 0 );
if (x < 0.0) return vec3(-x, 0, 0 );
diff --git a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl
index 91d041cafa..71135786c3 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/multiPointLightF.glsl
@@ -68,6 +68,9 @@ vec2 getScreenXY(vec4 clip);
void initMaterial( vec3 diffuse, vec3 packedORM, out float alphaRough, out vec3 c_diff, out vec3 reflect0, out vec3 reflect90, out float specWeight );
vec3 srgb_to_linear(vec3 c);
+// Util
+vec3 hue_to_rgb(float hue);
+
void main()
{
#if defined(LOCAL_LIGHT_KILL)
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
index 01ed71d45d..8a04a8a6a6 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
@@ -188,6 +188,7 @@ vec3 srgb_to_linear(vec3 c);
// Debug Utils
vec3 BRDFDiffuse(vec3 color);
+vec3 colorize_dot(float x);
vec3 fresnelSchlick( vec3 reflect0, vec3 reflect90, float vh);
float D_GGX( float nh, float alphaRough );
float V_GGX( float nl, float nv, float alphaRough );
@@ -288,9 +289,12 @@ void main()
vec3 b = cross( n,t);
vec3 reflectVN = normalize(reflect(-v,n));
- float dotNV = clamp(dot(n,v),0,1);
- float dotTV = clamp(dot(t,v),0,1);
- float dotBV = clamp(dot(b,v),0,1);
+ vec3 h, l;
+ float nh, nl, nv, vh, lightDist;
+ calcHalfVectors(light_dir, n, v, h, l, nh, nl, nv, vh, lightDist);
+
+ float tv = clamp(dot(t,v),0,1);
+ float bv = clamp(dot(b,v),0,1);
// Reference: getMetallicRoughnessInfo
vec3 base = linear_to_srgb(diffuse.rgb);
@@ -303,10 +307,10 @@ void main()
#endif
// Common to RadianceGGX and RadianceLambertian
- vec2 brdfPoint = clamp(vec2(dotNV, perceptualRough), vec2(0,0), vec2(1,1));
+ vec2 brdfPoint = clamp(vec2(nv, perceptualRough), vec2(0,0), vec2(1,1));
vec2 vScaleBias = getGGX( brdfPoint); // Environment BRDF: scale and bias applied to reflect0
vec3 fresnelR = max(vec3(1.0 - perceptualRough), reflect0) - reflect0; // roughness dependent fresnel
- vec3 kSpec = reflect0 + fresnelR*pow(1.0 - dotNV, 5.0);
+ vec3 kSpec = reflect0 + fresnelR*pow(1.0 - nv, 5.0);
// Reference: getIBLRadianceGGX
// https://forum.substance3d.com/index.php?topic=3243.0
@@ -351,21 +355,18 @@ void main()
colorSpec *= ao;
// Add in sun/moon reflection
- vec3 h, l;
- float nh, nl, nv, vh, lightDist;
- calcHalfVectors(light_dir, n, v, h, l, nh, nl, nv, vh, lightDist);
-
if (nl > 0.0 || nv > 0.0)
{
- vec3 sunColor = srgb_to_linear(sunlit * 2.0); // NOTE: *2.0 Midday should have strong sunlight
+ float scale = 4.9;
+ vec3 sunColor = srgb_to_linear(sunlit * scale); // NOTE: Midday should have strong sunlight
#if DEBUG_PBR_SUN_FULL_BRIGHT
sunColor = vec3(1);
#endif
// scol = sun shadow
vec3 intensity = ambocc * sunColor * nl * scol;
- vec3 sunDiffuse = intensity * BRDFLambertian (reflect0, reflect90, c_diff , specWeight, vh);
- vec3 sunSpec = intensity * BRDFSpecularGGX(reflect0, reflect90, alphaRough, specWeight, vh, nl, nv, nh);
- bloom = dot(sunSpec, sunSpec) / 8.0;
+ vec3 sunDiffuse = base * intensity * BRDFLambertian (reflect0, reflect90, c_diff , specWeight, vh);
+ vec3 sunSpec = intensity * BRDFSpecularGGX(reflect0, reflect90, alphaRough, specWeight, vh, nl, nv, nh);
+ bloom = dot(sunSpec, sunSpec) / (scale * scale * scale);
#if DEBUG_PBR_SUN_SPEC_FRESNEL
colorDiffuse = vec3(0);
@@ -515,13 +516,13 @@ void main()
color.rgb = b;
#endif
#if DEBUG_PBR_DOT_NV
- color.rgb = vec3(dotNV);
+ color.rgb = vec3(nv);
#endif
#if DEBUG_PBR_DOT_TV
- color.rgb = vec3(dotTV);
+ color.rgb = vec3(tv);
#endif
#if DEBUG_PBR_DOT_BV
- color.rgb = vec3(dotBV);
+ color.rgb = vec3(bv);
#endif
#if DEBUG_PBR_AVG