Skip to content

V3: preserve alpha through source and effect composition - #153

Merged
git-chad merged 8 commits into
git-chad/shader-lab-v3-planfrom
git-chad/v3-alpha-compositing
Oct 1, 2026
Merged

git-chad merged 8 commits into
git-chad/shader-lab-v3-planfrom
git-chad/v3-alpha-compositing

Conversation

@git-chad

Copy link
Copy Markdown
Collaborator

Transparent input textures currently become opaque when copied or passed through the shared compositor. Source layers and effects also share one blend rule, so partial coverage cannot be composed correctly.

This PR separates their roles: source layers use straight-alpha source-over with blend-mode overlap, while effects preserve input coverage and retain the existing output-alpha-as-strength behavior. Both pipelines derive the role from layer kind, including custom shaders in Effect Mode. Pass materials, asynchronously replaced materials, texture copies, and scene grading now retain computed alpha without applying a second GPU blend.

Opaque backdrops retain the exact existing RGB expression. All frozen legacy masks and PNGs remain unchanged. Legacy mask semantics, opaque canvas backgrounds, transparent PNG export, and per-effect spatial coverage remain separate work; this does not complete roadmap phase 1.

Stack: targets git-chad/v3-transparent-media-bounds (#152), which targets #151; the integration parent remains draft #150. No merges to main.

Validation:

  • bun run test:composition: 100 new alpha checks, 136 legacy blend/mask samples, 34 media-bound checks, and all frozen visual/persistence checks pass.
  • New checks cover analytic normal/multiply/screen overlap, all blend modes over empty backdrops, finite empty/tiny alpha, adjacent transparent/opaque pixels, repeated effects, actual pass material replacement, scene grading, and the headless runtime texture pipeline with real source/effect layers.
  • bun run check, runtime typecheck, and MCP typecheck pass; app lint reports three pre-existing warnings.
  • Runtime patch changeset included; docs specify straight-alpha input/output and remaining limitations.

No new editor control is introduced. Existing app compositions are covered by unchanged visual baselines; the behavioral fix is observable with translucent external runtime textures and prepares the editor for isolated groups and coverage masks.

@vercel

vercel Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
shader-lab Ready Ready Preview Sep 17, 2026 2:27am UTC

@greptile-apps

greptile-apps Bot commented Sep 17, 2026

Copy link
Copy Markdown
Greptile Summary

This PR establishes alpha-aware composition in both the editor renderer and React SDK runtime.

  • Source layers now use straight-alpha source-over composition.
  • Effect passes preserve upstream coverage while using effect alpha as strength.
  • Pass replacements, texture copies, and scene grading retain computed alpha without an additional GPU blend.
  • Composition tests cover analytic alpha behavior, material replacement, grading, and the headless texture pipeline.
Confidence Score: 5/5

The PR appears safe to merge with no actionable correctness, security, or repository-rule issues identified.

The source-over equations, effect coverage policy, role propagation, material settings, texture copies, and grading path are internally consistent and covered across editor and runtime implementations.

Reviews (1): Last reviewed commit: "fix: preserve alpha through source and e..." | Re-trigger Greptile

@git-chad
git-chad changed the base branch from git-chad/v3-transparent-media-bounds to git-chad/shader-lab-v3-plan October 1, 2026 15:12
@git-chad
git-chad merged commit 94c7312 into git-chad/shader-lab-v3-plan Oct 1, 2026
5 checks passed

This branch was successfully deployed

1 active deployment
Preview — 94c73124 Deployed Sep 17, 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