Scene size

A heavy scene takes longer to upload, uses more GPU memory and costs more to render. Measure yours in the browser before you upload anything.

Measure your scene

import { analyzeScene } from '@oeave/bakery3';

const report = analyzeScene(scene);

report.triangles;             // 2_480_912
report.textures.count;        // 38
report.textures.maxDimension; // 4096

An InstancedMesh counts its triangles multiplied by count, because the renderer holds every instance in memory.

bakery3.check() puts the two warnings below in report.issues. Neither stops a render. For the limits that do, see Limits.

Large textures

A texture above 4096px on its longest edge gets a warning.

⚠ texture_large
Texture "sofa-albedo" is 8192px. Above 4K a texture costs upload
time and VRAM without visibly improving a product render.

An 8K texture can be right for a close-up. On a small object it is wasted. What to cut first:

  1. Anything above 4K that is not the main surface. Halving a texture's edge cuts its bytes to a quarter.
  2. Duplicate textures. Two identical files upload once. Two nearly identical files upload twice.
  3. AO maps you do not need. The renderer traces real occlusion, so an AO map adds little and can darken the same corners twice.
  4. PNGs of photographic content. They upload as PNG bytes.

Large scenes

A scene above 10 million triangles gets a warning.

⚠ scene_large
Scene has 12.4M triangles.

A large scene may still render, with a higher estimate. If a render fails with OutOfVideoMemory, reduce triangles or texture sizes, whichever is larger.

Leave out what does not need to render

Helpers, gizmos and grids are left out automatically. Leave anything else out with one flag.

debugSphere.userData.bakery3 = { exclude: true };

An excluded object is not uploaded and does not count toward triangles.

A mesh with visible = false is still uploaded, so the hidden variants of a configurator are there for later renders. Exclude it if it should never render.

Upload less on the next render

Only the first render of a scene uploads everything. After that, only files that changed are uploaded. See Assets & caching.

Fail your build when the scene grows

analyzeScene() needs no account and no network, so it can run in CI.

import { analyzeScene } from '@oeave/bakery3';

const report = analyzeScene(scene);

if (report.triangles > 8_000_000) {
  const millions = (report.triangles / 1e6).toFixed(1);
  throw new Error(`Scene has grown to ${millions}M triangles`);
}