Grease Pencil Bézier Stroke Type

Blender 2.92 introduced curves for Grease Pencil with the Curve Edit Mode. This work is meant to expand the idea to all areas of Grease Pencil.

Disclaimer: Keep in mind that this branch is in an experimental stage and a work-in-progress. Do not use it in production.

The idea

The basic concept is that strokes can now have a type. Previous strokes are now called Poly Strokes and strokes of the new type are called Bézier Strokes. This system allows Curve Edit Mode to be merged into normal Edit Mode.

You can convert between stroke types at any point. This is done through the Set Stroke Type operator. Just select the strokes you want to convert and set their type.

In general, everything that can be done with Poly Strokes should also be possible with Bézier strokes. This includes editing, sculpting, drawing, vertex painting, and weight painting.

Drawing

There will be multiple ways of drawing Bézier strokes directly, one of which is a new tool: the Bézier Pen.

bezier_pen_icon

A freehand curve drawing tool is also planned (e.g. there will be a brush-setting that allows you to set the stroke type to draw with).

Sculpting

Bézier strokes can be sculpted just like Poly strokes. The current implementation updates the entire curve, but this will change in the near future.

The same will be possible for vertex and weight painting. However, this is not yet implemented.

Modifiers

Not all modifiers are supported yet, but the goal is to have all modifiers working for both stroke types at some point.

Armature modifier demo:

Documentation

Since this branch is still in an experimental stage, features, short-cuts, UI names and layout might all change over time. For that reason, we don’t have a manual or documentation yet. If you have questions you can ask them on blender.chat or in this thread.

The goal of this thread

This thread is meant for the community to try out the branch and share their experiments with it. You are welcome to share what you have done with the branch, what problems you encountered, what worked well, etc. Please keep all comments and discussions on topic and please do not use this thread to request features. Thank you.

Download link and updates:

All the development is happening on the branch named: temp-gpencil-bezier-stroke-type.

Download link: https://builder.blender.org/download/temp-gpencil-bezier-stroke-type (updated manually).

Development task: https://developer.blender.org/T85754 (updated to the latest development status).

15 Likes

Oh, this isn’t a request! We are working on it already!

2 Likes

Hi, this is great change, this new stroke type, I have tested with latest build, and I think is also is good having the same control points generated by setting the stroke type as a bézier, when you convert the grease pencil into curve object of the same type like what I have done with the conversion below shown in the images. But the conversion between the same type from Grease-pencil bézier with the optimal control vertexes but when is converted I have many control vertexes from the conversion as a Bézier curve as you can see in the example. and this make a almost impossible to handle this curves, I know there is other option such as the threshold but that don’t make the same beautiful results as the original source.

this is a bitmap image traced into Grease Pencil and I have changed the stroke type into bézier, and you can see the optimal control vertex and the sharp corner.

And this is the conversion of the same Grease pencil into a curve Object as a bézier.
Is visible the incredible amount of control points

Anyway this capability is well preserved when grease pencil as exported into SVG.
Thanks.

2 Likes

When I saw the bottom image, I thought those were stroke (poly) points at first. This is definitely not intentional, will look into it.

1 Like

Hi, If you have time, I have an other request if this can be possible, there is a way to maintain and preserve the same curve type from the conversions of a Blender curves object into Grease Pencil stroke?
Below two image that can illustrate what happen the curves lose their original control vertices and they are converted as a polyline interpolate with many control vertex.
Thanks.

Blender various curves type.

Curve when they are converted into GP objects

Yes, this is part of the plan! Just haven’t gotten to it yet. Any curve that is converted or imported should be automatically of the bézier stroke type.

1 Like

Wow that is fantastic thing.

Hi. Great work (as always).

Are there plans to integrate with the GP SVG import - such that the original points are retained as GP Bezier points?

Also, will we have new scripting commands to convert Curves to GP Bezier (again retaining points)? Or create GP Bezier points directly?

1 Like

Hi! The awnser to the first question is: yes!

And about the python API, I would have to think about it a bit more. It’s not something that will come right away I’m afraid. Of course the conversion will be possible via scripts (using the convert operator). Creating curves point by point is a different story though.

