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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-07-15 21:10:45 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-07-15 21:10:45 +0300
commit058514aa0abfbbeb87a89d863a2cdc85b5bdb5c4 (patch)
tree5eeb9adf61396e50046f53f10a77d1fbb4a397e5 /source/blender/draw/engines/workbench/shaders
parentd4d810f817afc61618bec6f3b0a0ade5d0111d3c (diff)
PointCloud: Initial rendering support for Workbench
Also includes outline overlays. Removes the temp overlay drawing We make the geometry follow camera like billboards this uses less geometry. Currently we use half octahedron for now. Goal would be to use icospheres. This patch also optimize the case when pointcloud has uniform radius. However we should premultiply the radius prop by the default radius beforehand to avoid a multiplication on CPU. Using geometry instead of pseudo raytraced spheres is more scalable as we can render as low as 1 or 2 triangle to a full half sphere and can integrate easily in the render pipeline using a low amount of code. Reviewed By: brecht Differential Revision: https://developer.blender.org/D8301
Diffstat (limited to 'source/blender/draw/engines/workbench/shaders')
-rw-r--r--source/blender/draw/engines/workbench/shaders/workbench_prepass_pointcloud_vert.glsl38
1 files changed, 38 insertions, 0 deletions
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_prepass_pointcloud_vert.glsl b/source/blender/draw/engines/workbench/shaders/workbench_prepass_pointcloud_vert.glsl
new file mode 100644
index 00000000000..8e5c8a1b21f
--- /dev/null
+++ b/source/blender/draw/engines/workbench/shaders/workbench_prepass_pointcloud_vert.glsl
@@ -0,0 +1,38 @@
+
+#pragma BLENDER_REQUIRE(common_view_lib.glsl)
+#pragma BLENDER_REQUIRE(common_pointcloud_lib.glsl)
+#pragma BLENDER_REQUIRE(workbench_shader_interface_lib.glsl)
+#pragma BLENDER_REQUIRE(workbench_common_lib.glsl)
+#pragma BLENDER_REQUIRE(workbench_material_lib.glsl)
+#pragma BLENDER_REQUIRE(workbench_image_lib.glsl)
+
+void main()
+{
+ vec3 world_pos;
+ pointcloud_get_pos_and_nor(world_pos, normal_interp);
+
+ normal_interp = normalize(normal_world_to_view(normal_interp));
+
+ gl_Position = point_world_to_ndc(world_pos);
+
+#ifdef USE_WORLD_CLIP_PLANES
+ world_clip_planes_calc_clip_distance(world_pos);
+#endif
+
+ uv_interp = vec2(0.0);
+
+#ifdef OPAQUE_MATERIAL
+ float metallic, roughness;
+#endif
+ workbench_material_data_get(resource_handle, color_interp, alpha_interp, roughness, metallic);
+
+ if (materialIndex == 0) {
+ color_interp = vec3(1.0);
+ }
+
+#ifdef OPAQUE_MATERIAL
+ packed_rough_metal = workbench_float_pair_encode(roughness, metallic);
+#endif
+
+ object_id = int((uint(resource_id) + 1u) & 0xFFu);
+}