Skip to main content

Function: encodeNTC()

encodeNTC(cpuModel, channelClassification, options?): any

A .ntc (Neural Texture Compression) asset is one shared mip pyramid of latent feature grids + MLP decoder (NVIDIA NTC style: one small decoder, many jointly-fit, correlated PBR output channels), plus the channel layout/constant-value metadata needed to slice that decoder's output back into named PBR channels at load time (see NTCLoader.js / NTCNodeMaterial.js).

cpuModel is { channels, levels, mipsPerLevel, grids, decoder: { layers }, outputChannels, textureResolution, maxLod } - exactly what NTCTrainer/NTCFit.fitNTCMaterial() produces (see NTCGridPyramidModel.js). channelClassification is { activeChannels, constantValues, totalChannels, packCount, renderFlags } - the layout that model's output was trained against (see NTCSource.classifyMaterialChannels).

options.uvTransform (or, if absent, cpuModel.uvTransform) is an optional THREE.Matrix3 mapping mesh/query UV into the local space this model's grids + MLP were fit against - see NTCFormat.js's decodeUvTransform/encodeUvTransform/isIdentityUvTransform and NTCNodeMaterial.js's query-time coord build. Omitted from the manifest (defaulting to identity on load) when identity or not supplied.

Channel keys identify reconstruction semantics. Per-asset encodings preserve trained output activations independently of future vocabulary defaults.

Parameters​

cpuModel​

any

channelClassification​

any

options?​

any = {}

Returns​

any