Studio Yotsuba
Back to Node List

Path Stroke

path_stroke

Draw a pixel-perfect line along a bezier path as an image and surface

Reviewed
Guide available

Input Ports

NameTypeDescription
Path
path
Path
Required
Bezier path to draw
Color
color
Color
Line color (overrides parameter if connected)
Fill Color
fill_color
Color
Fill color for closed paths (overrides parameter if connected)

Output Ports

NameTypeDescription
Image
output
Image
Generated path stroke image
Pixel Line
pixel_line
PixelLine
Rasterized centerline coordinates for every thickness (for downstream pixel processing)
Surface
surface
Surface
Path stroke as a Surface with height, material ID, and face ID.

Parameters

NameTypeDefaultRangeDescription / Options
Width
width
Int
641–1024

Canvas width in pixels

Height
height
Int
641–1024

Canvas height in pixels

Sub-path Scope
sub_path_scope
Enum
All—

Whether to draw all sub-paths or only one selected sub-path

  • AllAll
    Draw all sub-paths
  • SingleSingle
    Draw only one selected sub-path
Sub-path
sub_path_index
Int
00–255

Selected sub-path when sub-path scope is Single

Thickness
thickness
Int
11–64

Line thickness in pixels

End Thickness
end_thickness
Int
00–64

Taper: thickness at the end of the stroke (0 = uniform). Start thick and end at 1 for grass, fur, tails and flames.

Stroke Pattern
stroke_pattern
Enum
Solid—

Choose a continuous line, repeating dashes, or evenly spaced dots

  • SolidSolid
    Draw one continuous stroke
  • DashesDashes
    Alternate drawn and empty lengths along the true path distance
  • DotsDots
    Place dots at a fixed pixel spacing along the path
Dash Length
dash_length
Float
60.5–512 / step 0.5

Length of each visible dash in pixels; 3-6 suits stitches, 8-16 suits road markings

Gap Length
gap_length
Float
40.5–512 / step 0.5

Empty length after each dash in pixels; increase it when marks look crowded

Dot Spacing
dot_spacing
Float
60.5–512 / step 0.5

Center-to-center dot spacing in pixels; use 4-8 for stitches or small lights

Start Phase
pattern_phase
Float
00–4096 / step 0.5

Move the repeating pattern forward from the path start; animate it for marching ants or flowing lights

Color
color
Color
[1,1,1,1]—

Line color (used when input port is not connected)

Pixel Perfect
pixel_perfect
Bool
true—

Remove unambiguous L-shaped redundant pixels while preserving symmetric 1px lines (thickness=1 only)

PP Mode
pp_mode
Enum
RemoveCorner—

Which redundant pixels to remove in pixel-perfect mode

  • DiagonalDiagonal
    Remove horizontal steps for more diagonal lines
  • CardinalCardinal
    Remove vertical steps for more horizontal/vertical lines
  • RemoveCornerRemoveCorner
    Prefer removing the L-corner pixel
  • KeepCornerKeepCorner
    Prefer keeping the L-corner pixel
Closed Path Cross
pp_closed_cross
Bool
false—

Use cross-product based inner/outer edge removal for closed subpaths

Closed Edge
pp_closed_side
Enum
Outer—

Which side of closed path edges to remove

  • InnerInner
    Remove inner edge pixels
  • OuterOuter
    Remove outer edge pixels
Fill Closed
fill_closed
Bool
false—

Fill the interior of closed sub-paths

Fill Color
fill_color
Color
[1,1,1,1]—

Fill color for closed paths (used when fill input port is not connected)

Material ID
material_id
Text
core:default—

Material assigned to drawn pixels in the Surface output.

Face ID
face_id
Text
surface:path-stroke—

Face label assigned to drawn pixels in the Surface output.

Surface Height
surface_height
Float
0.550–1 / step 0.01

Height value written where the stroke exists.

AO
surface_ao
Float
0.960–1 / step 0.01

Ambient shadow value for the stroke. Lower values look darker.

Roughness
surface_roughness
Float
0.750–1 / step 0.01

How matte the stroke is when lit. Higher values reduce sharp shine.

Overview

A rasterizer that turns a path into a pixel line resembling hand-placed pixels. It draws along a Bézier path and, by default, produces a pixel-perfect 1px line with extra L-shaped pixels removed. This is the most basic exit from a PixPipeline path into pixel art.

  • Version: 2
  • Generator: yes (is_generator: true — eligible for automatic canvas-size binding)

