gas producer on gas planet are pretty slow to render #232

Closed
opened 2026-09-12 17:16:50 +00:00 by metaheavens · 1 comment
Owner
No description provided.
Author
Owner

Done in 4ebd832.

GasVentField called queue_redraw() every frame, and its _draw rebuilt six vents of seven glowing polygons each — 168 antialiased polylines re-tessellated per frame, since every NeonDraw call expands into four.

Measured first: 40 rasterisations over 30 frames, costing 6.6ms against a 32.4ms floor. For scale, the black hole's cached disc costs 0.1ms.

Both halves are pieces now. The sources never move, recolour or fade, so they are rasterised once. The rising bubbles genuinely change size and opacity, but size is scale and opacity is modulate — neither needs the geometry rebuilding. 40 rasterisations became 0.

Two things worth recording for whoever optimises here next.

The static extraction alone measured nothing — 7.1ms against 6.6ms, inside the noise. softpipe is a CPU rasteriser: it prices fill, and cached geometry fills the same pixels, so it cannot see a tessellation saving at all. After the full change the frame time read negative with the floor drifting 28 to 39ms between runs. No millisecond figure is claimed here — the rasterisation count is the reproducible result, and what it is worth on a phone is unmeasured.

Scaling a NeonPiece scales its stroke with it. The bubbles were first built as unit circles scaled up by their radius, which multiplied NeonDraw's widths by five to fourteen — a hundred pixels of glow around a fourteen pixel bubble. They rendered as bright blobs, the rasterisation count said 40 → 0, and only the screenshot disagreed. They are built at the largest radius and scaled down now, so the stroke only ever thins. Noted at the call site: scale is safe for moving and shrinking a piece, and quietly wrong for growing one.

Done in 4ebd832. `GasVentField` called `queue_redraw()` every frame, and its `_draw` rebuilt six vents of seven glowing polygons each — **168 antialiased polylines re-tessellated per frame**, since every NeonDraw call expands into four. Measured first: **40 rasterisations over 30 frames, costing 6.6ms against a 32.4ms floor**. For scale, the black hole's cached disc costs 0.1ms. Both halves are pieces now. The sources never move, recolour or fade, so they are rasterised once. The rising bubbles genuinely change size and opacity, but size is `scale` and opacity is `modulate` — neither needs the geometry rebuilding. **40 rasterisations became 0.** Two things worth recording for whoever optimises here next. **The static extraction alone measured nothing** — 7.1ms against 6.6ms, inside the noise. softpipe is a CPU rasteriser: it prices *fill*, and cached geometry fills the same pixels, so it cannot see a tessellation saving at all. After the full change the frame time read *negative* with the floor drifting 28 to 39ms between runs. No millisecond figure is claimed here — the rasterisation count is the reproducible result, and what it is worth on a phone is unmeasured. **Scaling a `NeonPiece` scales its stroke with it.** The bubbles were first built as unit circles scaled up by their radius, which multiplied NeonDraw's widths by five to fourteen — a hundred pixels of glow around a fourteen pixel bubble. They rendered as bright blobs, the rasterisation count said 40 → 0, and only the screenshot disagreed. They are built at the largest radius and scaled **down** now, so the stroke only ever thins. Noted at the call site: `scale` is safe for moving and shrinking a piece, and quietly wrong for growing one.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
metaheavens/spaceship#232
No description provided.