Skip to content

At 2160x3840, two overlapping scenes that each stack <Freeze> layers under filter: opacity() render an empty frame, with no error #96

Closed

Description

@Ragulsundaram

What happens

Two scenes overlap for a few frames (one exiting, one entering). Each wraps its content in six <Freeze> sample layers under filter: opacity(1/(i+1)), a port of Remotion's CameraMotionBlur. At 2160x3840 the overlapping frames come out completely empty: both scenes and everything else on the page. There's no error; the render log says the frame "is all black on two draws ... kept as the scene's black", and the render reports success.

Expected

The entering scene's blue box shows on frames 25-29.

What I checked

  • 1080x1920: the same file draws correctly.
  • Either scene without the sample layers: draws correctly.
  • RAEA_VELLO_BUMP_USE=1 shows every layer under 20% of the bump buffers, and RAEA_VELLO_BUMP=full doesn't help, so it doesn't look like a bump-buffer overflow.
  • Both the mp4 path ("pages handed to raea-render on the GPU") and the PNG path ("React and bevy_ui") give the empty frame.
  • Twelve full-frame filtered layers without the <Sequence> nesting draw fine, so it seems to need the Sequence + Freeze structure as well.

Repro (raea 0.1.0, macOS arm64, Apple Silicon)

raea render handover.tsx -o f26.png --frame 26 (empty) vs --frame 32 (blue box shows).

// raea 0.1.0, macOS arm64. Two scenes overlap for a few frames (an exit and an entrance), each wrapped in six
// <Freeze> sample layers under filter: opacity() (a port of Remotion's CameraMotionBlur).
// Expected: frames 22-29 show the blue box. Seen at 2160x3840: frames 22-29 are empty (the blue box and everything
// else), with no error; raea logs "all black on two draws ... kept as the scene's black". At 1080x1920 it draws.
// Remove the blur from either scene (BLUR_A or BLUR_B = false) and it draws.
import React from "react";
import {AbsoluteFill, Composition, Freeze, Sequence, registerRoot, useCurrentFrame} from "raea";
const W = 2160, H = 3840, BLUR_A = true, BLUR_B = true;
const Blur = ({on, children}: {on: boolean; children: React.ReactNode}) => {
  const f = useCurrentFrame(), n = 6;
  if (!on) return <>{children}</>;
  return <AbsoluteFill>{Array.from({length: n}, (_, i) => (
    <AbsoluteFill key={i} style={{filter: `opacity(${1 / (i + 1)})`}}><Freeze frame={f - 0.5 * (i + 1) / n + 1}>{children}</Freeze></AbsoluteFill>
  ))}</AbsoluteFill>;
};
// scene A: 20 frames, then fades out over 10 (the exit)
const SceneA = () => {
  const f = useCurrentFrame(), k = Math.min(1, Math.max(0, (f - 20) / 10));
  return <Blur on={BLUR_A}><AbsoluteFill style={{opacity: 1 - Math.min(1, 2 * k), transform: `translateY(${k * -90}px)`}}>
    <Sequence from={0} durationInFrames={48} layout="none"><div style={{position: "absolute", left: 50, top: 100, width: 200, height: 200, background: "red"}} /></Sequence>
  </AbsoluteFill></Blur>;
};
// scene B starts at frame 22, its box at local frame 3
const SceneB = () => <Blur on={BLUR_B}><AbsoluteFill>
  <Sequence from={3} durationInFrames={40} layout="none"><div style={{position: "absolute", left: 300, top: 100, width: 200, height: 200, background: "blue"}} /></Sequence>
</AbsoluteFill></Blur>;
const C = () => (
  <AbsoluteFill style={{background: "#222"}}>
    <Sequence from={0} durationInFrames={30}><SceneA /></Sequence>
    <Sequence from={22} durationInFrames={30}><SceneB /></Sequence>
  </AbsoluteFill>
);
registerRoot(() => <Composition id="handover" component={C} width={W} height={H} fps={30} durationInFrames={40} />);

Second, smaller problem: a fully blank frame is accepted as an intended black frame without a warning, so a render can silently lose whole frames. A warning when a frame with visible elements draws all black would have caught this.

Found while rendering a real 25 s portrait video at 4K; the workaround was to do the blur outside raea (render sub-frames and average them).