Thanks. A script API convert from Curves to GP Bezier would be great.

Apparently the branch is not being built by buildbot, experimental.
Just in case this problem when I try to build the branch is not an error on my part, I get this error on Linux:

[ 20%] Building C object source/blender/editors/curve/CMakeFiles/bf_editor_curve.dir/editfont_undo.c.o
/media/Disk1/Blender_Git/blender-git/blender/source/blender/editors/gpencil/gpencil_bake_animation.c: In function ‘gpencil_bake_grease_pencil_animation_exec’:
/media/Disk1/Blender_Git/blender-git/blender/source/blender/editors/gpencil/gpencil_bake_animation.c:317:20: warning: declaration of ‘i’ shadows a previous local [-Wshadow]
  317 |           for (int i = 0; i < gps->totpoints; i++) {
      |                    ^
/media/Disk1/Blender_Git/blender-git/blender/source/blender/editors/gpencil/gpencil_bake_animation.c:251:12: note: shadowed declaration is here
  251 |   for (int i = frame_start; i < frame_end + 1; i++) {
      |            ^
/media/Disk1/Blender_Git/blender-git/blender/source/blender/editors/gpencil/gpencil_bake_animation.c:329:13: error: too few arguments to function ‘BKE_gpencil_stroke_geometry_update’
  329 |             BKE_gpencil_stroke_geometry_update(gpd_dst, gps);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /media/Disk1/Blender_Git/blender-git/blender/source/blender/editors/gpencil/gpencil_bake_animation.c:40:
/media/Disk1/Blender_Git/blender-git/blender/source/blender/blenkernel/BKE_gpencil_geom.h:147:6: note: declared here
  147 | void BKE_gpencil_stroke_geometry_update(struct bGPdata *gpd,
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[3]: *** [source/blender/editors/gpencil/CMakeFiles/bf_editor_gpencil.dir/build.make:180: source/blender/editors/gpencil/CMakeFiles/bf_editor_gpencil.dir/gpencil_bake_animation.c.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:5025: source/blender/editors/gpencil/CMakeFiles/bf_editor_gpencil.dir/all] Error 2
1 Like

The build hasnt been updated in a while, I’ll do another one.

As for the build errors, not too sure about that. It looks unrelated to the changes in the branch. That file has been added in a recent commit.

2 Likes

Hey this looks like a very useful addition. May I ask what the current status is? Any plans to merge that into main Blender?
Cheers,
Marin

I’m working on improving the core functions like curve fitting and others with the help of Hans Goudey.
Once that is ready, we’ll polish up the things that we have already and then submit it for review. Once that’s done, it can be merged.

2 Likes

Great, thanks for the heads up.

Hi, I too am wondering if a converted curve directly in GP, say from the default setting “automatic” to “vector”, in the future, would remain as the “vector” setting. Currently if you move the origin point or convert the curve to points, the curve always defaults back to “automatic” setting, and you lose the shape of some of your outlines.

Hi, im Peter from Elliott Animation. We are working on some code to improve Gpencil for our studios needs, specifically, we would like to do for Gpencil what is currently being done by you and Dilith Jayakody for Bezier curves. I have a few questions regarding this because what we are developing shouldn’t overlap with what is being developed by you guys, and we could put our resources to other areas that no one on GP is doing. One question, if you wouldn’t mind answering, is if in the future, GP will have the ability to subdivide a curve where you need it, not just directly down the middle, similar to what the new bezier stroke does by pressing “ctrl” and clicking where you would like a node/point.

Hello! I started to implement a function, that could do exactly that (create a new handle along the curve at any point). But since I don’t have much time to work on the branch anymore, it wasn’t finished.

If you are interested in continuing the work (publicly of course), I am always available for any questions you might have. You can reach me on blender.chat (username: filedescriptor).

Hi, ist the bezier Project dead ?

The plan of this project have been replaced by the upcoming GP 3.0 project. It will also bring bézier stroke capabilities to grease pencil in a better way. For now there is only a technical description of the project, but it also has a list of things that it will bring: Developer Discussion: New Grease Pencil Data Structure Proposal

1 Like