Usage tips

  • The basic chain is bezier_path → path_stroke → blend. Start with thickness 1 and pixel-perfect ON, then tune line character with pp_mode: Diagonal for more diagonal lines, Cardinal for more horizontal/vertical lines, or the default RemoveCorner when unsure.
  • Turn fill_closed ON to fill a closed shape as well. Line and fill may use separate colors, completing the pixel-art outline + interior idiom in one node.
  • Connect the color input to manage line color through a palette or variable.
  • Taper: set End Thickness to 1+ and the width blends from Thickness at the start to that value at the end. 3 down to 1 gives the classic grass / fur / tail / flame stroke (0 keeps the stroke uniform).
  • Match canvas dimensions with the path source such as bezier_path. Both use canvas binding by default, so they normally align automatically.

Common pitfalls

  • The line character changes at thickness 2 or more: pixel_perfect works only at thickness 1. Thick strokes apply a circular brush to the same centerline; even widths use a half-pixel right/down bias so the cross-section matches the requested width.
  • Fill has no effect: the path is open. Close it in the bezier_path editor; fill_closed applies only to closed subpaths.
  • Nothing appears: an unconnected path intentionally outputs a transparent image. Check the path input.
  • Every path appears when only part of a multi-path is needed: set sub_path_scope = Single and choose with sub_path_index.

Drawing algorithm

thickness = 1 (pixel-perfect mode)

  1. Sample each segment with rasterize_bezier_segment() and convert it to pixel coordinates.
    • Skip endpoints on .5 boundaries to prevent protrusion from round().
  2. Merge coordinates from every segment and remove duplicates at joins.
  3. Restore corner pixels at joins: when a diagonal gap is detected at a .5,.5 anchor, insert a corner pixel to prevent missing corners on squares and similar shapes. Do not insert one at non-right-angle vertices such as triangles.
  4. For a closed path, connect the end to the start with Bresenham.
  5. Guarantee eight-direction connectivity with ensure_8connected().
  6. If pixel_perfect is enabled, remove duplicate L-shapes with PP correction.
  7. For a closed path, apply wraparound L-shape correction.
  8. Draw the resulting pixel coordinates into the image.

thickness ≥ 2

Adaptively flatten the curve into an eight-connected centerline, then stamp a circular brush at each point. Even widths use a half-pixel right/down bias, so horizontal and vertical cross-sections match thickness. pixel_line outputs this source centerline for every thickness.

fill_closed = true

Scanline-fill closed subpaths beneath the stroke. At thickness=1, the PP-corrected coordinate sequence is used as the polygon.

Examples

Basic path drawing

[BezierPath] → path → [PathStroke] → output → [Preview]

Colored path

[ColorRGB] → color → [PathStroke] → output → [Blend] → [Preview]
                          ↑
                     [BezierPath]

Drawing only one path from a multipath

[MultiPath] → path → [PathStroke(sub_path_scope:Single, sub_path_index:1)] → [Preview]

Downstream processing of pixel coordinates

[BezierPath] → path → [PathStroke] → pixel_line → [PixelLineNode]

Using it as a Surface

[BezierPath] → path → [PathStroke] → surface → [Surface Light Preview]

With fill_closed on, the closed interior is treated as part of the same Surface as the line.

Notes

  • pixel_perfect correction applies only when thickness = 1.
  • pp_mode, pp_closed_cross, and pp_closed_side appear only at thickness 1.
  • pixel_line is always the rasterized centerline before the thickness brush is applied.
  • An unconnected path outputs an empty transparent image.
  • An unconnected path also returns an empty image and empty Surface.
  • Surface parameters are collapsed under "Surface" in the inspector.
  • Because is_generator: true, the node participates in canvas-size binding.
  • Corner-pixel restoration at .5,.5 anchors is handled automatically inside rasterize_subpath.
  • sub_path_index appears only when sub_path_scope = Single.
  • The upper limit of sub_path_index updates in the UI to match the number of input subpaths.

Related nodes

  • bezier_path / multi_path_editor — create the source path
  • path_fill — when only the fill is needed
  • pixel_line — draw from an explicit pixel-coordinate sequence
  • outline — add an outline afterward to a finished image
Back to Node List