[Bf-blender-cvs] [0b5786e96c9] blender2.8: GP: Fix Blur shift when add more samples

Antonioya noreply at git.blender.org
Tue Oct 16 10:23:24 CEST 2018


Commit: 0b5786e96c9f967b4e28a36974fd0400c06b7ab4
Author: Antonioya
Date:   Tue Oct 16 10:23:13 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB0b5786e96c9f967b4e28a36974fd0400c06b7ab4

GP: Fix Blur shift when add more samples

The image was moving in +X and +Y when added samples due round precission.

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

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

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

diff --git a/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_blur_frag.glsl b/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_blur_frag.glsl
index 45f142254d7..027048e3f5f 100644
--- a/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_blur_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/fx/gpencil_fx_blur_frag.glsl
@@ -39,6 +39,10 @@ void main()
 	float dx = (ProjectionMatrix[3][3] == 0.0) ? (noffset[0] / (nloc.z * defaultpixsize)) : (noffset[0] / defaultpixsize);
 	float dy = (ProjectionMatrix[3][3] == 0.0) ? (noffset[1] / (nloc.z * defaultpixsize)) : (noffset[1] / defaultpixsize);
 
+	/* round to avoid shift when add more samples */
+	dx = floor(dx) + 1.0;
+	dy = floor(dy) + 1.0;
+	
 	/* apply blurring, using a 9-tap filter with predefined gaussian weights */
 	/* depth (get the value of the surrounding pixels) */
     float outdepth = 0.0;



More information about the Bf-blender-cvs mailing list