Skip to content
Back to skills

Alpha Compositing

ASecurity

Fix alpha blending, transparency, and premultiplied-alpha bugs — dark/white halos, wrong order, additive glow

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 3, 2026
ai-agentsgoaws

Security analysis

A100/100

Scanned September 3, 2026

npx -y skills add black141312/ada --skill alpha-compositing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Alpha Compositing?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Alpha Compositing
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/black141312-alpha-compositing/badge)](https://www.skillsdirectory.com/skills/black141312-alpha-compositing)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: alpha-compositing
description: Fix alpha blending, transparency, and premultiplied-alpha bugs — dark/white halos, wrong order, additive glow
category: graphics
---

# Alpha Compositing

Reach for this when transparent images show dark or white fringes, edges glow, layers stack wrong, or "transparent" pixels aren't.

1. Reproduce on a stark background: composite the asset over pure red AND pure white. Dark halos on light backgrounds (or bright fringes on dark) are the classic premultiplied-vs-straight-alpha mismatch.
2. Decide one alpha convention end-to-end. If the source is premultiplied, the blend func must be `ONE, ONE_MINUS_SRC_ALPHA`; if straight, `SRC_ALPHA, ONE_MINUS_SRC_ALPHA`. Mixing the upload flag and the blend func is the #1 cause of halos.
3. Check the upload/decode flag: in WebGL toggle `UNPACK_PREMULTIPLY_ALPHA_WEBGL`; in canvas/CSS the browser premultiplies. Verify whether your PNG was authored premultiplied and align the flag to it.
4. For correct blending of semi-transparent geometry, draw back-to-front and disable depth writes (keep depth test) for the transparent pass — out-of-order alpha produces hard wrong edges where far fragments overwrite near ones.
5. For unexpected additive "glow", confirm you didn't leave an additive blend (`ONE, ONE`) set from a particle/bloom pass; blend state is sticky across draws.
6. Confirm the texture even has an alpha channel and an internal format that keeps it (`RGBA`, not `RGB`); a dropped alpha makes everything opaque.

## Rules
- Pick premultiplied OR straight alpha and keep the upload flag and blend function consistent — never mix.
- Dark fringes on light bg = treating premultiplied data as straight (or vice versa); test on red+white to confirm.
- Transparent geometry: sort back-to-front, depth-test on, depth-write OFF.
- Blend mode is global state; reset it after additive/special passes or it leaks.
- "Transparent" needs an actual alpha channel AND a blend enabled — `RGB` format or `disable(BLEND)` makes alpha a no-op.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…