diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-06-14 14:45:54 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-06-15 01:55:45 +0300 |
commit | 26e710b1fd57919a057306d39dcc8e6a04bb64a7 (patch) | |
tree | 61eae1eb620df3ecf6769721d7c1289af1e78d8c /source/blender/draw/engines/eevee/shaders/lightprobe_grid_display_vert.glsl | |
parent | 4873ff005b47908393fbc1e95b7fcfa4568d1072 (diff) |
Eevee: Add Grid debug display.
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/lightprobe_grid_display_vert.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/lightprobe_grid_display_vert.glsl | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/lightprobe_grid_display_vert.glsl b/source/blender/draw/engines/eevee/shaders/lightprobe_grid_display_vert.glsl new file mode 100644 index 00000000000..568de294845 --- /dev/null +++ b/source/blender/draw/engines/eevee/shaders/lightprobe_grid_display_vert.glsl @@ -0,0 +1,34 @@ + +in vec3 pos; +in vec3 nor; + +uniform mat4 ViewProjectionMatrix; + +uniform int offset; +uniform ivec3 grid_resolution; +uniform vec3 corner; +uniform vec3 increment_x; +uniform vec3 increment_y; +uniform vec3 increment_z; + +flat out int cellOffset; +out vec3 worldNormal; + +void main() +{ + vec3 ls_cell_location; + /* Keep in sync with update_irradiance_probe */ + ls_cell_location.z = float(gl_InstanceID % grid_resolution.z); + ls_cell_location.y = float((gl_InstanceID / grid_resolution.z) % grid_resolution.y); + ls_cell_location.x = float(gl_InstanceID / (grid_resolution.z * grid_resolution.y)); + + cellOffset = offset + gl_InstanceID; + + vec3 ws_cell_location = corner + + (increment_x * ls_cell_location.x + + increment_y * ls_cell_location.y + + increment_z * ls_cell_location.z); + + gl_Position = ViewProjectionMatrix * vec4(pos * 0.02 + ws_cell_location, 1.0); + worldNormal = normalize(nor); +}
\ No newline at end of file |