[Bf-blender-cvs] [d3def53be5a] blender2.8: Workbench: Shadow: Add support for completly manifold geom.

Clément Foucault noreply at git.blender.org
Sun May 20 19:20:20 CEST 2018


Commit: d3def53be5a1956dbf7f3048bc6b75b760220736
Author: Clément Foucault
Date:   Sun May 20 19:13:46 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBd3def53be5a1956dbf7f3048bc6b75b760220736

Workbench: Shadow: Add support for completly manifold geom.

If a mesh is known to be manifold, then it's not necessary to increment the
stencil buffer 2 times anymore. But we still need to account properly for
degenerate triangles.

In this case, only generate a quad if the tri is facing the lamp. If there
is a degenerate loop, the other edge will either cancel the increment (if
it is also facing the light) or not produce a quad (if not facing).

This will always give the correct count.

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

M	source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl

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

diff --git a/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl b/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl
index 7352623b74c..ff835326236 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_shadow_geom.glsl
@@ -80,6 +80,14 @@ void main()
 	bvec2 backface = greaterThan(facing, vec2(0.0));
 
 #ifdef DEGENERATE_THRESHOLD
+#  ifndef DOUBLE_MANIFOLD
+	/* If the mesh is known to be manifold and we don't use double count,
+	 * only create an quad if the we encounter a facing geom. */
+	if ((any(degen_edges.xz) && backface.y) ||
+		(any(degen_edges.yw) && backface.x))
+		return;
+#  endif
+
 	/* If one of the 2 triangles is degenerate, replace edge by a non-manifold one. */
 	backface.x = (any(degen_edges.xz)) ? !backface.y : backface.x;
 	backface.y = (any(degen_edges.yw)) ? !backface.x : backface.y;



More information about the Bf-blender-cvs mailing list