segmentProject
Where a pixel falls along a line from a to b, and how far it is from that line.
segmentProject(p: Expr, a: Expr, b: Expr): Expr
Import light from shaders/std and use light.segmentProject.
Returns vec2(t, distance). t runs 0 at a to 1 at b and is clamped, so the ends are rounded. All three points share a unit. Feed both values to lightBeam.
Parameters
| Name | Type | Notes |
|---|---|---|
p | Expr | |
a | Expr | |
b | Expr |
Example
const seg = segmentProject(uv, p('start'), p('end'))
See also
lightBeam— The glow of a beam that can be thicker or softer at one end than the other.