blob: 8f1ef295e8c88153596cd2b8b337c1d7e57e8111 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
/**
* Virtual shadowmapping: Page marking / preparation
*
* This renders a series of quad to needed pages render locations.
* This is in order to clear the depth to 1.0 only where it is needed
* to occlude any potentially costly fragment shader invocation.
*/
#pragma BLENDER_REQUIRE(eevee_shadow_tilemap_lib.glsl)
void main()
{
int tile_index = gl_VertexID / 6;
if (tile_index >= pages_infos_buf.page_rendered) {
gl_Position = vec4(0.0);
return;
}
uvec2 render_co = unpackUvec4x8(pages_list_buf[tile_index]).xy;
int v = gl_VertexID % 3;
/* Triangle in lower left corner in [-1..1] square. */
vec2 pos = -1.0 + vec2((v & 1) << 1, (v & 2) << 0);
/* NOTE: this only renders if backface cull is off. */
pos = ((gl_VertexID % 6) > 2) ? -pos : pos;
pos = ((pos * 0.5 + 0.5) + vec2(render_co)) / float(SHADOW_TILEMAP_RES >> tilemap_lod);
gl_Position = vec4(pos * 2.0 - 1.0, 1.0, 1.0);
}
|