Procedural Planets

Scale procedural planetary bodies in Three.js r185 WebGPU/TSL. Use when global curvature needs a cube-sphere quadtree, a sustained ground view needs a tangent clipmap, an orbit-to-ground transition needs both, or a gas-giant cloud deck needs body-scale band fields.

Image: Quadtree planet correctness presentation. Source lab: webgpu-quadtree-planet.

$threejs-procedural-planets 1 primary target 1 flagship 1 secondary surface native evidence pending Latest skill update commit 2ce13bc ↗ SKILL.md on GitHub ↗ raw (for agents) ↗

Primary target surface

These rendering routes are generated from canonical source. Native-WebGPU acceptance remains separate from entrypoint availability.

Evidence reports

Source hashes, claim verdicts, promoted same-lab media, fixed routes, exact tier contracts, and current limitations.

The approach, mathematically

The planet is a cube-sphere: six quadtree faces whose vertices project to the sphere, displaced by a height field composed of crater, mountain, and biome causes:

$$\mathbf p' = \hat{\mathbf p}\,\big(R + h(\hat{\mathbf p})\big)$$

Quadtree LOD splits a patch when its projected screen error exceeds a threshold — geometric error over distance:

$$\tau = \frac{e_{patch}}{d}\cdot\frac{w_{screen}}{2\tan(\phi/2)} > \tau_{max} \Rightarrow \text{split}$$

Normals come analytically from the height gradient in the tangent frame rather than post-hoc geometry differencing: $\mathbf n \propto \hat{\mathbf p} - \nabla_{\!s} h$, keeping shading stable across LOD seams. Craters are radial profiles $h_c(r) = f(r/r_c)$ with rim uplift and floor flattening, summed with amplitude-sorted dominance so overlaps read as impact history.

Preview and evidence ledger

Every image identifies what it proves. Page screenshots demonstrate the published presentation only; generated inputs demonstrate asset channels only; rendering acceptance still requires same-lab readback and a schema-v2 bundle.

Canonical runtime evidence pending10 published images
Native WebGPU runtime evidence preview

Native WebGPU Quadtree Planet

Evidence pending
visualCorrectness
INSUFFICIENT_EVIDENCE
mechanismCorrectness
PASS
performanceCompliance
NOT_CLAIMED
gpuAttribution
NOT_CLAIMED
lifecycleStability
INSUFFICIENT_EVIDENCE
visualError
PASS
  • Current-source correctness capture after interleaved vertex packing + adapter maxBufferSize request; validate:artifacts structuralVerdict PASS.
  • GPU timestamps NOT_CLAIMED; visualCorrectness and lifecycle remain INSUFFICIENT_EVIDENCE; not a publishable release-bundle.
  • Root cause fixed: separate BufferAttributes exceeded WebGPU max vertex buffers (16>8); geometry is now one InterleavedBuffer.

The full skill

The complete SKILL.md as loaded by agents, rendered verbatim.

Procedural Planets

Choose the body-scale representation first. One set of planet-space causes must drive geometry, normals, material identity, queries, diagnostics, water/coast handoffs, and atmosphere inputs.

Process

  1. Gate body scale. Test whether curvature, horizon, global geodesy, orbit-to-ground transition, or atmosphere coupling is observable. A bounded local site belongs to procedural fields and geometry when tangent-plane sagitta, normal rotation, geodesic, horizon, and projected errors all pass. Read planet-field-and-atmosphere-systems.md when deriving the body-scale gate.

    Complete when: the accepted camera and data domain either proves a local approximation or names at least one body-scale observable that requires this skill.

  2. Freeze the body model and units. Declare center, sphere radius or ellipsoid axes in meters, metersPerWorldUnit, height and sea-level datum, body/world transform, origin policy, surface-coordinate meaning, and atmosphere bottom/top geometry. When a sphere approximates an ellipsoid, apply the reference's position, normal, area, geodesic, horizon, atmosphere- altitude, and optical-depth error gate. Give each changing field one owner and one version.

    Complete when: every length and vector has units and a frame, surface altitude has one definition, render-origin changes leave physical field identity unchanged, and the spherical branch either passes every declared approximation gate or is rejected in favor of the ellipsoid.

  3. Select mapping and spatial representation. Choose normalized, spherified, or verified equal-area cube mapping from distortion and inverse requirements. Choose a cube-face quadtree for arbitrary globe views, a tangent clipmap for sustained local views, or a hybrid with an explicit near/far handoff. A gas/cloud-deck body uses continuous wrapped band fields rather than solid-terrain displacement. Read the reference when selecting a mapping, ellipsoid convention, quadtree, clipmap, or hybrid.

    Complete when: mapping Jacobian, seams, inverse/domain validity, camera domain, and near/far ownership all have falsifiable gates.

  4. Build error-bounded LOD and submission. For the global branch, maintain six 2:1-balanced face quadtrees, continuous parent morph, and one of the 16 four-edge transition masks. Reuse a shared indexed grid and submit compact patch records in instanced or indirect mask bins. For clipmaps, bound ring error, recentering, and far-field ownership. Evaluate physical-pixel error over the complete displaced support for every active view.

    Before allocating compute, storage, or indirect resources, run await renderer.init() and require renderer.backend.isWebGPUBackend === true. Otherwise keep planning on the CPU or report the native-WebGPU branch unavailable.

    Complete when: projected error, hysteresis, and submission bounds pass, plus every selected branch satisfies its own criterion:

    • global: 2:1 balance holds across face edges/corners, all 16 masks are crack-free, and production submission has no per-patch draw loop;
    • clipmap: rings cover the local domain, recentering preserves field coordinates, curvature/reconstruction error passes, and one far-body owner covers beyond the outer ring;
    • hybrid: near/far coverage has no gap and one composite owner in the overlap, composite position and normal remain continuous through the handoff, and overlap residency is bounded;
    • gas/cloud deck: wrapped-longitude seams, advection continuity, stable storm identity, and conservative advected bounds pass.
  5. Build shared causal fields. Define common field functions for reference direction, displacement, tangent gradient, geology, craters, climate, hydrology, snow/ice, material causes, queries, and diagnostics. Direct, compute-cached, and CPU-visible paths use the same schema and identity constants. Cache only dirty patch causes, include cross-face filter support, and validate gradients independently before using analytic normals. Read the reference when implementing caches, crater fields, detail filtering, CPU/TSL parity, normals, materials, or gas-band fields.

    GPU patch min/max bounds use workgroup reduction plus deterministic merging, or a proven monotonic ordered-integer encoding with explicit sign, NaN, and decode-error rules. Do not rely on unsupported float atomics.

    Complete when: geometry and shading use the same height function, cache invalidation follows causes rather than cameras, parity covers every published channel, min/max reduction is legal and conservative, and metric value and normal errors pass their own gates.

  6. Publish narrow handoffs. A field handoff states producer, consumer, owner, units, frame/origin, sample time or interval, represented support and filter, validity/staleness, version, and error. A planetary coast additionally publishes mean surface, seabed height, metric coast distance/frame, source resolution, and uncertainty. Atmosphere receives the same reference surface, transform, metersPerWorldUnit, altitude convention, shell geometry, sun frame, and scene-linear radiometric basis. Read the coast and atmosphere sections of the reference when either consumer is active.

    Complete when: each consumer names one authoritative producer, rejects invalid or stale data, and performs no frame-critical GPU readback.

  7. Bind materials and presentation. Use MeshStandardNodeMaterial or MeshPhysicalNodeMaterial from shared field causes. Keep data textures linear, preserve declared color encodings, and hand HDR scene color to the one RenderPipeline output transform. Rebuild only dirty field tiles or LOD frontier state, keep in-flight cache resources immutable, and dispose retired buffers, textures, passes, and indirect state.

    Complete when: output conversion has one owner, direct and cached paths agree, origin rebases preserve the body, and repeated resize/replacement reaches a stable resource plateau.

  8. Verify the selected branches. Capture orbit, horizon, and close views; unlit silhouette; flat albedo without atmosphere; grazing light; mapping, patch-error, transition-mask, normal, material, coast, and atmosphere diagnostics. Sweep split/merge boundaries and use multiple fixed seeds.

    Complete when: the scale and sphere/ellipsoid gates, mapping distortion, every selected branch criterion above, shared-field parity, derivative accuracy, atmosphere units, triangle/draw counts, cache bytes, timing, and zero runtime readbacks all have direct evidence.

Ownership Boundary

  • Use $threejs-procedural-fields and $threejs-procedural-geometry for local terrain whose accepted domain does not expose body curvature or global LOD.
  • Use $threejs-water-optics for the time-varying free surface, currents, breaking, foam, and water optics; this skill owns the reference surface, seabed, and planetary coast analysis.
  • Use $threejs-sky-atmosphere-and-haze for scattering and aerial perspective; this skill owns the surface-side geometry and units handoff.
  • Use $threejs-image-pipeline, $threejs-scalable-real-time-shadows, and $threejs-visual-validation for shared output, shadows, and evidence.

This skill owns the body-scale surface representation, coupled planetary fields, patch LOD/submission, query parity, and surface-side handoffs.

Secondary provider surfaces

Preserved concept proxies and generated-asset previews. They are excluded from primary completion counts and link to the canonical lab through the schema-v2 registry.