Commit 54943693 authored by NiranV's avatar NiranV
Browse files

Fixed: Outdated deferredUtil.glsl shader.

parent 90f948a6
......@@ -39,16 +39,28 @@ vec2 getScreenCoordinate(vec2 screenpos)
return sc - vec2(1.0, 1.0);
}
vec3 decode_normal(vec2 enc)
{
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 getNorm(vec2 screenpos)
{
vec2 enc = texture2DRect(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;
return decode_normal(enc);
}
vec3 getNormWithEnvIntensity(vec2 screenpos, out float envIntensity)
{
vec3 enc = texture2DRect(normalMap, screenpos.xy).xyz;
envIntensity = enc.z;
return decode_normal(enc.xy);
}
float getDepth(vec2 pos_screen)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment