LumixEngine/data/pipelines/lighting.shd
2020-08-29 14:42:27 +02:00

40 lines
No EOL
982 B
Text

include "pipelines/common.glsl"
------------------
vertex_shader [[
layout (location = 0) out vec2 v_uv;
void main()
{
gl_Position = fullscreenQuad(gl_VertexID, v_uv);
}
]]
---------------------
fragment_shader [[
layout (location = 0) in vec2 v_uv;
layout (location = 0) out vec4 o_color;
layout (binding=0) uniform sampler2D u_gbuffer0;
layout (binding=1) uniform sampler2D u_gbuffer1;
layout (binding=2) uniform sampler2D u_gbuffer2;
layout (binding=3) uniform sampler2D u_gbuffer_depth;
layout (binding=4) uniform sampler2D u_shadowmap;
layout (binding=5) uniform sampler2D u_shadow_atlas;
void main()
{
float ndc_depth;
Surface surface = unpackSurface(v_uv, u_gbuffer0, u_gbuffer1, u_gbuffer2, u_gbuffer_depth, ndc_depth);
Cluster cluster = getCluster(ndc_depth);
o_color.rgb = computeLighting(cluster
, surface
, u_light_direction.xyz
, u_light_color.rgb * u_light_intensity
, u_shadowmap
, u_shadow_atlas);
o_color.a = 1;
}
]]