Divooka Reference

Painting

8 nodes

On this page 8

Combine Strokes

Function

Strokes painted one set after another: the second set's over the first's, and its erasing strokes rubbing out what the first painted.

Signature
CombineStrokes -> Paint Strokes
    first: Paint Strokes
    second: Paint Strokes
PaintStrokes CombineStrokes(
    PaintStrokes first,
    PaintStrokes second)

Parameters

nametypedefaultdescription
firstPaint Strokes—The strokes painted first.
secondPaint Strokes—The strokes painted over them.

Returns

resultPaint Strokes
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Painting
Package
Image Processing

Mirror Strokes

Function

The strokes and their mirror image, painted both: symmetrical painting. Texture strokes mirror across the texture's middle; surface strokes across the model's middle, for a model that is symmetrical.

Signature
MirrorStrokes -> Paint Strokes
    strokes: Paint Strokes
    axis: Facing Direction
    mesh: MaterialMesh
PaintStrokes MirrorStrokes(
    PaintStrokes strokes,
    FacingDirection axis = FacingDirection.Right,
    MaterialMesh mesh)

Parameters

nametypedefaultdescription
strokesPaint Strokes—The strokes.
axisFacing DirectionRightWhich way to mirror: Left or Right mirrors across, Up or Down top to bottom, Front or Back front to back (surface strokes only).
meshMaterialMesh—The model surface strokes lie on, whose middle they mirror across; not needed for texture strokes.

Returns

resultPaint Strokes
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Painting
Package
Image Processing

Paint Mask

Function

Turns strokes into a mask - how much is painted at each pixel - and the colour painted there, ready for a layer's mask and a blend. Strokes on a model's surface are painted through the model's texture layout, past each island's edge so seams do not show.

Signature
PaintMask -> (result: Texture, color: Texture)
    strokes: Paint Strokes
    size: Integer
    mesh: MaterialMesh
    stamp: Texture
    wrap: Truth
Texture PaintMask(
    PaintStrokes strokes,
    out Texture color,
    int size = 1024,
    MaterialMesh mesh,
    Texture stamp,
    bool wrap = true)

Parameters

nametypedefaultdescription
strokesPaint Strokes—The strokes, first painted first.
sizeInteger1024The textures' width and height in pixels.
meshMaterialMesh—The model surface strokes lie on; needed only for those.
stampTexture—The picture stamp strokes lay when they carry none of their own - a brush's alpha.
wrapTruthTrueWhether texture strokes wrap across the edges, for a texture that tiles; off for a model's layout.

Returns

resultTexture
colorTexture
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Painting
Package
Image Processing

Place Decal

Function

A picture placed on the texture as a decal: a logo, a label, a number, a stencil. A colour picture with transparency paints in its own colours; a greyscale one is how much to paint.

Signature
PlaceDecal -> Paint Strokes
    picture: Texture
    x: Number
    y: Number
    size: Number
    rotation: Number
    opacity: Number
PaintStrokes PlaceDecal(
    Texture picture,
    double x = 0.5,
    double y = 0.5,
    double size = 0.3,
    double rotation = 0,
    double opacity = 1)

Parameters

nametypedefaultdescription
pictureTexture—The decal.
xNumber0.5Where its centre is across, 0 to 1.
yNumber0.5Where its centre is down, 0 to 1.
sizeNumber0.3Its longer side, as a share of the texture's width.
rotationNumber0Its turn, in degrees.
opacityNumber1How strongly it paints, 0 to 1.

Returns

resultPaint Strokes
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Painting
Package
Image Processing

Project Decal

Function

A picture projected onto a model from one side, as a decal is pressed onto it: it lands where the model's surface is seen from that side, lies across it there, and wraps round as the surface bends - whatever the model's texture layout.

Signature
ProjectDecal -> Paint Strokes
    picture: Texture
    mesh: MaterialMesh
    from: Facing Direction
    x: Number
    y: Number
    size: Number
    rotation: Number
    opacity: Number
PaintStrokes ProjectDecal(
    Texture picture,
    MaterialMesh mesh,
    FacingDirection from = FacingDirection.Front,
    double x = 0.5,
    double y = 0.5,
    double size = 0.3,
    double rotation = 0,
    double opacity = 1)

