public static class TerrainMipsThe reduced copies of a tile's heights that a coarse patch reads.
Remarks
[docs/plan/31 § T1]'s last owed item, and [§ T2] is what wants it. A CDLOD patch at level three samples every eighth texel of the heightmap; without a mip chain it reads level 0 and gets a height nothing between the samples ever had, which is the coarse patch shimmering as the camera moves.
⚠ Reduced by the maximum, not the average, and this is the decision the whole file is about. An averaged mip sinks a ridge: four samples of which one is a peak average to a quarter of it, so a mountain gets shorter every level and the silhouette a distant patch draws is not the mountain's. A maximum keeps the ridge and raises the valleys, which errs towards geometry being above where it should be — the direction that hides a crack rather than opening one, and the direction the collision approximation is already conservative in.
⚠ Per tile, not over the whole grid, because a tile is what a texture is. Reducing across a tile boundary would mix two textures' texels into one, which is [§ D2]'s seam arriving through the mip chain — and the shared boundary sample belongs to both tiles, so each reduces its own copy of it and the two agree by construction.
⚠ A tile's sample count is a power of two plus one, so a level is not half its parent. A 129-sample tile reduces to 65, then 33 — (n + 1) / 2 — which is what keeps the boundary sample on the boundary at every level. Halving the count instead drops the last row, and the seam it opens is one texel wide and permanent.
Fields and properties (1)
public const int MinimumSamplesThe smallest level that is still a grid of quads.
Methods (4)
public static int SamplesAt(int tileSamples, int level)How many samples a level of a tile is, on a side.
public static int LevelCount(int tileSamples)How many levels a tile of this size has, level 0 included.
public static long ChainSamples(int tileSamples)How many samples every level of a tile occupies together.
public static long Build(Terrain terrain, int tileX, int tileZ, Span<ushort> destination)Builds every level of one tile's height mip chain.
Used by (7)
- TerrainAtlasVixen.Terrain
- TerrainAtlasTestsVixen.Terrain.Tests
- TerrainMipTestsVixen.Terrain.Tests
- TerrainRendererVixen.Rendering.Terrain
- TerrainStreamerVixen.Rendering.Terrain
- TerrainTilePagesVixen.Rendering.Terrain
- TerrainTileSourceVixen.Rendering.Terrain