Page MenuHome

Grease pencil stroke detail depends on motion events
Closed, ResolvedPublicTO DO


When drawing a grease pencil stroke a point is created on each mouse-move event.

Instead, there should be a 'spacing' option as with sculpt/texture-paint modes.

This means if you move your mouse very fast it would create a fixed number of points based on a user defined spacing.

Steps to Reproduce

  • Add a grease pencil object.
  • Enter draw-mode.
  • Select the freehand draw tool.
  • Draw a stroke, moving the mouse fast and slow.

Enter edit-mode: notice the detail depends on input events.

See: T63756: Curve polygon stroke detail depends on motion events

Event Timeline

@Charlie Jolly (charlie) Could you take a look?

I have seen before in normal paint, that moving very fast the mouse, you don't receive enough events and I solved doing an interpolation. A possible alternative would be calculate distances along the stroke and generate even space between them.

EDIT: Don't look at this, I thought it was related to primitives

@Campbell Barton (campbellbarton) You are talking of free drawing a stroke or drawing a curve using primitive tool? it's not clear what you mean with "draw a curve", maybe you mean draw a "stroke".

Regarding this task, there are several points we must consider.

During the development of grease pencil brushes, we spend several months doing tests in order to get the right feeling when drawing. Put in a program a "feeling" is complex, so the actual brushes are the result of dozens of tests in a back and forth process, where the artists @Daniel Martinez Lara (pepeland) and @Matias Mendiola (mendio) tested every aspect of the brushes.

If we change the brush to even the points in a predetermined distance, we are taking the risk of breaking this artistic "feeling". Also, a fixed distance between points could deform the stroke and "kill" the gesture of the artist. Our goal is keep all the gesture of the artist, not get a perfect even distribution of points, this is secondary.

About the distance between points depending of the drawing speed, we faced this problem before. When you move the mouse/pen, Blender sends an event to the program. We detected that some events were missed (including in-betweens events) when you moved the mouse very fast, so the number of events is not enough to produce a smooth stroke. The number of events depends of the CPU and the OS (Linux sends more than Windows).

After doing a lot of tests, we found a solution adding a parameter to the brush to determine the number of samples. When you increase this value, the system interpolates and smooths the stroke, so with few events, we can create a very smooth stroke that mimic the gesture of the artist. Maybe there are solutions at event system to get all mouse movements, but this would have impact is whole Blender.

About the distribution of the points to get an even a well distributed points, we developed a group of functions to simplify and smooth. Specially, we created two types of simplification, simple and adaptive. The simple mode only removes alternative points to reduce the total number of points. This can be useful to reduce density. To keep the shape, we use the adaptive mode that uses a Ramer–Douglas–Peucker algorithm in order to keep the "gesture" of the original stroke.

We also have an even distribution of points when you enable the lazy mouse stroke. This option creates points only when there is a predetermined distance between points. This is good for inking, but not a good solution for gesture drawing.

For all exposed above, a simple solution to define the distance between points could break the artistic feeling of the brushes and kill the gesture of the stroke, so maybe this need a reconsideration. Maybe a possible solution would be implement a new mode of simplify called “Even distribution” to be able to even the points as an option.

I would like to hear the opinion of @Matias Mendiola (mendio) and @Daniel Martinez Lara (pepeland) about this, because they are the artists that have been working with the brushes and know better than us this subject.

Thanks @Antonio Vazquez (antoniov) for the clear explanation. I agree with you that the main risk with this change is to lose the pleasant feeling that we have right now while drawing with Grease Pencil (more than 80% of the time used by the artist with Grease pencil is freehand drawing).

Of course we are always open to new technical ways to improve how to draw with Grease Pencil, but always keeping in mind how it feels for the artist and the accuracy of the final strokes.

Yes, keeping accuracy of the final strokes is so so important. drawing with acurracy is the key for a good workflow in 2D tasks, like @Matias Mendiola (mendio) said, more than 80% of the time used by the artist with Grease pencil is freehand drawing,
for this reason we create a group of functions in grease pencil brushes to improve the the drawing accuracy.

@Antonio Vazquez (antoniov) @Matias Mendiola (mendio) @Daniel Martinez Lara (pepeland)
I agree. The optimal drawing feel should be most important. The suggestion of the even spacing of points will feel worse and will make details get lost with to wide spacing but in certain corner cases can have a curve that's easier to work with. The simplify & adaptive simplify are great additions but don't solve the problem of massively uneven spacing or extremely dense curves.
The spacing option could also be used for drawing regular poly curves. I hope that these will share a lot of functionality with grease pencil at some point since grease pencil is so much more advanced now.

@Julien Kaspar (JulienKaspar) Could you prepare a simple file with these corner cases to use for doing some test? I'm thinking to prepare a simplify using the distance between points, and I would like to have a file for testing.

Consistent spacing mode is mostly important when you use materials in "Dots"/"Boxes" modes. Current spacing system makes those very hard to use.
For "Line" mode current system works well, but it would be useful to better smooth hard corners after fast strokes, even as post process. Current post-process smooth only rounds them instead interpolate whole stroke.

Antonio Vazquez (antoniov) claimed this task.

I think we can close this task because now we have solved the problems with ugly corners of stroke sand to get a even point distribution, we can use the simplify Sample mode.