Welcome to mirror list, hosted at ThFree Co, Russian Federation.

eevee_lightprobe_display_grid_vert.glsl « shaders « eevee « engines « draw « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 102d985ecaa47cc6b7b73c97cab581072c1a853d (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
33
34
35
36
37
38
39

/**
 * Generate camera-facing quad procedurally for each irradiance sample of the lightcache.
 */

#pragma BLENDER_REQUIRE(common_view_lib.glsl)
#pragma BLENDER_REQUIRE(common_math_lib.glsl)

void main(void)
{
  const vec2 pos[6] = vec2[6](vec2(-1.0, -1.0),
                              vec2(1.0, -1.0),
                              vec2(-1.0, 1.0),

                              vec2(1.0, -1.0),
                              vec2(1.0, 1.0),
                              vec2(-1.0, 1.0));

  interp.samp = gl_VertexID / 6;
  interp.coord = pos[gl_VertexID % 6];

  GridData grid = grids_buf[grid_id];

  ivec3 cell_coord = grid_cell_index_to_coordinate(interp.samp, grid.resolution);

  interp.samp += grid.offset;

  mat4 cell_to_world = mat4(vec4(grid.increment_x, 0.0),
                            vec4(grid.increment_y, 0.0),
                            vec4(grid.increment_z, 0.0),
                            vec4(grid.corner, 1.0));

  vec3 quad = vec3(interp.coord * probes_buf.grids_info.display_size * 0.5, 0.0);

  interp.P = transform_point(cell_to_world, vec3(cell_coord));
  interp.P += transform_direction(ViewMatrixInverse, quad);

  gl_Position = point_world_to_ndc(interp.P);
}