Skip to content

fix(export): draw export frames into one stencil target so Firefox keeps masked content - #278

Merged
dazzatronus merged 1 commit into
mainfrom
derk/export-firefox-masks
Oct 30, 2026
Merged

dazzatronus merged 1 commit into
mainfrom
derk/export-firefox-masks

Conversation

@dazzatronus

@dazzatronus dazzatronus commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Every browser export from Firefox comes out black. For each frame the exporter called extract.pixels({ target: container }), which renders into a new texture. pixi only adds a stencil buffer to a target when it meets the first mask, partway through the pass, and in Firefox the masked containers drawn in that pass come out blank. The viewport container is always masked, so the whole frame was blank.

Chrome and Safari draw that pass correctly. In Firefox, plain WebGL stencil work on an offscreen framebuffer is fine, and so is a second pass into the same target. So the fault is pixi's mid-pass attach. pixi 8.22.0, the latest, behaves this way.

The exporter now creates one RenderTarget with stencil: true per export. It renders every frame into it with an identity transform, as generateTexture did, then reads the texture's pixels. It also stops allocating a texture per frame.

Firefox can't encode AAC, so this reaches edits without audio. Edits with audio are refused before encoding, as before.

Verify: npm run verify:ci. Then, in Firefox, export a muted edit with a white background and some text: the frames show the edit instead of black.

Risk: clip masks (crops, wipes) now share one stencil buffer across frames, cleared as each frame starts.

Independent of #277: the two merge cleanly in either order, and pass together.

@dazzatronus
dazzatronus merged commit f431c6b into main Oct 30, 2026
1 check passed
github-actions Bot pushed a commit that referenced this pull request Oct 30, 2026
## [2.30.1](v2.30.0...v2.30.1) (2026-10-30)

### Bug Fixes

* draw clip filters in the preview as the render applies them ([#265](#265)) ([ac02f9b](ac02f9b))
* draw html5 frames on a software canvas so Firefox keeps their gradients ([#280](#280)) ([d508db8](d508db8))
* **export:** draw export frames into one stencil target so Firefox keeps masked content ([#278](#278)) ([f431c6b](f431c6b))
* **export:** tag browser exports as limited range so Safari's whites stay white ([#277](#277)) ([c6150eb](c6150eb))
* keep a frame's embedded images when Safari draws an html5 clip ([#279](#279)) ([5154007](5154007))
* keep baking html5 clips while their tab is in the background ([#281](#281)) ([e1fa158](e1fa158))
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.30.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant