diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2020-04-25 20:37:06 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2020-04-25 20:37:06 +0300 |
commit | e54a206e157f24f149ecc18aa1d30f10a53f9616 (patch) | |
tree | d75eedd57119dca18bb5671b0336599e79d94dda /source/blender/editors/gpencil/gpencil_paint.c | |
parent | 53106934f97d5a41a38a2f597c4165837b51b1c6 (diff) |
GPencil: Fix unreported jagged lines when using Stroke mode
When use the Stroke reproject mode, the precission of the conversion makes the line produce a very small noise effect.
Now, if the stroke mode is enabled, a small smooth is done using a factor depending of the input samples.
The values of the smooth effect were provided by @pepeland after several testing.
Diffstat (limited to 'source/blender/editors/gpencil/gpencil_paint.c')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 9de15c411cc..e1854ae8c03 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1145,6 +1145,16 @@ static void gp_stroke_newfrombuffer(tGPsdata *p) reduce += 0.25f; /* reduce the factor */ } } + /* If reproject the stroke using Stroke mode, need to apply a smooth because + * the reprojection creates small jitter. */ + if (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) { + float ifac = (float)brush->gpencil_settings->input_samples / 10.0f; + float sfac = interpf(1.0f, 0.2f, ifac); + for (i = 0; i < gps->totpoints - 1; i++) { + BKE_gpencil_stroke_smooth(gps, i, sfac); + BKE_gpencil_stroke_smooth_strength(gps, i, sfac); + } + } /* Simplify adaptive */ if ((brush->gpencil_settings->flag & GP_BRUSH_GROUP_SETTINGS) && |