summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class2/deferred
diff options
context:
space:
mode:
authorJonathan Goodman <geenz@lindenlab.com>2022-11-14 18:12:22 +0000
committerDave Parks <davep@lindenlab.com>2022-11-14 18:12:22 +0000
commit97277e74a9d966ed441e51f844f9012f55cca3dc (patch)
treeed6a5c00a5065951ff9f77bf0277fb202dff0c0e /indra/newview/app_settings/shaders/class2/deferred
parent843a5c287e34855fb7bd4882d8d0a106e987a9f7 (diff)
Merged in SL-18332 (pull request #1194)
First pass of Screen Space Reflections Approved-by: Dave Parks
Diffstat (limited to 'indra/newview/app_settings/shaders/class2/deferred')
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl19
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl23
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl19
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl6
7 files changed, 35 insertions, 42 deletions
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
index e255c78b86..25b0a0b970 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
@@ -180,7 +180,6 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec
void main()
{
vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;
- frag *= screen_res;
vec4 pos = vec4(vary_position, 1.0);
#ifndef IS_AVATAR_SKIN
diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
index 1b7a1cc6ec..24068c04b5 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
@@ -34,12 +34,12 @@ out vec4 frag_color;
#define frag_color gl_FragColor
#endif
-uniform sampler2DRect diffuseRect;
-uniform sampler2DRect specularRect;
-uniform sampler2DRect depthMap;
-uniform sampler2DRect normalMap;
+uniform sampler2D diffuseRect;
+uniform sampler2D specularRect;
+uniform sampler2D depthMap;
+uniform sampler2D normalMap;
uniform samplerCube environmentMap;
-uniform sampler2DRect lightMap;
+uniform sampler2D lightMap;
uniform sampler2D noiseMap;
uniform sampler2D projectionMap;
uniform sampler2D lightFunc;
@@ -138,7 +138,6 @@ void main()
vec4 frag = vary_fragcoord;
frag.xyz /= frag.w;
frag.xyz = frag.xyz*0.5+0.5;
- frag.xy *= screen_res;
vec3 pos = getPosition(frag.xy).xyz;
vec3 lv = center.xyz-pos.xyz;
@@ -154,13 +153,13 @@ void main()
if (proj_shadow_idx >= 0)
{
- vec4 shd = texture2DRect(lightMap, frag.xy);
+ vec4 shd = texture2D(lightMap, frag.xy);
shadow = (proj_shadow_idx==0)?shd.b:shd.a;
shadow += shadow_fade;
shadow = clamp(shadow, 0.0, 1.0);
}
- vec3 norm = texture2DRect(normalMap, frag.xy).xyz;
+ vec3 norm = texture2D(normalMap, frag.xy).xyz;
float envIntensity = norm.z;
@@ -190,9 +189,9 @@ void main()
lv = normalize(lv);
float da = dot(norm, lv);
- vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb;
+ vec3 diff_tex = texture2D(diffuseRect, frag.xy).rgb;
- vec4 spec = texture2DRect(specularRect, frag.xy);
+ vec4 spec = texture2D(specularRect, frag.xy);
vec3 dlit = vec3(0, 0, 0);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
index 6500c4bb1f..d81102991e 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
@@ -35,7 +35,7 @@ uniform float roughnessFactor;
uniform vec3 emissiveColor;
#if defined(HAS_SUN_SHADOW) || defined(HAS_SSAO)
-uniform sampler2DRect lightMap;
+uniform sampler2D lightMap;
#endif
uniform int sun_up_factor;
@@ -189,7 +189,6 @@ void main()
#ifdef HAS_SUN_SHADOW
vec2 frag = vary_fragcoord.xy/vary_fragcoord.z*0.5+0.5;
- frag *= screen_res;
scol = sampleDirectionalShadow(pos.xyz, norm.xyz, frag);
#endif
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index 677c9c244c..fab227f5a4 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -34,11 +34,11 @@ out vec4 frag_color;
#define frag_color gl_FragColor
#endif
-uniform sampler2DRect diffuseRect;
-uniform sampler2DRect specularRect;
-uniform sampler2DRect normalMap;
-uniform sampler2DRect lightMap;
-uniform sampler2DRect depthMap;
+uniform sampler2D diffuseRect;
+uniform sampler2D specularRect;
+uniform sampler2D normalMap;
+uniform sampler2D lightMap;
+uniform sampler2D depthMap;
uniform samplerCube environmentMap;
uniform sampler2D lightFunc;
@@ -58,6 +58,7 @@ uniform vec2 screen_res;
vec3 getNorm(vec2 pos_screen);
vec4 getPositionWithDepth(vec2 pos_screen, float depth);
+float getDepth(vec2 pos_screen);
void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao);
float getAmbientClamp();
@@ -76,9 +77,9 @@ vec4 applyWaterFogView(vec3 pos, vec4 color);
void main()
{
vec2 tc = vary_fragcoord.xy;
- float depth = texture2DRect(depthMap, tc.xy).r;
+ float depth = getDepth(tc.xy);
vec4 pos = getPositionWithDepth(tc, depth);
- vec4 norm = texture2DRect(normalMap, tc);
+ vec4 norm = texture2D(normalMap, tc);
float envIntensity = norm.z;
norm.xyz = getNorm(tc);
@@ -87,11 +88,11 @@ void main()
float light_gamma = 1.0 / 1.3;
da = pow(da, light_gamma);
- vec4 diffuse = texture2DRect(diffuseRect, tc);
+ vec4 diffuse = texture2D(diffuseRect, tc);
diffuse.rgb = linear_to_srgb(diffuse.rgb); // SL-14035
- vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
+ vec4 spec = texture2D(specularRect, vary_fragcoord.xy);
- vec2 scol_ambocc = texture2DRect(lightMap, vary_fragcoord.xy).rg;
+ vec2 scol_ambocc = texture2D(lightMap, vary_fragcoord.xy).rg;
scol_ambocc = pow(scol_ambocc, vec2(light_gamma));
float scol = max(scol_ambocc.r, diffuse.a);
float ambocc = scol_ambocc.g;
@@ -153,6 +154,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.rgb = pos.xyz;// srgb_to_linear(color.rgb);
frag_color.a = bloom;
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl
index bd11aa3f05..1e7ccb747a 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl
@@ -23,8 +23,6 @@
* $/LicenseInfo$
*/
-uniform mat4 modelview_projection_matrix;
-
ATTRIBUTE vec3 position;
uniform vec2 screen_res;
@@ -38,12 +36,12 @@ void setAdditiveColor(vec3 c);
void main()
{
//transform vertex
- vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ vec4 pos = vec4(position.xyz, 1.0);
gl_Position = pos;
// appease OSX GLSL compiler/linker by touching all the varyings we said we would
setAtmosAttenuation(vec3(1));
setAdditiveColor(vec3(0));
- vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;
+ vary_fragcoord = (pos.xy*0.5+0.5);
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
index 774f537821..c41b7b210c 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
@@ -34,12 +34,12 @@ out vec4 frag_color;
#define frag_color gl_FragColor
#endif
-uniform sampler2DRect diffuseRect;
-uniform sampler2DRect specularRect;
-uniform sampler2DRect depthMap;
-uniform sampler2DRect normalMap;
+uniform sampler2D diffuseRect;
+uniform sampler2D specularRect;
+uniform sampler2D depthMap;
+uniform sampler2D normalMap;
uniform samplerCube environmentMap;
-uniform sampler2DRect lightMap;
+uniform sampler2D lightMap;
uniform sampler2D noiseMap;
uniform sampler2D projectionMap;
uniform sampler2D lightFunc;
@@ -138,7 +138,6 @@ void main()
vec4 frag = vary_fragcoord;
frag.xyz /= frag.w;
frag.xyz = frag.xyz*0.5+0.5;
- frag.xy *= screen_res;
vec3 pos = getPosition(frag.xy).xyz;
vec3 lv = trans_center.xyz-pos.xyz;
@@ -154,13 +153,13 @@ void main()
if (proj_shadow_idx >= 0)
{
- vec4 shd = texture2DRect(lightMap, frag.xy);
+ vec4 shd = texture2D(lightMap, frag.xy);
shadow = (proj_shadow_idx == 0) ? shd.b : shd.a;
shadow += shadow_fade;
shadow = clamp(shadow, 0.0, 1.0);
}
- vec3 norm = texture2DRect(normalMap, frag.xy).xyz;
+ vec3 norm = texture2D(normalMap, frag.xy).xyz;
float envIntensity = norm.z;
norm = getNorm(frag.xy);
@@ -189,8 +188,8 @@ void main()
lv = normalize(lv);
float da = dot(norm, lv);
- vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb;
- vec4 spec = texture2DRect(specularRect, frag.xy);
+ vec3 diff_tex = texture2D(diffuseRect, frag.xy).rgb;
+ vec4 spec = texture2D(specularRect, frag.xy);
vec3 dlit = vec3(0, 0, 0);
float noise = texture2D(noiseMap, frag.xy/128.0).b;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl
index bc5eb5181d..3dfca0f655 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl
@@ -23,8 +23,6 @@
* $/LicenseInfo$
*/
-uniform mat4 modelview_projection_matrix;
-
ATTRIBUTE vec3 position;
VARYING vec2 vary_fragcoord;
@@ -34,8 +32,8 @@ uniform vec2 screen_res;
void main()
{
//transform vertex
- vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ vec4 pos = vec4(position.xyz, 1.0);
gl_Position = pos;
- vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;
+ vary_fragcoord = (pos.xy * 0.5 + 0.5);
}