This repository has been archived on 2023-10-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blender-archive/source/blender/draw/modes/shaders/object_lightprobe_grid_vert.glsl
Clément Foucault 1054f65a29 Object Mode : Add probes data outlines and selectability
This required some small changes to the data display shaders so that they match the way the object mode renders them.
Strangely enough, I had to remove the normal attribute from the display code because it was being not bound as soon as I created another rendering call in object mode. The problem may be deeper but I did not have time for this so I derive the normal from the sphere pos.
2017-09-30 19:37:40 +02:00

28 lines
799 B
GLSL

in vec3 pos;
in vec3 nor;
uniform mat4 ViewProjectionMatrix;
uniform float sphere_size;
uniform ivec3 grid_resolution;
uniform vec3 corner;
uniform vec3 increment_x;
uniform vec3 increment_y;
uniform vec3 increment_z;
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));
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 * sphere_size + ws_cell_location, 1.0);
}