Log inGet started
Package

halftone.shaderModule

Newest version

README.md

halftone (shader module)

The halftone and tone screens of toneScreens as pure math with no bindings: round, square, diamond, chain, line and cross-line screens whose inked share of a cell really equals the wanted coverage (dot size follows tone), flat Ben-Day style tints, dot gain (ink spreading into paper), ragged ink edges, four-colour process separation (CMYK with grey component replacement) and a melt to flat tone where a screen would get too fine to draw. Every block in toneScreens draws through it, and any surface material or other package (a manga screentone look, a printed poster material) can include it to draw the same dots: #include "~toneScreens.shaders.halftone".

FunctionWhat it gives
ht_cover(p, angle, shape, c, aa, rough, n)Ink coverage 0..1 at p (in screen cells) for wanted coverage c, antialiased over aa cells. Shapes: 0 round, 1 square, 2 diamond, 3 chain, 4 line, 5 cross-line.
ht_sd(q, shape, c)Signed distance in cells to the ink edge (q already rotated): blend two screens in this form and they stay crisp.
ht_rotate(p, a)Rotate a position into a screen's axes.
ht_tone(luma, light, dark, gamma, maxCover)Wanted coverage from brightness.
ht_tint(c, levels, soft)Snap a tone to a few even Ben-Day tints.
ht_gain(c, gain)Dot gain: ink spreading into the paper, most in the middle tones.
ht_cmyk(rgb, blackGen)Four-colour process separation.
ht_lift(rgb, value)A colour at a lighter value with its hue kept, so dots carry the shade.
ht_melt(aa)How far a screen melts into its flat tone at this cell size.
ht_noise(p), ht_hash(p)Small stable noise for ragged edges.

It depends on nothing, not even styleKit, so it works in any shader.