surfaceDetailFloor

function surfaceDetailFloor
universe/src/terrain.ts:816
surfaceDetailFloor(surface: SurfaceParameters, resolution: number, tolerance: number) → number

The subdivision level past which a patch is an upsample of its parent.

Refinement is supposed to buy detail, and below some level this field has none left to sell. A fixed ceiling gets that wrong in both directions: at the three bands this replaced, the streamer asked for level 12 wherever the ground was close, which was sixteen times the patches of level 10 for output identical to the last bit of a float; at the band stack it would stop two levels above the finest crater rim.

It measures the field the mesh is made of, which is the drawn one. That is drawnElevation and not groundElevation, and the distinction decides how deep a landing streams: the canonical field stops at eight meters of wavelength, so measured against it the search reports a floor whose cells are one to seven meters across and the ground under a standing camera is a plane. The presentational tail cuts up to MICRO_CRATER_CEILING, which is over the tolerance and therefore moves the answer — one to four levels across the zoo, and ten on a body the canonical crater ladder gave nothing. A tail bounded by the tolerance instead could not have moved it by one, however fine its wavelength, because the tolerance is the amplitude floor and the search would call every level of it quiet.

So the floor is measured rather than assumed, and measured from the field rather than from a model of it: at each level, take one grid cell of a patch at that level, and compare the middle of the cell against the bilinear interpolation of its corners. That difference is the detail refinement would add. Twenty-four probe directions spread by the golden angle, five samples each, and the search stops at the first level under tolerance whose stencils touched dry ground — a sea-flattened stencil is the clamp talking, not the field, and the walk carries past it.

About 1,500 samples, and 16 to 32 ms for a body on the main thread — Miranda 15.5, Earth 20.4, Iapetus 21.6, Callisto 30.2, Luna 32.2. That is the same order as deriving the body's survey sites rather than the quarter of it this once was, because the band stack and the crater neighborhood both grew under it.

Cold, and the warm figure is half of it. This is the first thing to touch the band stack for a body, so nothing is JIT-warm when it runs — the same search costs 4 to 16 ms once the field has been sampled, and quoting that figure would be quoting a number the application never pays. It is memoized, and the cold number is what a body costs the first time anything asks — which is why nothing in the browser asks on the main thread. It reads only what HeightfieldRequestPayload already carries, so it is a second task on the pool, universe.prepareSurface, and the streamer holds a body's ground back for the frames it takes rather than paying it inside the frame that body arrives. The synchronous path here is what a host with no pool gets: the headless runner, the tests and the Node benchmarks, none of which has a frame to drop.

This lives beside elevationAt because it is a property of those bands and has to move when they do — the band stack put crater rims and scarps into the field at scales the three bands never reached, and this reported a deeper floor the same day, with no constant to raise.

A quiet level is not a floor, and the band stack is why. With smooth multi-octave noise the residual falls monotonically and the first quiet level is the answer. A crater ladder is discrete: level after level of features at one size each, so a stencil that straddles nothing at one level lands on a rim at the next, and the residual comes back up. Taking the first quiet level returned a floor whose own residual was twice the tolerance. So the search asks for three consecutive quiet levels, which is the claim it was making all along — the field has nothing more to say from here down — rather than the weaker one it was testing.

One level of margin is added on top, because twenty-four probes are an estimate of a maximum over a sphere and the cost of being one level shallow is ground that is right to a meter instead of to half of one.

surfaceSurfaceParameters
Undocumented
resolutionnumber
Undocumented
tolerancenumber
Undocumented
Returnsnumber