Skip to content

Add layer masks: a layer's alpha can come from an image - #24

Merged
IsraelWebDev merged 1 commit into
mainfrom
card/layer-mask
Nov 10, 2026
Merged

IsraelWebDev merged 1 commit into
mainfrom
card/layer-mask

Conversation

@IsraelWebDev

Copy link
Copy Markdown
Owner

What

A shader or image layer can carry mask (an image path) and mask_fit (cover, contain or stretch). The mask's alpha scales the layer's alpha in the composite, so a logo or text cut-out shows the layer only where it is opaque. Only the alpha counts; the mask's colour is ignored.

This is the first step toward a logo in liquid chrome. A bevel and text masks come later.

How

  • The mask is rendered into its own target (M) with the image-layer maths, so mask_fit behaves exactly like an image layer's fit.
  • blend.glsl reads the mask only when u_has_mask is 1. Layers without a mask composite exactly as before.
  • Validation: a bad mask_fit is refused; a missing or out-of-root mask file is refused by the same path rules as image layers.

Example

examples/layer_mask/funkbox-chrome.json cuts the funkbox mark out and fills it with the liquid-chrome metal shader. funkbox-mask.png is the white letters of .claude-plugin/icon.png, grown slightly, so the dark rim is included. The rendered still reads "FUNK BOX" in chrome on black.

Checks

  • tests/test_layer_mask.py: round trip, validation, orientation (top stays top), contain bands, opacity, colour ignored, example recipe.
  • Targeted: engine, recipe, catalog, tool options, install, doc links, liquid metal: pass. Lint and format: pass.
  • Full suite: running on this head; result follows in a comment.

Not included

  • Bevel (embossed look). Text masks (the text audit does not yet see a masked area).

🤖 Generated with Claude Code

Co-Authored-By: Claude Haiku 5.5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_017qYKdYke3ySSZS76W9Tp34


Generated by Claude Code

A shader or image layer can carry `mask` (an image path) and `mask_fit` (cover, contain or stretch). The mask's alpha
scales the layer's alpha in the composite, so a logo or text cut-out shows the layer only where it is opaque. The mask
is fitted to the frame with the same rules as an image layer, rendered into its own target (M) and read in blend.glsl.
Only the alpha counts.

The schema lists both fields on the recipe's layers. The example is the funkbox mark: examples/layer_mask/
funkbox-mask.png is its white letters, grown slightly, from .claude-plugin/icon.png, and funkbox-chrome.json fills
them with the liquid-chrome metal shader.

Tests: tests/test_layer_mask.py (round trip, validation, orientation, contain bands, opacity, example recipe).
docs/loops.md and the funk-studio skill (both copies) describe the field.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017qYKdYke3ySSZS76W9Tp34
@IsraelWebDev
IsraelWebDev merged commit da81681 into main Nov 10, 2026
4 checks passed
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