[Bf-blender-cvs] [1cbb195f8df] temp-eeveelightcache: Object Mode: Make the LightProbe Grid samples outlines as dots

Clément Foucault noreply at git.blender.org
Fri Jun 22 17:46:32 CEST 2018


Commit: 1cbb195f8df1c5419d2a2199af82dde59ca22de5
Author: Clément Foucault
Date:   Thu Jun 21 17:54:28 2018 +0200
Branches: temp-eeveelightcache
https://developer.blender.org/rB1cbb195f8df1c5419d2a2199af82dde59ca22de5

Object Mode: Make the LightProbe Grid samples outlines as dots

This is because this display will not always match the position of the baked
samples. Making it as dots also makes it less flickery.

===================================================================

M	source/blender/draw/modes/object_mode.c
M	source/blender/draw/modes/shaders/object_lightprobe_grid_vert.glsl

===================================================================

diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c
index 423b07cdb97..56d4198ba11 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -906,7 +906,7 @@ static void OBJECT_cache_init(void *vedata)
 	}
 
 	{
-		DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL;
+		DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_POINT;
 		DRWPass *pass = psl->lightprobes = DRW_pass_create("Object Probe Pass", state);
 		struct Gwn_Batch *sphere = DRW_cache_sphere_get();
 		struct Gwn_Batch *quad = DRW_cache_quad_get();
@@ -1771,8 +1771,7 @@ static void DRW_shgroup_lightprobe(OBJECT_StorageList *stl, OBJECT_PassList *psl
 			DRW_shgroup_uniform_vec3(grp, "increment_y", prb_data->increment_y, 1);
 			DRW_shgroup_uniform_vec3(grp, "increment_z", prb_data->increment_z, 1);
 			DRW_shgroup_uniform_ivec3(grp, "grid_resolution", &prb->grid_resolution_x, 1);
-			DRW_shgroup_uniform_float(grp, "sphere_size", &prb->data_draw_size, 1);
-			DRW_shgroup_call_instances_add(grp, DRW_cache_sphere_get(), NULL, &prb_data->cell_count);
+			DRW_shgroup_call_procedural_points_add(grp, prb_data->cell_count, NULL);
 		}
 		else if (prb->type == LIGHTPROBE_TYPE_CUBE) {
 			prb_data->draw_size = prb->data_draw_size * 0.1f;
diff --git a/source/blender/draw/modes/shaders/object_lightprobe_grid_vert.glsl b/source/blender/draw/modes/shaders/object_lightprobe_grid_vert.glsl
index d9616076dbf..bcdf5adca55 100644
--- a/source/blender/draw/modes/shaders/object_lightprobe_grid_vert.glsl
+++ b/source/blender/draw/modes/shaders/object_lightprobe_grid_vert.glsl
@@ -1,7 +1,4 @@
 
-in vec3 pos;
-in vec3 nor;
-
 uniform mat4 ViewProjectionMatrix;
 
 uniform float sphere_size;
@@ -10,6 +7,7 @@ uniform vec3 corner;
 uniform vec3 increment_x;
 uniform vec3 increment_y;
 uniform vec3 increment_z;
+uniform vec3 screen_vecs[2];
 
 uniform int call_id; /* we don't want the builtin callId which would be 0. */
 uniform int baseId;
@@ -20,16 +18,17 @@ 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));
+	ls_cell_location.z = float(gl_VertexID % grid_resolution.z);
+	ls_cell_location.y = float((gl_VertexID / grid_resolution.z) % grid_resolution.y);
+	ls_cell_location.x = float(gl_VertexID / (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);
+	gl_Position = ViewProjectionMatrix * vec4(ws_cell_location, 1.0);
+	gl_PointSize = 2.0f;
 
 	finalId = uint(baseId + call_id);
 }



More information about the Bf-blender-cvs mailing list