Parameters

nametypedefaultdescription
pictureTexture—The decal.
meshMaterialMesh—The model, unwrapped.
fromFacing DirectionFrontThe side it is pressed on from.
xNumber0.5Where its centre is across the model as seen from that side, 0 (left) to 1 (right).
yNumber0.5Where its centre is down the model as seen from that side, 0 (top) to 1 (bottom).
sizeNumber0.3Its longer side, as a share of the model's largest dimension.
rotationNumber0Its turn, in degrees.
opacityNumber1How strongly it paints, 0 to 1.

Returns

resultPaint Strokes
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Painting
Package
Image Processing

Random Strokes

Function

Strokes that wander across the texture: scratches, brush marks, cracks drawn in paint, chalk scribbles - each a random walk that curls as it goes and thins at its ends, wrapping across the edges so the texture still tiles.

Signature
RandomStrokes -> Paint Strokes
    count: Integer
    length: Number
    radius: Number
    radiusVariation: Number
    curl: Number
    direction: Number
    directionVariation: Number
    hardness: Number
    opacity: Number
    color: Optional Color
    taper: Number
    erase: Truth
    seed: Integer
PaintStrokes RandomStrokes(
    int count = 24,
    double length = 0.25,
    double radius = 0.006,
    double radiusVariation = 0.5,
    double curl = 0.3,
    double direction = 0,
    double directionVariation = 1,
    double hardness = 0.7,
    double opacity = 1,
    ColorElement? color,
    double taper = 0.8,
    bool erase = false,
    int seed = 0)

Parameters

nametypedefaultdescription
countInteger24How many strokes.
lengthNumber0.25How long each is, as a share of the texture's width.
radiusNumber0.006Half a stroke's width, as a share of the texture's width.
radiusVariationNumber0.5How much strokes' widths differ, 0 to 1.
curlNumber0.3How much a stroke turns as it goes: 0 is straight, 1 wanders.
directionNumber0The way strokes run, in degrees: 0 is across, 90 is down.
directionVariationNumber1How far a stroke's way may differ from that, 0 (all alike) to 1 (any way).
hardnessNumber0.7How hard their edges are, 0 to 1.
opacityNumber1How strongly they paint, 0 to 1; each stroke varies under it.
colorOptional Color—What they paint in the colour output; white when not given.
taperNumber0.8How much strokes thin toward their ends, 0 to 1.
eraseTruthFalseRub out what earlier strokes painted instead: scratches through paint.
seedInteger0Which strokes.

Returns

resultPaint Strokes
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Painting
Package
Image Processing

Stroke

Function

A brush stroke through points in texture coordinates, 0 to 1 across: a line where a mask should be, a scratch placed by hand, a path to follow.

Signature
Stroke -> Paint Strokes
    points: Number Array
    radius: Number
    hardness: Number
    opacity: Number
    color: Optional Color
    erase: Truth
    taper: Number
PaintStrokes Stroke(
    double[] points,
    double radius = 0.03,
    double hardness = 0.6,
    double opacity = 1,
    ColorElement? color,
    bool erase = false,
    double taper = 0)

Parameters

nametypedefaultdescription
pointsNumber Array—The path as pairs of numbers, u then v: 0.1, 0.5, 0.9, 0.5 is a line across the middle.
radiusNumber0.03Half the brush's width, as a share of the texture's width.
hardnessNumber0.6How much of the brush is solid before it fades, 0 to 1.
opacityNumber1How strongly the stroke paints, 0 to 1.
colorOptional Color—What the stroke paints in the colour output; white when not given.
eraseTruthFalseRub out what earlier strokes painted instead.
taperNumber0How much the stroke thins toward its ends, 0 to 1, as a pen lifted at both.

Returns

resultPaint Strokes
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Painting
Package
Image Processing

Stroke Count

Function

How many strokes there are.

Signature
StrokeCount(strokes: Paint Strokes) -> Integer
int StrokeCount(PaintStrokes strokes)

Parameters

nametypedefaultdescription
strokesPaint Strokes—The strokes.

Returns

resultInteger
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Painting
Package
Image Processing