Features
- True CMYK color separation
- Customizable ink colors per channel
- Multiple dot styles (dots, ink, sharp)
- Individual channel gain and flood controls
- Grid noise and grain effects
- Vintage printing simulation
Basic Usage
Parameters
Visual Parameters
string | HTMLImageElement
default:"''"
Optional source image to convert to CMYK halftone
'dots' | 'ink' | 'sharp'
default:"'ink'"
Dot rendering style:
dots: Separate dots with clear boundariesink: Blended dots simulating ink spreadsharp: Sharp dots with per-pixel color sampling
number
default:"0.2"
Halftone cell size (0 = large cells, 1 = small cells)
number
default:"1"
Image contrast adjustment before halftone conversion
number
default:"1"
Edge softness of dots (0 = hard edge, 1 = smooth gradient)
string
default:"'#fbfaf5'"
Background (paper) color in hex, rgb, or rgba format
string
default:"'#00b4ff'"
Cyan ink color in hex, rgb, or rgba format
string
default:"'#fc519f'"
Magenta ink color in hex, rgb, or rgba format
string
default:"'#ffd800'"
Yellow ink color in hex, rgb, or rgba format
string
default:"'#231f20'"
Black (key) ink color in hex, rgb, or rgba format
number
default:"0.2"
Smooth noise applied to both dot positions and color sampling
number
default:"0.5"
Size of grain overlay texture
number
default:"0"
Strength of grain affecting dot size
number
default:"0"
Strength of grain overlay on final output
Channel Controls
number
default:"0.15"
Flat cyan dot size adjustment applied uniformly
number
default:"0"
Flat magenta dot size adjustment applied uniformly
number
default:"0"
Flat yellow dot size adjustment applied uniformly
number
default:"0"
Flat black dot size adjustment applied uniformly
number
default:"0.3"
Proportional cyan dot size gain (enhances existing dots)
number
default:"0"
Proportional magenta dot size gain
number
default:"0.2"
Proportional yellow dot size gain
number
default:"0"
Proportional black dot size gain
Sizing Parameters
'none' | 'contain' | 'cover'
default:"'cover'"
How to fit the shader into the canvas dimensions
number
default:"1"
Overall zoom level of the graphics
number
default:"0"
Overall rotation angle in degrees
number
default:"0"
Horizontal offset of the graphics center
number
default:"0"
Vertical offset of the graphics center
Animation Parameters
number
default:"0"
Animation speed multiplier (0 for static)
number
default:"0"
Manual frame control for animation
Presets
The HalftoneCmyk shader comes with several built-in presets:- Default: Vibrant CMYK with cyan and yellow emphasis
- Drops: High contrast with irregular dot placement
- Newspaper: Grayscale newsprint effect
- Vintage: Soft vintage colors with grain
Examples
Newspaper Print
Vintage Poster
High Contrast Drops
Technical Details
Shader Uniforms (Vanilla JS)
When using the vanilla JavaScript API:Dot Types
dots(0): Separate dots with clear boundariesink(1): Blended dots simulating ink spreadsharp(2): Sharp dots with direct pixel sampling
CMYK Separation
The shader automatically converts RGB images to CMYK using standard formulas:- Cyan: Absence of red
- Magenta: Absence of green
- Yellow: Absence of blue
- Black (Key): Overall darkness
Channel Controls
Flood Parameters (-1 to 1):
- Add or subtract a flat amount from all dots in a channel
- Positive values make all dots bigger
- Negative values make all dots smaller
- Useful for overall color balance
-1 to 1):
- Multiply existing dot sizes proportionally
- Positive values enhance existing dots
- Negative values reduce existing dots
- Preserves relative differences between areas
Performance Notes
- Static shader (no animation by default)
- Requires noise texture (automatically handled in React)
inkandsharptypes sample 9 cells per pixel- Performance scales with image resolution
- Grid noise adds slight computational cost
