The hero that does not block your LCP
12 November 2026 3 min read
Part 1 of 3D on the web. A 3D hero looks great and loads late. Show the picture first, bring the scene in on idle, and measure what it costs.
- WebGL
- Performance
- Core Web Vitals
This is part one of a series about 3D on the web: what it costs, who it leaves out, and how to do it without hurting the page. The first question is the one people feel first. How long until I see something?
The scene is the hero
Scene first
- Hero visible (what LCP would measure)
- not yet
- Scene running
- not yet
- Main thread blocked by setup
- not yet
The poster is the hero
Poster first
- Hero visible (what LCP would measure)
- not yet
- Scene running
- not yet
- Main thread blocked by setup
- not yet
The download is simulated, so "Slow" is always the same slow. The shader setup is real and depends on your device. Both sides run the same scene.
Both sides show the same orange blob, drawn by the same small shader. Pick a connection and press "Run again". The left side waits for the 3D code and draws the scene as soon as it can. The right side shows an image of the first frame at once, and brings the scene in later.
What you should see
On the left the hero is empty until the scene is ready. On a slow connection that is several seconds of nothing. On the right a picture is there almost immediately, and the live version fades in over it when it has arrived and been set up.
Look at the three numbers under each side.
- Hero visible is what a visitor experiences as "the page has loaded".
- Scene running is when the 3D version takes over. It is later on the right, and that is fine, because nobody is waiting for it.
- Main thread blocked by setup is real. It is the time this device spent compiling the shader and drawing the first frame, and it is the same on both sides. The difference is when it happens: on the left it is part of the wait, on the right it happens after the picture is already there, on idle.
About LCP
Largest Contentful Paint measures the render time of the largest image or text block in the viewport. As far as I know, a canvas is not a candidate for it. So a page whose hero is only a WebGL canvas can report a good LCP from some small text while the visitor looks at an empty box. The number flatters you.
A poster image fixes both problems. It is a normal image, so it counts, and it is the honest thing to measure.
<div class="hero" style="aspect-ratio: 16 / 10">
<img src="/hero-poster.avif" width="1280" height="800" alt="…" fetchpriority="high" />
<canvas hidden></canvas>
</div>
Giving the box an aspect ratio matters too. The canvas appears later and must not move the page. Layout shift counts against you as well.
The pattern
- Render the first frame ahead of time and ship it as an ordinary image. In the demo it is a file of about 9 kB. In a real project it is a build step, or one screenshot you commit.
- Load the 3D code only after the page is useful: after
load, and when the browser is idle. - Set up the scene, draw, and crossfade the canvas over the poster.
- Do none of it if the visitor does not want it.
const hero = document.querySelector('.hero');
async function enhance() {
if (matchMedia('(prefers-reduced-motion: reduce)').matches) return;
if (navigator.connection?.saveData) return;
const { mountScene } = await import('./scene.js'); // the 3D code, downloaded only now
mountScene(hero.querySelector('canvas'));
}
addEventListener('load', () => ('requestIdleCallback' in window ? requestIdleCallback(enhance) : setTimeout(enhance, 200)));
The checkbox in the demo is the last line of that list. The visitor who wants less gets the poster, forever, and the page is complete. That is not a degraded version. It is the baseline, and the scene is the enhancement. Part three of this series goes deeper on that.
What blocks the main thread
Compiling shaders and linking the program happens on the thread that handles taps and scrolls. A big shader can block it for tens or hundreds of milliseconds, which people feel as a stutter right when the scene appears. Two things help: keep shaders small, and where the browser supports KHR_parallel_shader_compile, ask it to compile off the main thread and poll instead of waiting.
What to take away
- Treat the 3D scene as an enhancement over a picture, not as the hero itself.
- Put the poster in the HTML, with a size, and mark it high priority.
- Download and set up the scene when the page is already useful.
- Measure from the visitor's side: when did something real appear?
About the numbers
The download is simulated with timers, so that the comparison stays the same on every device. The setup time is measured, and your device decides it. Headless and old devices are slower than a recent phone, and that spread is part of the lesson.
Series: 3D on the web
What it costs, who it leaves out, and how to do it without hurting the page.
Part 1The hero that does not block your LCP
- Part 2What 60 fps costs
More parts will follow.