LumixEngine/data/pipelines/lighting.shd
Mikulas Florek 19c5b95a6e Reflection probes (#1353)
reflection probes in clusters
2021-02-16 21:41:22 +01:00

42 lines
No EOL
1.1 KiB
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;
layout (binding=6) uniform samplerCubeArray u_reflection_probes;
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
, Global.light_dir.xyz
, Global.light_color.rgb * Global.light_intensity
, u_shadowmap
, u_shadow_atlas
, u_reflection_probes);
o_color.a = 1;
}
]]