Activity

  1. Razepriv commented on Nov 11, 2026

    @Razepriv

    I'd like to send a PR for the second problem only (a blank frame accepted without a warning). The 4K root cause needs an Apple Silicon machine I don't have.

    What I found on main (0ea4eab):

    • gpu/device/src/check.rs:352 (black_twice): the first frame that comes out black on two draws, with the GPU canary passing, is kept as the scene's black and sets SCENE_BLACK. Every later black frame in the render is then asked only the canary and gets no line at all. So one stderr line stands for any number of lost frames.
    • The mp4 path for a page (render_fed) doesn't run the black check: runtime/export/src/fed.rs:255 calls fed_checked, which covers skipped draws only, and engine/render/src/engine/output.rs's black_checked covers RGBA frames, not NV12. So on mp4, lost frames leave no trace in the log.

    Proposal (a Warn, so the exit code is unchanged):

    1. BlitzPage::visible_paint() in engine/page/src/motion/manifest.rs, reusing the manifest's walk (alpha(), rect(), stamps()). It returns the first element that is visible and on screen and paints a non-black background or text, skipping video and 3D holders, which are see-through on purpose. It only runs on frames already black on two draws, so normal frames cost nothing.
    2. Where black_twice runs for a page (runtime/export/src/bevy_frame.rs, and 3D stills in render.rs), when visible_paint() returns something, the frame and that element are kept.
    3. Before the manifest is written, consecutive frames merge into one black-frame finding through raea_core_facts::finding::said, the way systems/contact's told reports clipping. For example: frames 22-29 drew all black on two draws, though the page shows a rgb(34, 34, 34) background (handover.tsx:31:3). That reaches stderr, the manifest and raea check --quick.
    4. Tests: the range merging as a pure function, and visible_paint on small pages (a #222 background gives Some; a #000 background or a clear overlay gives None).

    Left out: the fed mp4 path, whose frames never come back to the CPU. If you want it, a small sampled readback, done only when a frame's page has visible paint, could follow.

    Does that shape work for you? I'm working with Claude Code on a Windows 11 source build, so I'd test it on Vulkan.

  2. shinyobjectz commented on Nov 12, 2026

    @shinyobjectz
    Owner

    @Razepriv that shape works, please send it. A black-frame finding through finding::said, merged over consecutive frames and naming the element that should have painted, is exactly what raea check --quick and the manifest should carry; a Warn is right, since the exit code can't be sure. Leave the fed mp4 path out for now, as you say.

    The 4K root cause (two overlapping scenes each stacking <Freeze> layers under filter: opacity()) stays with me; I have an Apple Silicon machine here and the repro in the report, and will post what I find.

  3. shinyobjectz commented on Nov 12, 2026

    @shinyobjectz
    Owner

    The 4K root cause is found and fixed on main in be220a6. Every element with a filter is an image the size of its box in Vello's atlas, which is 8192 px a side. Your two scenes stack six full-frame filter: opacity() layers each, so at 2160x3840 the frame asked for twelve 8.3-megapixel images, more than the atlas holds, and the frame was drawn without them; at 1080p they fit. (On main before this fix the frame came out as a refusal rather than silently, which is the second half of your report; the finer per-frame warning is the PR above.)

    The fix: a filter made only of opacity() functions scales the group's alpha exactly as the opacity property does, so it's now drawn as the layer's alpha and needs no atlas image at all. Your handover.tsx draws frame 26 at 2160x3840 with the blue box in place, and the filter and opacity parity cases match Chrome as before. A blur or other filter at that count and size would still hit the atlas; that's a larger change (tiling or a bigger atlas), and I'll open it separately if someone hits it. Leaving this open for the warning PR.

  4. shinyobjectz commented on Nov 12, 2026

    @shinyobjectz
    Owner

    The second half is on main now too, in 559d827; it ships in 0.1.3 with the root-cause fix (be220a6). @Razepriv, we ended up writing it here, to your design almost point for point, so no PR is needed. Thank you, the shape you laid out made it quick.

    When a frame comes out black on two draws, the GPU passes its canary, and the page shows something that isn't black, the render now warns black-frame. It names the element that should have painted and where it's written, and the warning is merged over consecutive frames:

    raea: warn  black-frame  frames 22-29: drew all black on two draws, though the page shows a rgb(34, 34, 34) background (handover.tsx:31:3)
    

    It goes to stderr, the manifest's findings, the render's warning count and raea check. A page that really is black says nothing. As you suggested, a fed MP4's frames (never read back to the CPU) are left out for now. RAEA_BLACK_FAULT=3 now draws every frame black with the canary passing, so the warning can be tested.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions