Taos Explorer Technology Launch Taos ExplorerLaunch ↗

Technology / Rendering / 01

Rendering deep dive · 01

Anatomy of a frame, from tiles to swapchain

Cape Town from above Table Mountain: streamed photogrammetry of the mountain in the foreground, the city and harbor below, Robben Island in Table Bay, and a hazy horizon under a clear sky.
One frame. Cape Town from above Table Mountain. The rock and city are streamed photogrammetry written to a G-buffer, lit by the sun, sky and shadow clipmap; the sky, haze and water are separate passes layered onto the same HDR target before the temporal resolve and tonemap.
53 passesdefault frame (High preset, 1280×720), render-graph catalog
6 MRT + depthG-buffer: 36 B of color per pixel plus depth32float
rgba16floatHDR working target, sky to tonemap
reversed-Znear → 1, far → 0, on for every Explorer session
10 km · 250 mfloating-origin re-anchor distance: free camera · cockpit

Taos Explorer draws the real Earth, Moon and Mars from a few centimeters in front of a cockpit panel to tens of thousands of kilometers out, in a browser, on hardware from phones to desktop GPUs. The frame has to absorb photogrammetry that streams in and out every second, forty-odd optional effects, a depth range of six orders of magnitude, and coordinates that would round to meters in single precision. The answer is a deferred, HDR, multi-pass renderer whose passes are re-declared every frame into a dependency graph. The graph culls what is not needed, pools and aliases the memory, and runs everything against a world that is re-centered under the camera in double precision on the CPU. This page covers that skeleton. The other pages in the series cover the passes that hang off it.

The whole picture

One frame, end to end

src/engine/engine.ts · src/engine/frame.ts · explorer/main.ts (engine.beforeFrame, feature registration)

A frame starts on the CPU. Engine.frame() advances the clock, then emits frameStarted. Explorer hooks this as engine.beforeFrame, and that one callback does most of the app's per-frame work: it moves the aircraft or camera, re-anchors the floating origin if needed, fits the near and far planes, traverses every tileset against the frustum, and fills the draw lists (liveOpaqueDraws, liveShadowCasters, liveWaterDraws, livePointDraws) that the features read. Then the engine updates the scene and camera matrices, buckets the scene's own mesh renderers, and runs three phases over the registered features: earlyUpdate (TAA jitter lands on the camera here), update (uniforms), and addPasses (graph declaration). The graph is compiled, recorded into a single command buffer and submitted.

On the GPU the frame has four bands. Geometry is rasterized once into a G-buffer. Several products are derived from the G-buffer or built alongside it: the shadow clipmap, the atmosphere's lookup tables, ambient occlusion, the sky's image-based lighting, the cloud and terrain shadow lookups and the aerial-perspective froxels. The deferred lighting pass turns all of that into radiance on an rgba16float HDR target the sky was drawn into first. Everything after that, from water, stars and clouds to bloom, rain on the windshield, the temporal resolve and exposure, reads and rewrites that HDR handle until the tonemap pass writes the swapchain.

1 · GEOMETRY → G-BUFFER 2 · DERIVED PRODUCTS (shadow, sky, AO, IBL, lookups) 3 · LIGHTING AND THE HDR CHAIN (rgba16float) 4 · TEMPORAL, LENS, DISPLAY streamed tiles + terrain + runways liveOpaqueDraws GeometryPass clear + draw grass · walkers tree impostors markings · scars G-buffer 0 albedo·rough rgba8 1 normal·metal rgba16f 2 emissive·mask rgba16f 3 material rgba8 4 ext. mult. rgba8 5 aniso tangent rgba16f depth32float, rev-Z shadow clipmap depth16unorm 2048² × 6–8 persistent atmosphere transmittance, multi-scatter, sky-view LUTs GTAO half res, r8 raw + 2 blurs sky probe IBL cube → irradiance + prefiltered on demand lookups cloud shadow 1024² terrain shadow aerial froxels AtmospherePass sky → new HDR depth-masked DeferredLighting loads sky, adds lit surfaces + aerial point/spot lights · sea + map water stars · distant bodies · light glows fire · city lights (night) god rays · volumetric clouds SSR (off) · heat haze · bloom half-res marches, history rain · snow · ground drift windshield rain · smoke veil aircraft glass frame.hdr: one handle, many versions velocity rg16float TAA / TAAU resolve motion blur DoF (off) auto exposure lens flare labels Tonemap + grade swapchain rgba16float P3 or 8-bit The tonemap pass also reads the G-buffer emissive alpha (the "ungraded" bit), so the graph keeps that target alive to the end.
The default frame's data flow. Accent arrows follow the G-buffer and HDR chain; gray arrows are side products. Each box is a feature or group of features, and most add several passes. With every optional effect counted, the default High frame at 1280×720 compiles to 53 passes (see the measured breakdown).

Two things hold this together. The first is the render graph: passes do not own textures. They declare what they read and write, and the graph decides what is actually needed, in what order, backed by which memory. The second is the feature list: an ordered roster of objects, each owning a few passes, which pass a small set of well-known handles (frame.gbuffer, frame.hdr, frame.shadowMap, frame.ao, frame.depth, frame.velocity…) down the line. Adding an effect means inserting a feature at the right place in that list. Nothing else in the frame has to know about it.

The core

The render graph

src/renderer/render_graph/render_graph.ts · pass_builder.ts · types.ts · pass.ts

The graph is about 1,100 lines of TypeScript with no GPU-specific magic. A RenderGraph is created fresh each frame against a long-lived PhysicalResourceCache. Passes are added with graph.addPass(name, type, setup), where type is 'render', 'compute' or 'transfer' and decides which encoder the execute callback receives. Inside setup the pass gets a PassBuilder and declares every access.

Virtual resources and versioned handles

A resource is a ResourceHandle { id, version }. It comes from b.createTexture(desc) (a transient), graph.importPersistentTexture(key, desc) (lives across frames under a string key: shadow maps, TAA history, IBL), graph.importExternalTexture(gpuTexture, desc) (a texture someone else owns), or graph.setBackbuffer('canvas'). Every b.write(handle, usage) returns a new handle with the version incremented, and downstream passes must consume the new handle. That one rule gives the graph exact producer/consumer edges without any explicit dependency declaration. It also catches two classes of bugs at declaration time: reading a handle older than one this pass already wrote ("use the handle returned by write()"), and writing a resource after reading it in the same pass ("split the work into two passes"). The second is a real WebGPU hazard, because a texture cannot be sampled and attached at once.

Usage is declared per access: 'attachment', 'depth-attachment', 'depth-read', 'sampled', 'storage-read', 'storage-write', 'storage-read-write', 'uniform', 'vertex', 'index', 'indirect', 'copy-src', 'copy-dst'. The graph aggregates every usage a resource sees across the live passes into its GPUTextureUsage flags, so nobody writes usage masks by hand. For render passes, attachment options (load/store ops, clear values, a specific mip or layer view, an MSAA resolve target) travel with the write, and the graph builds the GPURenderPassDescriptor. A pass's execute callback never does.

Here is a whole pass from Explorer, a copy of the cloud-shadow lookup into a texture the sky probe reads later. It is added from inside the lighting feature's cloud-shadow callback:

explorer/main.tsTypeScript
const src = lut;
const dst = graph.importExternalTexture(probeCloudLut,
  { label: 'ProbeCloudLut', format: 'r8unorm', width: res, height: res });
graph.addPass('ProbeCloudLutCopy', 'transfer', (b) => {
  b.read(src, 'copy-src');
  b.write(dst, 'copy-dst');
  b.setExecute((pctx, r) => {
    pctx.commandEncoder.copyTextureToTexture(
      { texture: r.getTexture(src) }, { texture: probeCloudLut }, { width: res, height: res });
  });
});

Culling

compile() runs in four steps: validate, cull, sort, bind. Culling is a reverse reachability walk. The seeds are every pass that writes the backbuffer, plus every pass that writes a persistent or external resource. Those writes are observed by the next frame (or by code outside the graph), so they must survive even if nothing in this frame reads them. From the seeds the walk follows each read back to the pass that produced that exact (id, version).

src/renderer/render_graph/render_graph.ts · _cull()TypeScript
while (stack.length > 0) {
  const i = stack.pop()!;
  for (const r of this._passes[i].reads) {
    if (r.version === 0) { continue; }
    const p = producer.get(versionKey(r.id, r.version));
    if (p !== undefined && !live.has(p)) { live.add(p); stack.push(p); }
  }
  // A write of version V implicitly depends on the producer of V-1: the
  // new attachment loads the previous version's contents. Without this edge, e.g.
  // a sky-clear pass that produces v=1 gets culled when the lighting pass
  // that loads it produces v=2 — leaving a stale or uncleared target.
  for (const w of this._passes[i].writes) {
    if (w.version <= 1) { continue; }
    const p = producer.get(versionKey(w.id, w.version - 1));
    if (p !== undefined && !live.has(p)) { live.add(p); stack.push(p); }
  }
}

The second loop matters in Explorer. The sky is drawn into a fresh HDR texture (version 1), and deferred lighting loads it and writes version 2. It never reads the sky in the sampled sense. Without the implicit "write V depends on V−1" edge, the sky pass would be culled as unread.

Atmosphere write hdr#7 v1 DeferredLighting load → #7 v2 Stars read #7v2 → #9v1 Tonemap read #9 v1 backbuffer SEED V−1 edge read edge read edge The walk runs right to left, from the seeds back through producers ShadowPass writes persistent map SEED (seen next frame) debug view pass writes #12, never read CULLED: never recorded topological order = insertion order (checked) A read whose producer was added later throws: "addPass() ordering must respect data dependencies". The feature list order IS the execution order.
Culling over versioned handles. The topological sort keeps insertion order: since every consumer must use the handle its producer returned, a stable insertion order is already a valid order, and _topoSort only asserts it. Resource ids are illustrative.

This is why the feature list order is the frame's execution order. The graph does not reorder passes. It drops dead ones and checks that the survivors are already in a valid order. Explorer leans on culling constantly: a dozen effects are switched off by simply not being read, and a disabled pass that must still exist in the dependency chain can be a 'transfer' no-op.

Design note

A pass must declare everything it touches. The graph inserts no barriers and plans no memory for an undeclared access. With the aliasing described next, a texture fetched through getTexture() on a handle the pass never declared reads whatever transient reused that memory. The graph's own documentation puts it bluntly: "declare every later read".

Where the bytes live

Physical memory: pooling, aliasing, discard

src/renderer/render_graph/physical_resource_cache.ts · render_graph.ts (compile, _planAttachmentStorage)

After culling, compile() binds each surviving virtual resource to a physical one. Persistent resources resolve through the cache's persistent registry by key. Usage flags are aggregated across every virtual id sharing a key, so a frame that only samples a persistent texture still gets the same physical texture the rendering frame created, not a blank one. External and backbuffer handles resolve to what the caller handed in (the swapchain texture is bound at execute time, since it changes per frame). Everything else is a transient, acquired from a free list keyed by a hash of the descriptor and usage.

Lifetime aliasing

Checking every transient out at compile time and returning it only after submit would mean no two virtual textures ever share memory within a frame. Instead, with RenderGraph.aliasTransients on (the default), the compiler records each resource's first and last pass index in compiled order and returns a transient to its pool right after its last use. A later transient with the same descriptor gets the same memory. Pools hand out the oldest free object, so a static graph gives the same virtual resource the same physical texture every frame. That keeps GPUTextureView identity stable, so the view and bind-group caches keep hitting. Pooled objects idle for EVICT_FRAMES = 120 frames are destroyed.

Full-res rgba16float transients over the pass sequence (schematic) skylightstarsbodiescloudsbloomTAAblur… hdr #7 stars #9 bodies #11 clouds #14 bloom #20 resolve #24 → physical A → B → A (reused) → B (reused) → A
A transient goes back to its pool after the last pass that touches it, and the next acquisition of the same descriptor takes the oldest free one. The pass names and overlaps here are illustrative. The real numbers for the default frame come from the render-graph catalog: 12 full-resolution rgba16float targets, at most 4 alive at once.

The render-graph catalog (TODO/explorer-render-graph-catalog.md, a probe of the live app at 1280×720 on a desktop GPU) measures the effect. With aliasing, the default frame's transients take 56 MB, against 118 MB without it, and 63 MB with SSR, DoF, bloom, map water, aurora and satellites all on, against 157 MB. Together with the depth16 shadow map and history ping-pong, the textures bound by the default frame come to 162 MB. On iOS, where Safari closes the tab without warning past a combined CPU and GPU memory limit, that is the difference between running and not.

Discard and memoryless attachments

The same lifetime data drives store ops. In _planAttachmentStorage, an attachment write to a graph-created texture that is the last use of that texture gets storeOp: 'discard', whatever the pass asked for. If the texture is used in exactly one render pass, is cleared on load, is a single-mip, single-layer 2D texture, and has no usage but RENDER_ATTACHMENT, it is also allocated with GPUTextureUsage.TRANSIENT_ATTACHMENT where the browser supports it. A tiled (mobile) GPU can then keep it in tile memory and never write it out. Persistent, external and backbuffer resources, MSAA resolve targets and attachments of 'transfer' passes (which build their own render passes) are never touched.

