What this is about
When you open a 3D world in a browser, nothing is on your computer yet. The page has to fetch code, 3D models, pictures and sounds, and it has to do it while you wait. If it fetched everything first, you would stare at a blank screen for a long time.
So a good 3D page loads a little, shows you something, and brings in the rest as you move. This post explains that idea with our own showroom, aiazic.com, and gives the byte counts we kept it under.
Why it matters
Every megabyte is time. On a fast home connection a megabyte is nearly instant. On a phone with a weak signal it is not. A visitor who waits too long leaves.
Memory matters too. A browser tab has limited room. A world that loads all its rooms at once can run a phone out of memory and crash the tab. So the question is not only "how fast", but "how little can we hold at one time".
How it works
The pieces
A 3D scene is made of a few kinds of file.
- Code. The program that draws the scene and handles your keys.
- Models. The shapes. A common format for the web is called GLB, one file with a model and its parts.
- Textures. Pictures wrapped onto the shapes, like wallpaper on a wall.
- Sounds. Footsteps, background sound and so on.
Models and textures are big. Shrinking them is the first job. Our spec says the world uses GLB files packed with a method called meshopt, or Draco, and textures in a format called KTX2. Both are ways to make the files smaller while the graphics card can still use them.
Load by distance
The central trick is to load by distance. Our notes say it plainly: "everything streams by the visitor's distance; nothing loads the whole world at once."
Here is the rule for the rooms.
- At the start, only the entrance is loaded.
- When you come within 12 meters of a room's door, the room's model starts to load.
- When you walk 4 meters further away than that, the model is dropped again.
- The room you are in and the one ahead are kept. That is two rooms at once.
Items inside a room follow a similar rule. Models and pictures on display load when the room is within 16 meters and the item is within 30 meters. They go away again a little further out.
The result is that you see the room you are in at once, and the next room is ready by the time you walk to it.
Decode carefully, then let go
Our notes list a few small habits that save memory.
- Once a model is uploaded to the graphics card, the copy of its points that the page keeps is thrown away.
- Pictures are decoded in a way that avoids the browser keeping an extra copy, and are closed after their single upload.
- A closed information panel empties its drawing area.
- The small 3D preview inside a panel uses a lower-detail model, with pictures capped at 1024 pixels.
The numbers
Here are the numbers from our notes. They come from our own test runs, so each says which kind of run it was.
| What | Before | After |
|---|---|---|
| First load until the world is usable, broadband profile, median of three runs | 2.46 MB | 1.42 MB |
| First load on a Samsung foldable phone over a 4G profile, in our mobile round | 2.09 MB | 1.06 MB |
Our budget for the first load is 1.6 MB. In later test rounds it measured between 1.48 MB and 1.58 MB. For memory, the browser's graphics process used between 346 MB and 422 MB per room in a test run on a desktop. It was within 15 MB of that whether we loaded rooms at 8, 12 or 20.8 meters.
These numbers do not say how fast the first view is on your connection. They say how many bytes we ask you to download first. Bytes are the part we control.
A mistake we caught
In one round we added 135 new items with their small pictures and labels. They all loaded before the visitor had agreed to enter. The first load grew from 1.48 MB to 1.98 MB, over the 1.6 MB budget, and our check failed. We fixed it by making anything for the new pieces wait until the visitor agreed, and by building the picture pages one per frame. The first load went back to 1.49 MB.
The rule we wrote down after it: price any new loading path against the first-load budget before the first check run, and read the check's numbers, not the screenshots.
Why the first view can still take a moment
Even with all this, a few things take time on your side:
- Your connection. The first 1.4 MB still has to arrive.
- Your graphics card. It must compile the programs that draw the scene.
- Your browser. It must turn the downloaded files into something it can draw.
Our spec asks for the first room to be usable in under six seconds on a desktop with broadband. We do not claim that for every device, and the real phone numbers we have come from one foldable phone.
What a real phone did
Our mobile round measured one phone, a Samsung foldable. The worst room there ran at 57.3 frames per second, up from 56.3. We did not run it on a real iPhone, so we make no claim there.
Words you may not know
- Streaming: loading parts of something as you need them instead of all at once.
- GLB: a file format that holds a 3D model.
- Texture: a picture that is wrapped onto a 3D shape.
- Compression: making a file smaller so it takes less time to download.
- First load: the amount you must download before the page is usable.
- Frame rate: how many pictures per second the screen shows. 60 feels smooth.
- Memory: the space a program uses while it runs.
- Budget: a limit we set in advance and test against.
Try it
- Open aiazic.com and agree to enter.
- Before you walk, open your browser's developer tools and find the Network tab. Reload the page and look at the total size transferred.
- Walk toward a far room. Watch new files appear in the Network tab as you get near.
- Walk back. The room you left will go quiet again.
Read next
Before this: aiazic.com: walking through a 3D showroom in your browser. For another size story, read 84 article pictures went from 126 MB of PNG to about 36 KB each.

Komentarze
Brak komentarzy.
Zaloguj się aby skomentować.