Add Stamp Brush and Fix Airbrush

Stamp brush is the most popular type of brush in digital paint software. More than 90% of digital brushes fall into this category. To make the brush available, I developed the GPU stamp brush rendering techniques and published it in the SIGGRAPH 2023 Talk paper. The research was basically born from and for the Blender Grease Pencil (GP) and I am transferring the techniques to GP.

The airbrush bug #94252 has existed for years in GP. I will fix the bug together with implementing the stamp brush. They seem irrelevant, but the airbrush and stamp brush will share the same shader code.

Benefits

GP has the Dots and Squares line types, which place a texture at each polyline vertex. However, this approach results in a rendering output highly dependent on the density of the stroke’s vertices, which is a fatal drawback.


The current line type Dots : Placing dots per vertex.

It is common sense that rendering results should not depend on the vertex density of polylines (GP strokes) or 3D meshes. However, it was a puzzle for the whole tech community to render the stroke correctly with GPU. I make the breakthrough and have already developed a demo within the GP.

monkey_interval
Change the interval between dots.

The dots are evenly placed along a polyline rather than at each vertex. Even if I rotate the camera:

monkey_camera
Rotate the camera.

The dots are always evenly distributed in the 2D viewport. It feels like users are retracing or restroking along the polylines in the viewport at each frame. In the future, users can change the dots into textures they want to get a stamp brush.

We won’t constrain the rendering techniques within the GP. They will be widely used in areas like game engines, GUI and VR. GP will act as a free open-source DCC software for these areas.

Schedule

The project will be carried out in two stages:

Stage 1: Upgrading the Line Type Dots

Though I’ve successfully developed the demo in GP, there are still technical challenges to deliver it. We need time to explore and to overcome the challenges, which is the primary purpose of this stage. For the details check out the task list.

Therefore, I will follow the idea to “upgrade” the current line type Dots. Mainly reuse existing GUI and avoid modifying too much existing shader code. I will discuss with Clement to solve technical issues as much as we can before the next stage.

The time this stage costs varies greatly depending on the complexity the technical problems. It may takes 1-2.5 month to finish.

Stage 2: Better Delivery

The stamp brush may act as a core feature of GP. It’s worth discussing how to deliver it to our users in a better way. The initial plan includes polishing the interface between the material and brush and creating a new line type instead of showing it as Dots.

In the end, there will be at least three groups of properties developed and delivered to users:

  • Texture: Set the stamp texture, and replace the dots in the demo with any textures.

  • Rotation: By default, stamps are oriented toward the normal direction of strokes. Adding the rotation can diversify the brush.

    • Offset controls the global rotation offset value from the default.
    • Randomness controls the random variation of rotation.
  • Noise: Blending noise on stamp texture is the key to make the brush look fascinating. I will utilize the concepts from the noise node in the material system.

    • Scale, Detail, Roughness, and Distortion are the properties same as those in the noise node.

To progress at this stage, we need to finish the stage one, which confirms the existing features’ technical possibility, and then discuss tasks to do with GP owners for further development. After that, I will hear feedback from the community and iterate the code to polish the GUI, fix minor bugs, write reference manuals, and maybe add more properties.

20 Likes

It seems to me that the instability of the picture, the teleportation of points, is this the reason why this is not used?
Was there an option to draw a polyline, and render strokes as voronoi textures, with mutual overlays?

The instability is mainly caused by the low refresh rate of gif, I will try to post a high quality video later.

render strokes as voronoi textures, with mutual overlays

Could you send me an example of it in any digital paint software like Krita?

1 Like

A high quality video demo:

4 Likes