src/renderer/render_graph/render_graph.ts · _planAttachmentStorage()TypeScript
discardWrites.add(versionKey(w.id, w.version));
if (!transientFlag || accessCount.get(w.id) !== 1
    || usages.get(w.id) !== GPUTextureUsage.RENDER_ATTACHMENT) { continue; }
const desc = res.desc as TextureDesc;
if ((desc.mipLevelCount ?? 1) !== 1 || (desc.depthOrArrayLayers ?? 1) !== 1
    || (desc.dimension ?? '2d') !== '2d') { continue; }
// … cleared on load (depth: and stencil, if the format has one) …
if (cleared) { transientIds.add(w.id); }

Both are global toggles (RenderGraph.autoDiscard, RenderGraph.transientAttachments) for A/B testing, and graph.lastCompiled exposes the plan (discardWrites, transientIds) to debug tools. The catalog probe and the graph visualizer in src/renderer/render_graph/ui/ read it. Calling compile() a second time is not allowed, because it would acquire the pooled resources again.

Composition

Features: the unit of a frame

src/engine/render_feature.ts · src/engine/engine.ts · src/engine/frame.ts

Nothing in Explorer calls addToGraph on a pass directly. Every pass belongs to a RenderFeature:

src/engine/render_feature.tsTypeScript
export interface RenderFeature {
  readonly name: string;
  /** When false, the feature is skipped each frame. */
  enabled: boolean;
  /** Construct pipelines / pass instances. Runs once. */
  setup(engine: Engine): void | Promise<void>;
  /** Before any feature's update, e.g. TAA's sub-pixel jitter on the camera. */
  earlyUpdate?(frame: Frame): void;
  /** Per-frame uniform refresh on the owned passes. */
  update?(frame: Frame): void;
  /** Register the feature's passes in `frame.graph`. */
  addPasses(frame: Frame): void;
  destroy?(): void;
}
beforeFrame origin, planes, tiles, draw lists scene.update camera matrices bucket meshes earlyUpdate ×N TAA jitter → camera update ×N uniforms, may set frame.extras new RenderGraph slots = null extras.clear() addPasses ×N declare reads, writes, execute compile() cull · sort · bind plan store ops execute() one command buffer queue.submit afterFrame deferred destroys run after submit N = every enabled feature, in registration order. Disabled features skip all three phases.
The CPU side of a frame in Engine.frame() and _buildAndExecuteGraph().

The well-known slots, and frame.extras

The Frame object carries mutable slots that features read and overwrite to chain: hdr, gbuffer, shadowMap, ao, ssgi, depth, velocity, exposureBuffer, and the lighting pass's camera and light buffers. A post effect is typically three lines of wiring: read frame.hdr, write a new texture, assign it back to frame.hdr. For anything else there is frame.extras, a string-keyed map. The atmosphere publishes its LUT handles there, the reflection probe its bindings, the shadow feature its cascade data.

There is a trap in extras. It is cleared between the update and addPasses phases, because the graph and all handles are rebuilt. Anything a feature publishes in update is gone by addPasses. The deferred lighting feature copies the shadow cascade data into its own fields during update for that reason:

src/renderer/features/deferred_lighting_feature.ts · update()TypeScript
const cascades = (frame.extras.get('shadow:cascades') as …) ?? [];
// Capture for addPasses: `frame.extras` is cleared between the update and
// addPasses phases, so these can't be re-read there.
this._cascadeCount = cascades.length;

A fresh graph every frame

A cached, compiled graph reused while the feature set is unchanged would not work, and the comment on _buildAndExecuteGraph says why. Several passes capture per-frame values inside their execute closures, notably the shadow pass's cascade matrices and draw-item matrices. A reused graph would replay frame one's transforms forever. Rebuilding is cheap: the graph allocates only JavaScript pass records, and the physical cache already pools every GPU object. So the graph is rebuilt every frame, and a pass can change its whole structure from one frame to the next. Explorer uses that freedom everywhere. The shadow clipmap renders a different subset of levels each frame, the stars add no pass in daylight, the cloud shadow lookup appears only while clouds cast, and the velocity pass exists only while something moves with the camera.

Registration, ordering and addFeatureBefore

engine.addFeature(f) appends to the list, runs f.setup(engine) at once, and throws if the name is already taken. That matters because Explorer registers nine instances of the same glow-billboard class and gives each its own name. engine.addFeatureBefore(f, 'Name') splices a feature in ahead of an existing one and falls back to appending. Explorer uses it once, near line 8279 of main.ts: the city-lights feature (GroundNightLightsFeature) needs the urban mask and the night-imagery globe, which are built about 3,000 lines after the rest of the stack is wired, so it is spliced in directly before GodrayFeature instead of restructuring the setup.

Async pipelines

Boot-time pipelines are created with createRenderPipelineAsync and createComputePipelineAsync through helpers on RenderContext. Pass factories are static async create(ctx), and features with expensive passes have an async setup. The engine collects the pending promises and awaits them before the next frame builds, so asynchronous compiles overlap instead of serializing in the GPU process. That matters most in the editor, which registers about 40 features and would otherwise boot slowly. Explorer awaits the few features it configures synchronously right after registration (await engine.addFeature(atmosphereFeature), likewise the lighting and point/spot features), because their pass is null until setup resolves. Pipelines that vary at run time, such as per-material variants in the geometry pass or the shadow-filter variant in the lighting pass, are still built synchronously on first use. Toggles that need a new pass (turning on occlusion culling builds a Hi-Z pass) start the create and draw without it until the promise lands.

The roster

Explorer's feature order

explorer/main.ts lines ~2795–5430 (registration) · ~8279 (addFeatureBefore) · ~914–1386 (the effects defaults) · ~453–478 (GRAPHICS_PRESETS)

