GP: Add small offset to stroke over surface.

This small offset helps to keep the stroke over the surface and avoid the stoke is "inside" the face of the surface.

We could add this as a parameter in the UI, but after doing a lot of test, the valid values are very limited and don't worth the change, so a hardcoded value works fine.
This commit is contained in:
Antonio Vazquez 2018-08-30 10:17:29 +02:00
parent e74d7d6f81
commit edef141d0b
1 changed files with 9 additions and 0 deletions

View File

@ -369,6 +369,15 @@ static void gp_stroke_convertcoords(tGPsdata *p, const int mval[2], float out[3]
/* in 3d-space - pt->x/y/z are 3 side-by-side floats */
if (gpd->runtime.sbuffer_sflag & GP_STROKE_3DSPACE) {
/* add small offset to keep stroke over the surface.
* This could be a UI parameter, but the value is too sensitive for
* the user to use it and don't improve the result.
*/
if (depth) {
*depth *= 0.99998f;
}
if (gpencil_project_check(p) && (ED_view3d_autodist_simple(p->ar, mval, out, 0, depth))) {
/* projecting onto 3D-Geometry
* - nothing more needs to be done here, since view_autodist_simple() has already done it