Back to Node List

Line

line_generate

Draws a line between two points using Bresenham's algorithm

Reviewed
Guide available
The node name and summary are available in English. Port, parameter, and article details are currently shown in Japanese.

Input Ports

NameTypeDescription
color
Color
線の色(接続時はパラメータより優先)

Output Ports

NameTypeDescription
画像
output
Image
生成されたライン画像

Parameters

NameTypeDefaultRangeDescription / Options
width
Int
641–1024

キャンバスの幅(ピクセル)

高さ
height
Int
641–1024

キャンバスの高さ(ピクセル)

始点X
x1
Int
00–1024

始点の X 座標

始点Y
y1
Int
00–1024

始点の Y 座標

終点X
x2
Int
630–1024

終点の X 座標

終点Y
y2
Int
630–1024

終点の Y 座標

太さ
thickness
Int
11–64

線の太さ(ピクセル)

color
Color
[1,1,1,1]

線の色(入力ポート未接続時に使用)

Overview

A single-purpose node that draws a pixel-perfect straight line between two points using Bresenham's algorithm. Use it for numerically driven lines defined by coordinates, such as lasers, ropes, gauges, and reticles.

Usage tips

  • Promote the endpoints to input pins 📌 and connect coordinates from a waveform or path_sample to create a moving line such as a beam or connecting rope.
  • Curves and complex shapes belong to bezier_path + path_stroke. This node's advantage is the convenience of drawing from two numeric pairs.
  • Thicknesses of 2px or more are expanded with a circular brush. A horizontal or vertical line has a cross-section exactly as wide as the requested thickness.

Related nodes

  • path_stroke — draws curved or styled lines
  • shape_generate — draws other basic shapes
  • expression_vec2 — calculates endpoint coordinates
  • blend — composites the line over a background

Canvas-size binding

As a generator node, new instances automatically bind width / height to the project canvas size (_canvasWidth / _canvasHeight). The initial endpoint of a new instance is also placed on the current bottom-right pixel (x2 = width - 1, y2 = height - 1). The endpoint itself is not bound and remains freely editable afterward.

State width/height value
Default (new instance) Bound to the project canvas size and follows it automatically
Entered manually or unbound by the user Local value independent of the canvas size

Use the 🔗 button in the Inspector to remove or recreate the binding.

Algorithm

  • 1px thickness: Bresenham's line algorithm (exact pixel line)
  • 2px or more: applies a circular brush at each Bresenham point
  • Odd-sized brushes are symmetric around the line coordinate.
  • An even-sized brush cannot be perfectly symmetric on integer pixel centers, so its center is fixed 0.5px down and right from the line coordinate. For example, a 2px brush occupies offsets 0, +1, while a 4px brush occupies -1, 0, +1, +2.
  • Brush pixels outside the canvas are clipped.

Examples

  • LineGenerate → Blend → Preview — draw a straight line
  • TimeSource → SineWave → Remap → LineGenerate(x2) → AnimationRender — animate line endpoints
  • ColorPicker → LineGenerate(color) — draw a line in any color
Back to Node List
Line — PixPipeline Node Reference