The table lists every feature Explorer registers, in order. Because the graph executes in insertion order, this is the order of the frame, minus whatever culls or skips itself. "Off" means off by default in the effects block. "Gated" means the feature is enabled per frame only while its subject exists (night, rain, a jet's exhaust, an aircraft being flown). Settings in GRAPHICS_PRESETS change some defaults: the Low preset turns off GTAO, contact and terrain shadows, the engine god rays, motion blur, grass and trees, and switches TAA to TAAU.

#Feature (passes)Reads → writesWhy here
G-buffer geometry
1GeometryFeature (GeometryPass; GpuCullPass + HiZPass when occlusion culling is on)liveOpaqueDraws → clears and writes all six G-buffer targets and depth; sets frame.gbuffer, frame.depthFirst. One pass for all static meshes: photogrammetry, terrain, runway surfaces. Clears the G-buffer even when the list is empty. Occlusion culling is off and not exposed in the settings.
2GroundGrassFeature (scatter compute, draw)a top-down capture of the ground, G-buffer → G-buffer (load)Before shadows, AO and lighting so blades are shadowed and lit like the ground. Blades grow in clumps (a jittered-grid Voronoi on the Earth-fixed pattern: each clump's height, tint, facing, lean and stiffness; tussocks drawn toward their middle in the near rings) and come up shorter toward the edges of where grass grows (thin photo cover, and within a few meters of pavement, water and ski-run snow, leaning out over the edge). Up to 16 pushers (wheels, skids, feet, a balloon basket, players, street cars, animals) bend and flatten the blades near them, and press a 64 m trample field (256² cells, recovering over 90 s) that leaves tracks; a rotor's downwash lays them out in rings. The scatter marks which pushers reach each blade, so the vertex shader loops over those only. A trample compute pass runs before the scatter. On (High); within 5 km of the ground; Earth only.
3SkinnedGeometryFeaturewalker draws → G-bufferThe walkers in Walk mode. No pass while the list is empty.
4GroundTreesFeature (scatter, near, draw)ground capture, land cover, water mask → impostors into the G-bufferOn; out to 5 km on High. Also supplies shadow casters (see 7).
5AirfieldMarkingsFeaturedepth, emissive alpha → albedo (load)After grass and trees, so taxiway paint goes over grass blades. Skips pixels with the "not ground" bit.
6GroundScarsFeaturedepth, emissive alpha → albedo (load)Gated: the furrows left by wrecks.
Shadows
7ShadowFeature (ShadowPass levels)liveShadowCasters, walkers, tree and grass casters → persistent shadow array, depth16unorm 2048² a level (1024² on phones)Registered after geometry because the page-virtualized mode's mark pass reads G-buffer depth. Clipmap, 6 levels (+2 in flight), staggered updates. See Shadows.
8SdsmFeatureG-buffer depth → min/max readbackOff, and pinned off in code: it makes shadows shift as the camera tilts.
Atmosphere, AO, sky light
9AtmosphereLutsFeaturesun → transmittance and multi-scatter LUTs in frame.extrasBefore anything that reads them: sky, lighting, clouds.
10AtmosphereFeature (sky-view bake, skylight bake, sky)LUTs, G-buffer depth → sky-view LUT, 2×1 skylight LUT, sky in a new HDR target (frame.hdr)Depth-masked sky drawn before lighting, which loads it and adds the lit surfaces. Uses the real sun, not the key light, which becomes the Moon at night. See Atmosphere.
11AOFeature (GTAO raw, blur H, blur V)depth, normals → half-res AO (frame.ao)Before lighting. On (GTAO) on High and Ultra.
12ReflectionProbeFeatureprocedural sky + cloud deck → cubemap → irradiance and prefiltered mapsOn demand: re-baked when the sun moves, not every frame. 512² capture and 256² prefiltered on desktop, 256² and 128² on phones.
Lighting
13DeferredLightingFeature (AerialVolumePass, cloud ground-shadow LUT, ProbeCloudLutCopy, terrain shadow merge, DeferredLightingPass)G-buffer, shadow map, AO, probe IBL, atmosphere LUTs, cloud + terrain shadow LUT, aerial froxels → HDR (load over the sky)The core. Its cloud-shadow callback adds the cloud feature's ground-LUT pass at this point in the graph, though the cloud feature itself registers later. See Lighting.
14PointSpotLightFeatureG-buffer (light-exclusion mask) → HDR (additive)The aircraft's lights, lightning, apron and airport-traffic spots, car low beams (IES profile). No light culling.
Water, points, sky objects
15GeoWaterFeature (copy, water)water tiles, depth, a copy of the HDR for refraction → HDROn Cesium World Terrain only (seaWater): water drawn from its tiles' water masks.
16SeaLevelWaterFeatureG-buffer, geoid, FFT wave field → HDROn: finds sea-level, flat, water-colored pixels on the photoreal tiles and the open terrain and shades them. Before clouds and bloom so water is part of what they see.
17GeoPointCloudFeaturepoint tiles → HDR + EDLNo passes unless a point-cloud dataset streams.
18CurvedHorizonStarsFeatureHDR, depth → new HDRNo pass while no star is visible (day). Before clouds so clouds occlude stars. See Space.
19DistantBodyFeatureHDR, depth → new HDRAnalytic, depth-correct spheres for the bodies you are not on (see depth).
20GeoSatelliteFeature ×9 (satellites, ISS beacon, runway lights, plane lights, street lamps, ADS-B lights, airport-traffic lights, roof lights, ISS lights) + FireFeatureinstance buffers → HDR (additive glow billboards); fire reads depthSatellites off; the rest gated per frame. Before bloom so they bloom.
21GroundNightLightsFeatureG-buffer ("not ground" bit), VIIRS night imagery, urban mask → HDR (load)Spliced in with addFeatureBefore(…, 'GodrayFeature'). Gated: night near the camera.
Shafts, clouds, reflections, glow
22GodrayFeature (march, blur H, blur V, composite)shadow map, 256² cloud ground LUT, depth → HDROn (High). After lighting; before clouds, which cover it.
23HQCloudFeature (raymarch, reproject, god rays, composite)LUTs, Beer shadow map, depth, history → HDRWeather-driven. Faded out from 3 km to 40 km above the deck top. See Clouds.
24SSRFeatureHDR, G-buffer, history → HDROff. After clouds so a ray reaching the sky finds them.
25HeatHazeFeatureHDR, depth → new HDRGated: jet exhaust plumes.
26LensBloomFeature (6 down, 5 up, composite)HDR → HDROn. Before rain so streaks are not bloomed.
Weather and cockpit
27GeoRainFeature, GeoSnowFeature, GroundDriftFeaturecamera-relative particles, terrain height → HDRGated by the weather (rain is off in manual mode). Before AA so they resolve and tonemap with the scene. See Weather.
28WindshieldRainFeaturedepth, HDR, glass mask → new HDRGated: in the cockpit, in rain.
29SmokeVeilFeaturedepth, HDR → new HDRGated: wildfire smoke.
30VehicleGlassFeatureHDR → HDR (alpha-blended glass)After windshield rain: drops are outside the glass, reflections on it.
Temporal, lens, display
31PlaneVelocityFeature (VelocityPass, grass velocity)aircraft, walker and surfboard draws, depth → rg16float velocityOnly while something moves with the camera; zero pixels mean "use camera reprojection". Before AA and motion blur.
32TAAFeature / TemporalUpscaleFeature (+ SMAA for the headset)HDR, depth, velocity, history → resolved HDRTAA by default; TAAU on Low. See Post.
33MotionBlurFeatureHDR, depth → HDROn. After AA: it convolves the resolved frame.
34DofFeatureHDR, depth → HDROff. After motion blur.
35AutoExposureFeatureHDR → exposure bufferMeters before the flare and labels, so a bright flare cannot stop the picture down.
36LensFlareFeaturedepth occlusion → HDROn. After blur and DoF so the flare is not smeared.
37GeoWireframeFeature, CollisionDebugLinesdraws, depth → HDRDebug, off.
38GeoLabelFeaturelabels → HDRPlace labels, off unless chosen. Before tonemap so text is tonemapped.
39TonemapFeatureHDR, exposure buffer, G-buffer emissive alpha → backbufferLast. Linear-with-shoulder curve, color grade (skipping "ungraded" pixels), contrast-adaptive sharpen, HDR output where the display supports it.

Three placements in that table are worth explaining.

Shadows after geometry. The shadow map and the G-buffer do not depend on each other in cascade mode, but the page-virtualized clipmap marks which shadow pages the visible scene samples by reading frame.gbuffer.depth. Registering shadows after geometry makes that legal in every mode. Lighting still comes after both.

The sky before the lighting. The atmosphere draws a full-screen sky into a fresh HDR texture using the G-buffer depth as a mask, and the lighting pass loads it instead of clearing. The lit tiles and the sky therefore share one target from the start, and every later effect (god rays, clouds, bloom, the temporal resolve) treats the sky like any other surface.

Exposure before the flare. A histogram that metered the lens flare would let a bright flare stop the whole picture down. So auto exposure runs ahead of the lens flare, the wireframe and the labels, which are drawn over the scene and should not be counted in it. The flare stays after motion blur and DoF so they do not smear it.

Pitfall

Bloom sits before the TAA resolve, so it is built from a jittered, unresolved frame and TAA's neighborhood clamp sees bloom halos as part of the color box. Moving it after the resolve would steady thin highlights, but with TAAU the upscaler must stay the last pass before tonemap: bloom is sized to the render resolution, not the display. The catalog lists this as a known compromise, not done.

Formats

The G-buffer and the HDR target

src/renderer/render_graph/passes/block_geometry_pass.ts (GBUF_* formats) · geometry_pass.ts · src/shaders/geometry.wgsl · src/renderer/material.ts · src/renderer/render_context.ts

The deferred geometry passes share one set of format constants, defined in block_geometry_pass.ts:

LocTargetFormatContentsClear
0albedorgba8unormbase color rgb, roughness a (widened by geometric specular AA)—
1normalrgba16floatworld normal ×0.5+0.5, metallic a—
2emissivergba16floatHDR emission rgb; a = the draw's 8-bit light-exclusion mask ÷255black, 0
3paramsrgba8unormshading model id, specular, baked occlusion, material id ÷255(0, 0.5, 1, 0)
4params2rgba8unormper-pixel multipliers: clearcoat, clearcoat roughness, sheen roughness, iridescence(1, 1, 1, 1)
5params3rgba16floatworld anisotropy tangent xyz, strength a(0, 0, 0, 0)
—depthdepth32floatreversed-Z in Explorer0 (far)

That is 4 + 8 + 8 + 4 + 4 + 8 = 36 bytes of color per pixel plus 4 of depth: 40 bytes, or about 37 MB at 1280×720. The clear values are chosen so a pixel that a pass did not write degrades to the standard default: params clears to "default lit, F0 0.04, unoccluded", params2 to identity multipliers, params3 to isotropic.

The slim G-buffer

Most of Explorer's pixels are photogrammetry or flat-colored buildings. They emit nothing and use no material extensions, so writing locations 2, 4 and 5 for them is wasted export bandwidth. Material.slimGBuffer builds a SLIM_GBUFFER pipeline variant. Its fragment shader has no outputs for those three targets, which WebGPU allows when the matching color targets have a writeMask of 0. The attachments keep their clear values, and the emissive, extension and anisotropy texture fetches are compiled out. Explorer sets slimGBuffer = true on its photogrammetry tilesets (the base photoreal set and the regional scans) and on its flat-colored building tilesets: 16 bytes of color exported per fragment instead of 36.

src/shaders/geometry.wgslWGSL
struct FragmentOutput {
  @location(0) albedo_roughness: vec4<f32>,
  @location(1) normal_metallic : vec4<f32>,
#ifndef SLIM_GBUFFER
  @location(2) emissive        : vec4<f32>,
#endif
  // loc 3 material data: .r shadingModelId · .g specular · .b occlusion · .a custom0
  @location(3) material_data   : vec4<f32>,
#ifndef SLIM_GBUFFER
  @location(4) material_data_2 : vec4<f32>,
  @location(5) material_data_3 : vec4<f32>,
#endif
}

Mask bits in the emissive alpha

The emissive target's alpha carries each draw's 8-bit DrawItem.excludeMask. Its basic use is letting a point or spot light skip surfaces ((surface & light) != 0 means unlit). Explorer assigns two more bits:

Instanced draws have no per-draw uniform. They write 0, and so never exclude a light, unless an instance's tint alpha is above 1: then (alpha - 1) × 256 is its mask. The containers on the container ships' decks are drawn that way, with NOT_GROUND_MASK, so the sea pass leaves them alone.

The HDR target and the swapchain

The working color target is rgba16float (HDR_FORMAT) from the sky pass to the tonemap. Effects that cannot blend in place (stars, distant bodies, heat haze, the smoke veil, the windshield) read the current HDR and write a new one. The aliasing planner returns the old one to the pool as soon as nothing else reads it. The swapchain is configured as rgba16float with colorSpace: 'display-p3' and toneMapping: { mode: 'extended' }. If the browser does not grant extended tone mapping, the canvas is reconfigured to the preferred 8-bit format. That step is not optional: a pipeline targeting the wrong swapchain format invalidates the whole frame's command buffer. On an HDR display the tonemap's hdrPeak (default 4× SDR white) sets how far highlights may go.

Precision, part one

Depth from cockpit to orbit

src/renderer/render_context.ts · src/math/mat4.ts (perspectiveReversed) · src/shaders/modules/depth_util.wgsl · explorer/main.ts (NEAR/FAR, near/far fit) · DistantBodyFeature

Explorer creates its engine with reversedZ: true, both in the normal path and in VR. Reversed-Z maps the near plane to 1 and the far plane to 0:

src/math/mat4.tsTypeScript
static perspectiveReversed(fovY: number, aspect: number, near: number, far: number): Mat4 {
  const f = 1 / Math.tan(fovY / 2);
  const fn = 1 / (far - near);
  // Derived so z_view=-near → 1 and z_view=-far → 0 (the standard near↔far swap).
  return new Mat4([
    f/aspect, 0, 0,             0,
    0,        f, 0,             0,
    0,        0, near*fn,      -1,
    0,        0, far*near*fn,   0,
  ]);
}

Why it works with a float buffer: the stored depth for a point at view distance d is roughly n/d. A float's spacing is proportional to its magnitude, so the resolution in d comes out proportional to d and independent of the near plane. Standard Z puts every distant point near 1.0, where float spacing is coarsest.

Depth resolution, 32-bit float, f ≫ n
reversed: z ≈ n/d ⇒ Δd ≈ 2−23 · d
standard: z ≈ 1 − n/d ⇒ Δd ≈ 2−24 · d² / n
  • n, dnear plane and view distance (m)
  • Δdsmallest distinguishable depth step; ulp(z) divided by |dz/dd| ≈ n/d²
  • e.g.at d = 100 km with n = 1.5 m: about 1.2 cm reversed, about 400 m standard

Every engine pass that reads depth handles both conventions. Depth-reading shaders import depth_util.wgsl and gate on a pipeline-override constant, so the same WGSL serves both conventions:

src/shaders/modules/depth_util.wgslWGSL
override REVERSED_Z: bool = false;

// True when a sampled non-linear depth is the cleared far plane (sky / background).
fn dz_is_background(d: f32) -> bool {
  return select(d >= 1.0, d <= 0.0, REVERSED_Z);
}
// Back to near->0/far->1; exact for the swapped perspective: standard = 1 - reversed.
fn dz_standard(d: f32) -> f32 { return select(d, 1.0 - d, REVERSED_Z); }

World-position reconstruction needs no change, because the uploaded inverse view-projection is the inverse of the reversed matrix. Only sky tests, hard-coded linearizers and depth biases flip. RenderContext supplies depthClearValue (0), depthCompare('less') (returns 'greater') and depthBiasSign(). Two kinds of pass keep standard Z on purpose: shadow maps and reflection-probe captures render with their own projections into their own depth buffers. The CPU must match too. Explorer builds its culling frustum with perspectiveReversed because the near and far rows swap, and the satellite cull, which drops the far plane, indexes it as ctx.reversedZ ? 4 : 5.

Fitting the planes to the altitude

The defaults are NEAR = 1.5 m and FAR = 200_000 m. In the curved-horizon mode (the default), each frame refits both to the active body:

explorer/main.ts · beforeFrameTypeScript
const r = activeBody.groundRadiusAtEcef(cameraEcef);   // ellipsoid-correct
const camAlt = Math.max(0, camRadius - r);
const limb = Math.sqrt(Math.max(camRadius * camRadius - r * r, 0));
far = Math.max(FAR, limb * 1.15 + 100_000);
near = Math.min(Math.max(NEAR, camAlt * 0.0005), far * 0.02);
if (issRide || planeMode || adsbFollow || rideAlong) {
  // The aircraft sits tens of meters away whatever the altitude …
  near = planeMode?.view === 'cockpit' || (adsbFollow && adsbCockpit) ? 0.08
    : issRide?.view === 'cupola' ? 0.3 : Math.min(NEAR, 0.5);
}
1 m 100 m 10 km 1000 km 1e5 km 1 m 100 m 10 km 1000 km 36,000 km camera altitude above the surface (log) far near (free camera) far/near ≈ 1.0×10⁵ at 10 km ≈ 1.4×10⁴ at 400 km
The free camera's planes from the formulas above, for Earth's mean radius. The ratio f/n never exceeds about 1.5×10⁵. Riding in the cockpit pins n at 0.08 m against the same far plane, a ratio in the millions, which reversed-Z handles. The "Earth from the Moon" case is handled by keeping other bodies out of the depth range entirely.

The 1.15 factor and the extra 100 km keep the horizon inside the frustum with margin. Lifting the near plane with altitude (n = 0.0005 · h) is safe because nothing is close to a free camera in space, and it keeps the ratio in check. The radius is groundRadiusAtEcef, not an equatorial constant. A sphere would read the surface of Mars as up to about 2 km underground, starve the far plane and clip the terrain.

Other worlds stay out of the depth buffer

The Moon and Mars share one continuous space with Earth. Stretching the far plane to include the other body, so you could look back at Earth from the Moon, would crush local depth precision and let the distant body's tiles bleed through the near terrain. So far fits only the active body's limb, and every other body is drawn by DistantBodyFeature as an analytic, lit sphere painted only on sky pixels (it reads depth to find them and writes none), after the stars and before god rays and bloom. Its streamed tiles are skipped. It shades only the screen box about the bodies that can show: a planet under half a pixel across whose point of light is dark (by day, low over the ground) is left out, and when none can show the pass is not run at all (it was a millisecond of an M1's daytime frame). The Space page covers how those spheres are shaded.

Precision, part two

The floating origin

src/geo/geo.ts (GeoFrame) · explorer/main.ts (REANCHOR_DIST*, the re-anchor block, addContent) · src/geo/tile_content.ts

Positions are ECEF (Earth-centered, Earth-fixed) in f64 on the CPU: about 6.4×10⁶ m from the origin, where an f32 has a spacing of 0.5 m. The GPU never sees ECEF. A GeoFrame defines a local tangent frame (East → +X, Up → +Y, North → −Z) anchored at originEcef. Its f64 matrix worldFromEcef takes ECEF to an engine "world" in which everything near the camera has small coordinates.

ECEF origin (f64 only) old origin new origin = camera +X east camera path; re-anchor when |p| > 10 km re-anchor distance free camera 10 km chase view 2 km cockpit 250 m f32 spacing at |x| 10 km ≈ 1 mm 250 m ≈ 0.03 mm tiles: baked f64, shifted by a translation
The world frame is re-centered under the camera. The ENU basis normally stays fixed, so re-anchoring is a pure translation that already-baked geometry absorbs. It is re-derived when the basis drifts more than 1° from local up.

The re-anchor distances come from what is on screen. Ten kilometers from the origin an f32 rounds to about a millimeter, which is nothing for tiles hundreds of meters away. From the pilot's seat the instrument panel is under a meter away, where a millimeter is a whole pixel, and the cockpit would visibly jitter more the farther it flew from the last re-anchor. Within 250 m the rounding is about 0.03 mm, well under a tenth of a pixel. So the threshold is REANCHOR_DIST = 10 km for the free camera, 2 km for the chase view and 250 m in a cockpit, including riding along in a live ADS-B aircraft's cockpit.

Baked in f64, shifted per frame

A tile's vertices are multiplied by its full transform (tile → ECEF → the world frame at load time) on the CPU in double precision and uploaded as world positions. The GPU draws them with an identity model matrix. Each tile records the origin it was baked against (bakeOriginEcef). When the origin has moved since, the draw loop adds one translation, worldFromEcefPoint(bakeOrigin), into a pooled copy of the model matrix. No tile is re-baked on a re-anchor.

explorer/main.ts · addContent()TypeScript
const shift = geoFrame.worldFromEcefPointInto(shiftScratch, c.bakeOriginEcef);
// …
if (rigid) {
  // the frame reoriented since this content was baked: full rigid transform, in f64
  modelMatrix = mat4dToEngine(mat4dMul(rigid, Float64Array.from(d.modelMatrix.data)));
} else if (hasOffset) {
  item.shift.data.set(d.modelMatrix.data);   // reuse the pooled matrix's buffer
  item.shift.data[12] += shift.x;
  item.shift.data[13] += shift.y;
  item.shift.data[14] += shift.z;
  modelMatrix = item.shift;
}

When the axes have to turn

A fixed basis drifts from true vertical as you travel, by 1° per roughly 110 km. Several systems assume world +Y is up where the camera is. The cloud deck treats world XZ as horizontal: tilted by tens of degrees, its noise coordinates grow to millions of meters and the clouds break into blocks. So a re-anchor also re-derives the basis once world +Y is more than 1° from local up (REORIENT_COS). On the Moon and Mars "up" is the radial direction. Earth's geodetic normal there would put +Y up to half a turn from true up, giving Mars a black sky by day and daylight by night.

A re-anchor moves every coordinate by −p in one frame. If nothing else changed, TAA and motion blur would reproject that as a full-frame camera jump, a gray smear most visible over the dark Moon. Explorer folds the shift, and any rotation, into the camera's previous-frame view-projection, so temporal effects see continuous motion.

The northeastern United States and southeastern Canada seen from low orbit: the Great Lakes, the St. Lawrence and the Atlantic coast under a bright atmospheric limb.
The same frame structure, far from the ground. From orbit the far plane follows the limb, the near plane has risen with altitude, the clouds have faded out above their deck, and the floating origin still sits under the camera.
The draw path

From streamed tile to draw call

src/geo/tile_upload_gate.ts · src/geo/tile_content.ts · src/geo/tileset.ts · src/renderer/render_graph/passes/geometry_pass.ts · shadow_pass.ts · src/renderer/features/geometry_feature.ts

The upload gate

Tiles finish downloading in bursts. Flying straight at speed, a whole ring of them a few hundred meters ahead arrives together. Each one that becomes live costs the main thread and the browser's GPU process its texture and buffer uploads, a re-recorded render bundle and, with collision on, cooked colliders. Eight or twelve at once would hold a frame for two or three refreshes every few seconds. tileUploadGate is a FrameGate with two slots per frame. The loader awaits a slot before its GPU work, and Explorer calls tileUploadGate.tick() once per frame. As the source puts it: "A tile a frame or two later is not seen; the hitch is."

src/geo/tile_upload_gate.tsTypeScript
tick(): void {
  this.left = Math.max(1, this.perFrame);
  while (this.left > 0 && this.waiting.length > 0) {
    this.left--;
    this.waiting.shift()!();
  }
}
export const tileUploadGate = new FrameGate(2);

Static meshes, not the skinned path

Tiles load through GltfLoader.loadStatic into plain, non-skinned meshes, one vertex pack and one GPU buffer per primitive, and draw through the deferred GeometryFeature. The explanation comes straight from the code comments. The skinned path would give every tile draw a joint-palette bind group it never needs. With six render targets bound, that extra binding pushes the deferred pass past what the code calls a "6-MRT per-submit descriptor/texture-fetch limit", and distant textured tiles render black. Static meshes avoid the per-tile binding, and with it the black tiles. They also keep the streaming hot path from building and then discarding a skinned mesh for every tile.

Draw lists

Each frame beforeFrame resets pooled arrays (liveOpaqueDraws, runwayDrawItems, liveShadowCasters, liveWaterDraws, livePointDraws), runs the terrain and building tilesets' selection against the frustum (built with the reversed projection) and the screen-space-error budget, and appends a pooled DrawItem per drawable. Items are reused across frames, so the per-tile loop allocates no objects. With shadows on, each opaque item also gets a shadow-caster entry sharing the same mesh and matrix. Features never see tilesets. They hold closures such as () => liveOpaqueDraws and read the lists in update.

Render bundles and draw storage

The geometry pass replays its per-draw items from a cached GPURenderBundle (useRenderBundle), re-recorded only when the list's signature changes. Model matrices are not captured in the bundle: they live in a buffer uploaded every frame. Where a material supports it, the HAS_DRAW_STORAGE variant reads each draw's model record from one storage buffer indexed by draw (firstInstance), so recording the bundle needs no group-1 bind per draw. The shadow pass does the same per level: concentric clipmap levels are camera-centered, so the inner ones churn as the camera moves while the outer ones stay stable for many frames. Without bundles a streamed-tile city would spend most of its CPU frame recording about 500 caster draws per level.

Pitfall

WebKit rejects fragment-less (depth-only) pipelines inside render bundles at setPipeline, even though the spec allows them (WebKit bug 319980, fixed upstream but still present in iOS Safari 27.2). One invalid bundle fails the whole frame's command buffer, and Explorer submits the frame as one command buffer, so an iPhone would render whole frames black. Since bundles only save CPU time, supportsShadowBundles(userAgent) turns shadow bundles off for every WebKit browser. The geometry pass's bundles work there, but they skip zero-length meshes because WebKit also rejects drawIndexed with zero indices on a zero-size index buffer inside a bundle.

Ground without discard, for tile-based GPUs

A fragment shader that contains discard turns off the hidden-surface removal of a tile-based GPU (Apple's, and most phones'): every layer of overdraw is shaded, not only the nearest. The ground shader can discard in three places: inside a tunnel's box where the tube meets the surface (and, from inside a tunnel, along its covered stretches near the camera), under the road mask's square, and where the sea is cut. So the geometry pass gives a ground draw (DrawItem.groundDetail: terrain tiles, the map's buildings) the pipeline without discard (opaqueVariant) unless its bounding sphere reaches one of those cuts (groundCutReaches: each tunnel box's own sphere, and the two columns tested across their plane). The cuts' positions are snapped to a 64 m grid, and the retained draws look at their pipelines again only when a snapped position changes. The shadow pass does the same for its cutting pipeline: a caster takes it only near one cut box, not anywhere in the sphere about all of them, which spans kilometers in a city. On an M1, San Francisco from 400 m, this took the G-buffer from 5.8 to 3.6 ms at Medium (GPU busy 17.9 → 14.7 ms a frame), 7.2 to 4.6 ms at High, and 3.4 to 3.1 ms on the phone preset.

GPU occlusion culling (opt-in)

GeometryFeature.setOcclusionCull(true) builds a Hi-Z pyramid from each frame's depth into a persistent r32float texture. The next frame re-imports it, packs a bounding sphere and indirect args per draw, and runs a cull compute pass whose output buffer feeds drawIndexedIndirect. The graph orders cull → draw → Hi-Z rebuild from the declared accesses, so the cull reads last frame's pyramid before it is overwritten. The cull honors reversed-Z, and a draw can opt out (noOcclusionCull gives it a 10⁹ m sphere that always passes). Explorer pins occlusionCull off. Photoreal tiles are large, city-block-sized meshes, and culling them gives no measurable gain.

Budgets

Resolution, phones and measurement

src/renderer/render_context.ts · src/engine/antialiasing.ts · explorer/main.ts (defaultTileMemoryMB, GRAPHICS_PRESETS, PLANET_AA_MODES) · src/renderer/gpu_profiler.ts · TODO/explorer-render-graph-catalog.md

Three resolution controls

Only TAA, TAAU and Off are offered (PLANET_AA_MODES). Without a temporal history the shadow filter's and GTAO's noise patterns stay fixed and the streamed tiles' thin edges crawl, and SMAA (three passes) costs about what TAA's single resolve does. SMAA is still registered for the VR headset.

Phones

defaultTileMemoryMB() classifies the device by user agent, plus touch support for iPads that report as Macintosh, and returns a tile-cache budget: 256 MB on iOS, 256–768 MB on other mobile devices depending on navigator.deviceMemory, and up to 2,400 MB on desktop. iOS is strict because Safari counts CPU and GPU memory as one pool and kills the tab past the device limit, with about 650 MB of that taken by the app before any tile loads. The same mobile flag shrinks fixed-size render resources:

ResourceDesktopPhone
Sun shadow map, per level2048²1024²
Sky probe capture / prefiltered512² / 256²256² / 128²
Star catalog equirect4096 wide2048 wide (the 4096 bake is 64 MB)
Cloud Beer shadow mapdefault size and interval256², rebuilt every 8 frames
Rain and snow particles×1×0.5
Cloud stylelayeredclassic (layered volumes are about 50 MB)
Lit-window search in the city lightsonoff
Graphics presetHighLow, applied once (TAAU, no GTAO, grass, trees, engine god rays or motion blur)

The GPU profiler

GpuProfiler uses the 'timestamp-query' feature. While it is enabled, the graph gives each render and compute pass a pair of timestampWrites (up to 128 passes a frame), resolves the query set before finish(), copies it to a mappable buffer and reads it back asynchronously a frame or two later. Results are exponentially smoothed per pass name, because Chrome quantizes timestamps: the code cites 100 µs by default, and the catalog probe observes about 65 µs. Single small passes often read as zero, but the mean over many frames is still useful. An onFrame callback exposes raw per-frame times for spike hunting. Explorer creates one at startup, disabled so it costs nothing, and exposes it on window.__planet.gpuProfiler for automation.

What the default frame costs

The numbers below come from the render-graph catalog, a scripted probe of the live app at 1280×720 on a desktop GPU with the aircraft in flight. They are GPU means over about 500 frames. The whole default frame measures 2.8–2.9 ms of GPU time, vsync-bound at about 141 fps.

Pass groupGPU msNote
GeometryPass0.59six targets + depth, clear
Grass scatter + draw · trees scatter, near, draw0.13 · 0.43
Shadow levels~0.01 each5 of 8 levels that frame; ~0.15 when a level re-renders
Sky-view bake · sky0.03 · 0.05sky-view LUT 192×108
Skylight bake0.8–1.7a 2×1 LUT, keyed on altitude and local up, so re-baked about every 6 km of travel
GTAO (3 passes)0.07half resolution
Aerial froxel volume0.13compute
Deferred lighting · point/spot0.26 · 0.03
God rays (march + blurs + composite)0.30half resolution
HQ clouds0.31–1.85tracks cloud cover and march steps (Ultra highest)
Lens bloom (12 passes)0.08
TAA · motion blur · flare · exposure · tonemap0.05 · 0.02 · 0.01 · 0.02 · 0.04

The volumetric clouds and the occasional skylight bake dominate. Everything else together comes to well under two milliseconds. By configuration, the Low preset runs 37 passes at 2.13 ms, TAAU (rendering 858×482) 1.96 ms, Ultra 4.49 ms, and every optional extra at once 4.42 ms. The rule behind those counts is that a feature with nothing to do adds no pass: no point-cloud passes without point clouds, no walker pass loading and storing the whole G-buffer without walkers, no star or distant-body passes copying the HDR in daylight, and no shadow levels cleared every frame with shadows off.

Design note

Measure in a plain browser. A capture tool's per-call stack traces can double this frame's cost, and the engine's own ctx.fps is not the requestAnimationFrame rate, because the next frame is scheduled after execute() resolves. For the same reason the graph does not await its frame error scope before returning: that await would hold the next frame past vsync.

The next page, Lighting, picks up at the deferred lighting pass: what it does with the six targets described here, and how the sun, the Moon, the sky probe, AO and the local lights combine.

Further reading

References

  1. Y. O'Donnell, “FrameGraph: Extensible Rendering Architecture”, GDC 2017. The idea of declaring passes and resources per frame and letting a compiler cull, order and alias them.
  2. T. Wihlidal, “Halcyon: Rapid Innovation using Modern Graphics”, Digital Dragons 2018. Render graphs with transient resource aliasing at production scale.
  3. E. Persson, “Creating Vast Game Worlds: Experiences from Avalanche Studios”, SIGGRAPH 2012 Advances. Reversed floating-point depth for very large view distances.
  4. N. Reed, “Depth Precision Visualized”, 2015. Why reversed-Z with a float buffer gives near-uniform relative precision.
  5. P. Cozzi and K. Ring, 3D Engine Design for Virtual Globes, CRC Press, 2011. Floating origins, relative-to-center rendering and depth-buffer precision for globes.
  6. W3C, WebGPU specification (timestamp queries, render bundles, TRANSIENT_ATTACHMENT, canvas tone mapping). The API features this frame depends on.
  7. OGC, 3D Tiles specification 1.1. The format of the streamed content that fills liveOpaqueDraws.