summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl38
1 files changed, 5 insertions, 33 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
index 5ef3d63eb2..01543732d0 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl
@@ -50,6 +50,7 @@ SOFTWARE.
uniform sampler2D normalMap;
uniform sampler2D depthMap;
+uniform sampler2D emissiveRect;
uniform sampler2D projectionMap; // rgba
uniform sampler2D brdfLut;
@@ -140,40 +141,11 @@ vec2 getScreenCoordinate(vec2 screenpos)
return sc - vec2(1.0, 1.0);
}
-// See: https://aras-p.info/texts/CompactNormalStorage.html
-// Method #4: Spheremap Transform, Lambert Azimuthal Equal-Area projection
-vec3 getNorm(vec2 screenpos)
+vec4 getNorm(vec2 screenpos)
{
- vec2 enc = texture(normalMap, screenpos.xy).xy;
- vec2 fenc = enc*4-2;
- float f = dot(fenc,fenc);
- float g = sqrt(1-f/4);
- vec3 n;
- n.xy = fenc*g;
- n.z = 1-f/2;
- return n;
-}
-
-vec3 getNormalFromPacked(vec4 packedNormalEnvIntensityFlags)
-{
- vec2 enc = packedNormalEnvIntensityFlags.xy;
- vec2 fenc = enc*4-2;
- float f = dot(fenc,fenc);
- float g = sqrt(1-f/4);
- vec3 n;
- n.xy = fenc*g;
- n.z = 1-f/2;
- return normalize(n); // TODO: Is this normalize redundant?
-}
-
-// return packedNormalEnvIntensityFlags since GBUFFER_FLAG_HAS_PBR needs .w
-// See: C++: addDeferredAttachments(), GLSL: softenLightF
-vec4 getNormalEnvIntensityFlags(vec2 screenpos, out vec3 n, out float envIntensity)
-{
- vec4 packedNormalEnvIntensityFlags = texture(normalMap, screenpos.xy);
- n = getNormalFromPacked( packedNormalEnvIntensityFlags );
- envIntensity = packedNormalEnvIntensityFlags.z;
- return packedNormalEnvIntensityFlags;
+ vec4 norm = texture(normalMap, screenpos.xy);
+ norm.xyz = normalize(norm.xyz);
+ return norm;
}
// get linear depth value given a depth buffer sample d and znear and zfar values