Skip to main content

Function: resolveNTCGridPyramidOptions()

resolveNTCGridPyramidOptions(options?): ResolvedNTCGridPyramidOptions

Single source of truth for the model-shape options shared by the CPU model, the GPU training layout, and the trainer's defaults. Resolving these once here - rather than each of those three re-declaring the same defaults independently - means they can't silently drift apart.

textureResolution (the source texture's largest dimension) determines maxLod - the total mip range this model is meant to support, down to 1x1 - independently of how many feature levels are actually stored (levels/mipsPerLevel, see NTCGridModel.js/NTCMipBands.js): a handful of stored levels can still be asked to reconstruct a much deeper mip chain, each level just gets reused for more than one of those mips.

baseResolution (the finest stored grid's resolution) defaults to textureResolution itself (capped at MAX_GRID_RESOLUTION) when not given explicitly - this matters: LOD 0 always means "reconstruct the source texture's own mip 0", so if the finest grid were left far coarser than the texture (e.g. a fixed small default while the texture is large), the model would be asked to reconstruct much more detail at LOD 0 than its finest grid could ever hold, and - since levels/mipsPerLevel only cover a levels * mipsPerLevel-mip-deep band before the last stored level becomes an open-ended tail (see NTCMipBands.js) - most realistic viewing distances would land on that same tiny tail level, looking close to a flat color. Tying the default finest resolution to the real texture resolution keeps LOD 0 meaningful without the caller having to know to set baseResolution explicitly. Falls back to a fixed 128 only when neither baseResolution nor textureResolution is known (e.g. a model built by hand, with no real texture in the picture at all).

Parameters​

options?​

NTCGridPyramidOptions = {}

Returns​

ResolvedNTCGridPyramidOptions