Tool Pipeline

You can select any built in brush from Paintcraft/BrushPack folder and then open brush editor from TopMenu->Window->PaintCraft->BrushSetupIn the editor you can add/modify/remove nodes and it looks like this. To add new node use Create button in the top bar

Use context menu to delete or mark node as StartNode

You can see that every brush is just series of different modifications, and everything begins with StartNode and in most cases it ends with render filter. Thats mean that tool receive input positions, then make interpolations, bind parameters (scale, color) to line config or something else and then pass those points to renderer filter.

Filters source code located at Paintcraft->Engine->Scripts->Tools-Filters - you can open any file and see how it works, usually is just simple iteration across all points. Here is an example of JitterScale filter which simply change scale to random value

public class JitterScale : FilterWithNextNode {
[EnumFlags]
public PointType PointType = PointType.BasePoint | PointType.InterpolatedPoint;
public float ScaleMax = 1.0f;
public float ScaleMin = 0.1f;
#region implemented abstract members of FilterWithNextNode
public override bool FilterBody (BrushContext brushLineContext)
{
brushLineContext.ForEachUncopiedToCanvasPoint(PointType,
point => point.Scale *= Random.Range(ScaleMin, ScaleMax));
return true;
}
#endregion
}

Starting from 2.1 there are 2 sets of points

  • BasePoints - which come from input

  • InterpolatedPoint - points comes from interpolator filter (spline interpolator make line smooth, linear interpolator connect points using straight line).

Renderers filters render just interpolated points and ignore base points which come from input.

You can also see that renderer use material. and you are free to setup your own material.