Skip to content

Halftone lines shader - #234

Open
uuuulala wants to merge 97 commits into
mainfrom
halftone-lines
Open

uuuulala wants to merge 97 commits into
mainfrom
halftone-lines

Conversation

@uuuulala

@uuuulala uuuulala commented Dec 2, 2025 •

Copy link
Copy Markdown
Member

Note

Low Risk
Additive shader and docs only; no changes to shared runtime paths beyond new exports, matching existing halftone filter patterns.

Overview
Adds a new Halftone lines image filter that renders photos as line-based halftone patterns, with stroke thickness and grid warping driven by image luminance.

The core ships in @paper-design/shaders as halftoneLinesFragmentShader plus param/uniform types and seven grid modes (lines, waves, radial, truchet, etc.), stroke/color/grain controls, and optional original-image coloring. @paper-design/shaders-react exposes HalftoneLines, halftoneLinesPresets (six presets), and public exports from both packages.

Docs follow the existing shader playbook: Leva playground at /halftone-lines (sample image cycling, upload, URL params), halftoneLinesDef for API docs, a shadcn registry example component, and registry.json registration.

Reviewed by Cursor Bugbot for commit b9319d0. Bugbot is set up for automated code reviews on this repo. Configure here.

grainOverlay: 0,
grainOverlaySize: 0.5,
},
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presets use contain not cover

Medium Severity

All halftoneLinesPresets spread defaultObjectSizing without overriding fit, so they keep contain. Sibling image filters (halftone-dots, halftone-cmyk, fluted-glass) set fit: 'cover', so the default and preset demos letterbox the source image instead of filling the canvas like the other filters.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit d9803b7. Configure here.

Comment thread packages/shaders/src/shaders/halftone-lines.ts Outdated
Comment thread docs/src/app/(shaders)/halftone-lines/page.tsx Outdated
Comment thread docs/src/app/(shaders)/halftone-lines/page.tsx Outdated
Comment thread docs/src/shader-defs/halftone-lines-def.ts

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

There are 5 total unresolved issues (including 3 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 903487f. Configure here.

float offsetScale = u_gridType < 5.5 ? 1. : cellsPerSide;
float contouringPower = abs(u_gridContouring) * ((u_gridContouring > 0. ? contouringLum : 1. - contouringLum) - 1.);

vec3 contouring = vec3(6., .5 * smoothstep(length(uv), 0., 1.), -5.) * contouringPower;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Contouring smoothstep args inverted

High Severity

smoothstep(length(uv), 0., 1.) passes edge0 >= edge1 for nearly every fragment, which is undefined in GLSL ES 3.00. That value feeds contouring.y and thus grid rotation whenever gridContouring is non-zero, so contouring rotation becomes driver-dependent instead of a defined falloff.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 903487f. Configure here.

float lum = dot(vec3(0.2126, 0.7152, 0.0722), color);
lum = mix(1., lum, tex.a);
return u_strokeInverted ? (1. - lum) : lum;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stroke invert flips palette colors

Medium Severity

toLum always applies u_strokeInverted, and inkMix uses toLum to blend colorMid and colorFront. Enabling strokeInverted therefore swaps the palette assignment, even though docs say inversion only affects stroke width and leaves colors unchanged.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 903487f. Configure here.

This branch was successfully deployed

1 active deployment
Preview — b9319d09 Deployed Oct 4, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant