[Bf-blender-cvs] [b83a1b62c7d] master: Fix T66233: Grease Pencil Swirl Effect not working at origin

Antonioya noreply at git.blender.org
Mon Jul 29 12:42:06 CEST 2019


Commit: b83a1b62c7db4e11c96b65cb68b2a88eeab7fcbc
Author: Antonioya
Date:   Tue Jul 23 22:29:42 2019 +0200
Branches: master
https://developer.blender.org/rBb83a1b62c7db4e11c96b65cb68b2a88eeab7fcbc

Fix T66233: Grease Pencil Swirl Effect not working at origin

If the control object is in the origin the radius is wrongly calculated because the result is 0.

Now, this value is clamped to avoid this situation

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

M	source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_swirl_frag.glsl

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

diff --git a/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_swirl_frag.glsl b/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_swirl_frag.glsl
index b226d4f93bc..01d4fe40195 100644
--- a/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_swirl_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_swirl_frag.glsl
@@ -42,7 +42,11 @@ void main()
   vec2 tc = uv - center;
 
   float dist = length(tc);
-  float pxradius = (ProjectionMatrix[3][3] == 0.0) ? (radius / (loc.z * defaultpixsize)) :
+  float locpixsize = abs((loc.z * defaultpixsize));
+  if (locpixsize == 0) {
+    locpixsize = 1;
+  }
+  float pxradius = (ProjectionMatrix[3][3] == 0.0) ? (radius / locpixsize) :
                                                      (radius / defaultpixsize);
   pxradius = max(pxradius, 1);



More information about the Bf-blender-cvs mailing list