summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2022-09-17 14:38:07 -0500
committerDave Parks <davep@lindenlab.com>2022-09-17 14:38:07 -0500
commit13ac0f77ffe488ccdebfd28cabe8ed95d61aa684 (patch)
tree2d4fa048d191382d613da447cc41e3d117da8e77 /indra/newview
parent54e6c554c528262ed053b138c6159bc34f18d6dc (diff)
Make sure specular highlights from punctual lights don't fall off of polished surfaces
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl20
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl12
2 files changed, 12 insertions, 20 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
index 52345e7e51..d730d92054 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
@@ -351,23 +351,6 @@ vec3 hue_to_rgb(float hue)
// PBR Utils
-// ior Index of Refraction, normally 1.5
-// returns reflect0
-float calcF0(float ior)
-{
- float f0 = (1.0 - ior) / (1.0 + ior);
- return f0 * f0;
-}
-
-vec3 fresnel(float vh, vec3 f0, vec3 f90 )
-{
- float x = 1.0 - abs(vh);
- float x2 = x*x;
- float x5 = x2*x2*x;
- vec3 fr = f0 + (f90 - f0)*x5;
- return fr;
-}
-
vec3 fresnelSchlick( vec3 reflect0, vec3 reflect90, float vh)
{
return reflect0 + (reflect90 - reflect0) * pow(clamp(1.0 - vh, 0.0, 1.0), 5.0);
@@ -682,6 +665,9 @@ vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
vec3 v, // surface point to camera
vec3 l) //surface point to light
{
+ // make sure specular highlights from punctual lights don't fall off of polished surfaces
+ perceptualRoughness = max(perceptualRoughness, 8.0/255.0);
+
float alphaRoughness = perceptualRoughness * perceptualRoughness;
// Compute reflectance.
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
index 6dd140bff3..a8a3b5d33f 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
@@ -111,9 +111,6 @@ void main()
float depth = texture2DRect(depthMap, tc.xy).r;
vec4 pos = getPositionWithDepth(tc, depth);
vec4 norm = texture2DRect(normalMap, tc);
- float envIntensity = norm.z;
- norm.xyz = getNorm(tc);
-
vec3 light_dir = (sun_up_factor == 1) ? sun_dir : moon_dir;
float light_gamma = 1.0 / 1.3;
@@ -147,6 +144,7 @@ void main()
bool hasPBR = GET_GBUFFER_FLAG(GBUFFER_FLAG_HAS_PBR);
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
float perceptualRoughness = orm.g;
float metallic = orm.b;
@@ -164,6 +162,10 @@ void main()
vec3 f0 = vec3(0.04);
vec3 baseColor = diffuse.rgb;
+ //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;
@@ -187,6 +189,9 @@ void main()
}
else
{
+ float envIntensity = norm.z;
+ norm.xyz = getNorm(tc);
+
float da = clamp(dot(norm.xyz, light_dir.xyz), 0.0, 1.0);
da = pow(da, light_gamma);
@@ -249,5 +254,6 @@ void main()
frag_color.rgb = srgb_to_linear(color.rgb);
}
+
frag_color.a = bloom;
}