summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders
diff options
context:
space:
mode:
authorDave Houlton <euclid@lindenlab.com>2022-04-29 17:26:17 -0600
committerDave Houlton <euclid@lindenlab.com>2022-04-29 17:26:17 -0600
commit82311e4b44a863078fb1f47d56e9543abaae210c (patch)
tree9da37968aca957045a4750ab1915ba85b172f427 /indra/newview/app_settings/shaders
parentf05e58715e0a18a7ba2ace87c2ae45684c864169 (diff)
parent93a025966649e281ceff8d1471bc983cc036bc17 (diff)
Merge branch 'DRTVWR-559' into euclid-17277
Diffstat (limited to 'indra/newview/app_settings/shaders')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl21
4 files changed, 20 insertions, 4 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
index 09c47165dd..0ae4bbfc5d 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
@@ -36,7 +36,6 @@ out vec4 frag_color;
uniform sampler2DRect depthMap;
uniform sampler2DRect diffuseRect;
uniform sampler2DRect specularRect;
-uniform samplerCube environmentMap;
uniform sampler2D noiseMap;
uniform sampler2D lightFunc;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
index ec3fb9c543..8dcc18080d 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
@@ -42,7 +42,6 @@ uniform sampler2DRect diffuseRect;
uniform sampler2DRect specularRect;
uniform sampler2DRect depthMap;
uniform sampler2DRect normalMap;
-uniform samplerCube environmentMap;
uniform sampler2D noiseMap;
uniform sampler2D projectionMap;
uniform sampler2D lightFunc;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
index 18616a9bb3..c1061f1933 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
@@ -36,7 +36,6 @@ out vec4 frag_color;
uniform sampler2DRect diffuseRect;
uniform sampler2DRect specularRect;
uniform sampler2DRect normalMap;
-uniform samplerCube environmentMap;
uniform sampler2D noiseMap;
uniform sampler2D lightFunc;
uniform sampler2DRect depthMap;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index 7700d16007..6958841d05 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -40,6 +40,7 @@ uniform sampler2DRect normalMap;
uniform sampler2DRect lightMap;
uniform sampler2DRect depthMap;
uniform samplerCube environmentMap;
+uniform samplerCube reflectionMap;
uniform sampler2D lightFunc;
uniform float blur_size;
@@ -119,6 +120,8 @@ void main()
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
+ vec3 env_vec = env_mat * refnormpersp;
+
if (spec.a > 0.0) // specular reflection
{
float sa = dot(refnormpersp, light_dir.xyz);
@@ -128,13 +131,28 @@ void main()
vec3 spec_contrib = dumbshiny * spec.rgb;
bloom = dot(spec_contrib, spec_contrib) / 6;
color.rgb += spec_contrib;
+
+ // add reflection map - EXPERIMENTAL WORK IN PROGRESS
+ float reflection_lods = 11; // TODO -- base this on resolution of reflection map instead of hard coding
+ float min_lod = textureQueryLod(reflectionMap,env_vec).y; // lower is higher res
+
+ //vec3 reflected_color = texture(reflectionMap, env_vec, (1.0-spec.a)*reflection_lod).rgb;
+ vec3 reflected_color = textureLod(reflectionMap, env_vec, max(min_lod, (1.0-spec.a)*reflection_lods)).rgb;
+ //vec3 reflected_color = texture(reflectionMap, env_vec).rgb;
+ //vec3 reflected_color = normalize(env_vec)*0.5+0.5;
+ reflected_color *= spec.rgb;
+ vec3 mixer = clamp(color.rgb + vec3(1,1,1) - spec.rgb, vec3(0,0,0), vec3(1,1,1));
+
+ color.rgb = mix(reflected_color*sqrt(spec.a*0.8), color, mixer);
+
+ //color.rgb = mix(reflected_color * spec.rgb * sqrt(spec.a*0.8), color.rgb, color.rgb);
+ //color.rgb += reflected_color * spec.rgb; // * sqrt(spec.a*0.8), color.rgb, color.rgb);
}
color.rgb = mix(color.rgb, diffuse.rgb, diffuse.a);
if (envIntensity > 0.0)
{ // add environmentmap
- vec3 env_vec = env_mat * refnormpersp;
vec3 reflected_color = textureCube(environmentMap, env_vec).rgb;
color = mix(color.rgb, reflected_color, envIntensity);
}
@@ -154,5 +172,6 @@ void main()
// convert to linear as fullscreen lights need to sum in linear colorspace
// and will be gamma (re)corrected downstream...
frag_color.rgb = srgb_to_linear(color.rgb);
+ //frag_color.r = 1.0;
frag_color.a = bloom;
}