Sub pass G-Buffer compositing example (wip)
This commit is contained in:
parent
10b3d0b53c
commit
66682abe8c
12 changed files with 1276 additions and 0 deletions
30
data/shaders/subpasses/gbuffer.frag
Normal file
30
data/shaders/subpasses/gbuffer.frag
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#version 450
|
||||
|
||||
#extension GL_ARB_separate_shader_objects : enable
|
||||
#extension GL_ARB_shading_language_420pack : enable
|
||||
|
||||
layout (binding = 1) uniform sampler2D samplerColor;
|
||||
layout (binding = 2) uniform sampler2D samplerNormalMap;
|
||||
|
||||
layout (location = 0) in vec3 inNormal;
|
||||
layout (location = 1) in vec3 inColor;
|
||||
layout (location = 2) in vec3 inWorldPos;
|
||||
|
||||
layout (location = 0) out vec4 outColor;
|
||||
layout (location = 1) out vec4 outPosition;
|
||||
layout (location = 2) out vec4 outNormal;
|
||||
layout (location = 3) out vec4 outAlbedo;
|
||||
|
||||
void main()
|
||||
{
|
||||
outPosition = vec4(inWorldPos, 1.0);
|
||||
|
||||
vec3 N = normalize(inNormal);
|
||||
N.y = -N.y;
|
||||
outNormal = vec4(N, 1.0);
|
||||
|
||||
outAlbedo = vec4(inColor, 1.0);
|
||||
|
||||
// Write color attachments to avoid undefined behaviour (validation error)
|
||||
outColor = vec4(0.0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue