Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 9.12 KB

asteroid.md

File metadata and controls

29 lines (22 loc) · 9.12 KB

Renderers: asteroids

Part of: Rendering & haptics spec (index) · Sections: R7 (intro), R7.1, R7.2 · Implements: D-01, D-33, Q-43, Q-103, Q-117, Q-114, Q-210, Q-326, D-37, Q-287, Q-299 to Q-302, Q-334, Q-61, D-32, Q-133, Q-353 · Read with: surface-generation.md (R6), engines.md (R5.9), display-rules.md (R5), haptics/sources.md (R8.4)

R7. Per-type rendering specs

Each spec lists the required card fields. If one is missing, the dependent layer is refused and added to missing.

R7.1 asteroid_shape (Bennu, Eros, Vesta, DAMIT objects)

  • Requires: shape_source, diameter_km.
  • Mesh: load the GLB/OBJ (decimated to ≤50k triangles, §5.5) and scale it to the measured diameter. Tag measured.
  • Mesh address (viewer): shape_source is loaded only if it is a same-origin path (/… or ./…) ending in .glb, .gltf or .obj (Q-44: the backend cache serves it, D-25). Any other value (an http(s) URL, a DOI) is refused and the body falls back to a sphere. The model is scaled so its bounding sphere equals the diameter on the card (assumption [verify], Q-43, R12 #19: catalogue diameters are often volume-equivalent, which would make an elongated body too long). Once a model loads, its own size wins (Real size, below).
  • Spin: rot_period_h sped up, with the factor shown on screen ("×1000"). Tag measured.
  • Lighting (issue #71, Q-210): the procedural body uses ShapeMaterial with rock: true (Lommel-Seeliger blended with Lambert and a phase falloff) and layers reflectance (model_dependent) and self_shadow; the displaced mesh casts the shadows on the high and medium levels. Displacement uses displacementBias = -relief_amp/2 because height.png holds 0.5 + h/relief_amp.
  • Material: colour = base_rgb · brightness. No procedural detail by default: these meshes often have no UVs, and the real shape is the point.
  • Issue #43 additions (each its own layer with its own tag, so the honesty toggle can hide it; see planShapeLayers): reflectance (model_dependent) is Lommel-Seeliger, 2/π · μ0/(μ0+μ) through a custom lighting model, so the shadow map still multiplies the light (A7.4); self_shadow is a shadow map of the shape from the Sun direction so crater rims shadow the surface at low Sun (derived when the direction comes from the phase angle on the card, artistic when it is a default or a hint); baked_ao (derived) is per-vertex ambient occlusion baked with a BVH (cosine-weighted visibility, deterministic, 16 rays at every quality level so the cached result does not depend on which level loaded first, in slices after the model shows; drawn only while the plan asks for it, so Measured only never shows an AO baked earlier); regolith (artistic, tier 5) adds normal detail only at wavelengths shorter than two mean edges of the model, so it never changes the silhouette (D-33). With these hidden (Measured only) the model is drawn with the standard material as before.
  • Levels of detail: the backend serves <slug>.glb and <slug>.lod1.glb (README "Shape models"). The low quality level loads lod1; the others load full detail. The 160 px rule is wired: every frame ViewerApp computes the body's on-screen diameter in CSS pixels (bodyScreenPx: scene radius, camera distance, the 40 degree field of view, canvas height) and hands it to BuiltScene.setScreenPx, which re-chooses the level with chooseLod. Below 160 px the coarse level is drawn; it is kept until the body is 1.25 times larger (LOD_HYSTERESIS), so zooming around the limit does not reload the model. The first model is chosen before a size is known, so a small body loads full detail first and then switches. A tier change while the first model still loads is honoured. A missing lod1 falls back to full detail.
  • Real size: a loaded GLB is in metres (Q-61), so half of its longest box extent is the measured size and the scale bar shows it (ViewerApp.setMeshMeasuredHandler); the catalogue diameter_km still sizes the plain-sphere fallback.
  • Haptics and sound: the body tone from mesh height (R8.9.1, Q-133; height defined in §8.4, Proposed (Q-188)). It is the demo body's sound: 433 Eros is asteroid_shape (Q-61). After the event the mesh-normal ticks add vibration (R8.4). Not built yet: both need the three-mesh-bvh raycast, so mesh haptics are refused today (mesh_normals, Q-78).

R7.2 asteroid_procedural

  • Requires: diameter_km. Optional: lightcurve_amp_mag, gaia_rgb, albedo, band depths.
  • Mesh: SphereGeometry(1, 256, 128), scaled by ellipsoid_axes.
  • Material: albedo, normal and roughness maps from §6. Displacement by the baked height map (issue #43) needs relief_amp, an optional field of RenderTextures (textures.relief_amp, a fraction of the radius, R6.2; Q-103). Since issue #62 (Q-117) the backend sends it for this kind (since D-36, Q-210 and Q-326 the design range of the height field: strength-limited for solid and fractured bodies, slope-limited at the angle of repose for rubble piles; about 1.0 for a 2 km body, 0.973 for the procedural fixture) together with an artistic layer displacement, so the surface is displaced on the high and medium quality levels from "+ Artistic" (the phone's low level keeps the normal map only, and there the layer is refused with reason quality, "phone tier: relief shows as shading only", from PlanContext.qualityTier). Without relief_amp the layer displacement is refused with reason backend and the plain words say that the server does not send the relief height yet, a gap in the service and not missing data about the object. The baked albedo already holds the colour: it is shown in the visible view only, with a white tint, and left out of the SPHEREx infrared view (R5.2). Displacement uses displacementScale = relief_amp on the high and medium quality levels; the low level (phone) keeps the normal map only. Relief (Q-117 as amended by Q-210 and Q-326): relief_amp is no longer a per-style 3 % value. It is the peak-to-peak range of the physics height field of R6.2 and R6.3 (lump by structure, craters 0.33 r deep at full freshness), tagged artistic as a design range. The one height field drives normals, displacement, haptics and sound, so the viewer does not raise the amplitude to roughen the outline; the silhouette comes from that field and the lightcurve ellipsoid. The asteroid_procedural.artistic.medium golden covers the displacement.
  • Measured-only state: a plain sphere with a flat tint (the ellipsoid layer is model_dependent, so it is hidden there; the body stays only if the size is measured, Q-117; the fixture's diameter is now measured). From + Estimated the colour is lifted for contrast (viewer/renderers/asteroidLift.ts, artistic; rule in R5.1, Q-117), never at Measured only.
  • Rock engine (D-37; Q-299 to Q-302, Q-334; R5.9): at + Artistic the prototype's rock engine draws asteroid_procedural, asteroid_shape and comet nuclei on its own WebGL2 canvas (RockStage, RockCloseUp); at + Estimated and Measured only, and whenever it cannot run, the three.js body above draws. cardToRock fills the prototype's preset from the card: density by class analog (C: Bennu 1,190 kg/m³, Lauretta et al. 2019; S: Eros 2,670; else 1,500; comet 530; inferred_from_analog); the card seed is hashed into [0, 97) in steps of 1/4096 for display and the cache key, and since issue #93 (Q-353) a card body's noise takes seed3 (seedVec of the seed's 32-bit hash) and its shape and crater RNG the full hash, with per-crater ellipticity, rim height and rim wave and 0 to 2 boulders a cell (artistic; the artifact's own bodies keep their integer seeds and draw as before); for a preset body whose drawn value differs from the card the badge says "the card says X". The engine's crater depth, crater cap and rubble relief follow the baker (Q-326, applied by extract-rock-engine.py PATCHES). A shape-model body (Bennu, 67P) is fed to the engine as a radial height map, and its lump and crater readouts are hidden. Lighting is a Lommel–Seeliger and Lambert blend with an exponential phase darkening and no opposition surge, not fitted to any body: artistic. Comets get the prototype's sunward jets (Q-301).
  • Haptics and sound: the body tone from height.bin (R8.9.1, Q-133). It is artistic, so it is heard from + Artistic (R5.3; the build raises the level, R5.8). The height-map ticks are the post-event vibration (§8.4).