Graphics/DeferredRenderTechnique: Optimize Deferred Shading
No longer copies depth twice Former-commit-id: aa2096ade409861b773bc7302ced27ae84fab858 [formerly 80fd00bd4a75506b128b70a545eb43ff6a3a7071] [formerly d8576a8858caca9314ea67661af0ce7d9077ba9d [formerly e626f2fd62d19ca5f952485478bfe46f4a803227]] Former-commit-id: 363c93e397887e66b25446927bc5ef89e761c488 [formerly a8bee284456d7f46d182ae7df2d565fa29e55b61] Former-commit-id: 168792d853247ada5add8f97057c213af7c801b3
This commit is contained in:
@@ -11,17 +11,12 @@ uniform vec4 LightDirection;
|
||||
uniform sampler2D GBuffer0;
|
||||
uniform sampler2D GBuffer1;
|
||||
uniform sampler2D GBuffer2;
|
||||
uniform sampler2D DepthBuffer;
|
||||
|
||||
uniform mat4 InvViewProjMatrix;
|
||||
uniform vec2 InvTargetSize;
|
||||
uniform vec4 SceneAmbient;
|
||||
|
||||
float ColorToFloat(vec3 color)
|
||||
{
|
||||
const vec3 byte_to_float = vec3(1.0, 1.0/256, 1.0/(256*256));
|
||||
return dot(color, byte_to_float);
|
||||
}
|
||||
|
||||
#define kPI 3.1415926536
|
||||
|
||||
vec3 DecodeNormal(in vec4 encodedNormal)
|
||||
@@ -44,7 +39,7 @@ void main()
|
||||
vec3 diffuseColor = gVec0.xyz;
|
||||
vec3 normal = DecodeNormal(gVec1);
|
||||
float specularMultiplier = gVec0.w;
|
||||
float depth = ColorToFloat(gVec2.xyz);
|
||||
float depth = textureLod(DepthBuffer, texCoord, 0.0).r;
|
||||
float shininess = (gVec2.w == 0.0) ? 0.0 : exp2(gVec2.w*10.5);
|
||||
|
||||
vec3 lightDir = -LightDirection.xyz;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -19,6 +19,7 @@ uniform vec2 LightParameters3;
|
||||
uniform sampler2D GBuffer0;
|
||||
uniform sampler2D GBuffer1;
|
||||
uniform sampler2D GBuffer2;
|
||||
uniform sampler2D DepthBuffer;
|
||||
|
||||
uniform mat4 InvViewProjMatrix;
|
||||
uniform vec2 InvTargetSize;
|
||||
@@ -57,7 +58,7 @@ void main()
|
||||
vec3 diffuseColor = gVec0.xyz;
|
||||
vec3 normal = DecodeNormal(gVec1);
|
||||
float specularMultiplier = gVec0.w;
|
||||
float depth = ColorToFloat(gVec2.xyz);
|
||||
float depth = textureLod(DepthBuffer, texCoord, 0.0).r;
|
||||
float shininess = (gVec2.w == 0.0) ? 0.0 : exp2(gVec2.w*10.5);
|
||||
|
||||
vec3 viewSpace = vec3(texCoord*2.0 - 1.0, depth*2.0 - 1.0);
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user