This patch includes a set of features and fixes to improve the experience when using the 2D image editor for handpainted texture creation or drawing.
New brush parameters: I included a new set of parameters that are the standard in painting/drawing applications.
- Flow: control how much paint is applied in each brush step
- Hardness: This should be the default control of the falloff curve of the brush. In the future, this parameter can be also controlled by the brush pressure or tilt (which is not possible to do with the custom falloff curves). The custom falloff curve is multiplied on top of it, so setting the hardness to 1 and modifying the falloff curve replicates the old behavior.
- Density: It controls how many pixels are active inside the brush radius. It can be used to add a little bit of texture and grain to the edges of the strokes
- Wet/Dry: This controls how much paint is picked from the canvas during a stroke and how much paint from the new color is applied. This makes mixing colors a lot easier.
- Tip X scale: enables turning the pen tip into an ellipse
- Tip rotation: Rotation of the brush tip
(Also, strength is called opacity in most software, maybe we should rename it in paint tools to avoid confusion).
Brush radius smaller than one pixel: When the radius is smaller than one pixel due to pen pressure, the brush simulates it using the flow of the brush internally. This way you can get really thin lines without artifacts.
Floating point precision: The stroke falloff is now calculated using the real floating point stroke position to the center of each pixel (I also added a little bit of padding to the brush buffer to avoid possible artifacts). This should fix jagged lines artifacts and give strokes a more "anti-aliased" look.
Fixed a bug in stroke spacing: The minimum spacing now is determined by the size of a pixel in screen space instead of 1.0, so now you can make thin strokes with the canvas zoomed out.
- This affects 2D painting only. The brush behavior is still far from perfect and I'm still experimenting with the stroke/paint code to get it right. I want to focus only on 2D painting first as it is easier to develop and prototype these kinds of things. Once we have this right, we can use it as a reference to replicate the same behavior in 3D projection painting without dealing with all that complexity now.
- All new brush parameters can (and should) be controlled by pen pressure or tilt. I can add a flag for enabling this per property, but that won't be the ideal solution because each parameter needs a different mapping curve. We can wait to the functions branch to be merged to have full control of input->curve->output parameter mapping in the brush engine instead of adding a huge list of curves and menus to the UI (as most painting software does). For now I'm only focusing it making all parameters work as they should without creating any artifacts.