Function: fitNTCMaterial()
fitNTCMaterial(
renderer,material,options?):Promise<{channelClassification: {activeChannels:NTCLayoutChannel[];constantValues:Record<string,unknown>;packCount:number;renderFlags: {side:unknown;transparent:boolean|undefined; };totalChannels:number; };cpuModel:NTCGridPyramidModel;iteration:number;iterations:number;loss:number;material:any;stoppedEarly:boolean; }>
End-to-end convenience path covering the sequence a from-scratch consumer
of this addon would otherwise have to hand-assemble from five separate
low-level pieces: classify the material's channels, bake the active ones
to textures, train a NTCTrainer against them, and construct (and, on
every progress tick, re-construct and dispose the previous)
NTCNodeMaterial.
options is passed straight through to NTCTrainer (so levels,
hiddenSizes, iterations, learningRate, etc. all apply), plus a few
fit-specific fields: resolution (bake resolution, default 512),
debugView (default 'shaded'), channels (the channel vocabulary to fit
against, default the built-in CHANNELS - see three-ntc's NTCFormat.js),
uvTransform (a THREE.Matrix3 mapping mesh/query UV into local space,
default identity - see NTCTextureSource.bakeColorNodeToTexture's doc
comment and NTCMaterialXUvTransform.js for how one gets detected from a
MaterialX graph), and onProgress, called with the usual NTCTrainer progress payload plus a
material field holding the current (already-disposing-its-predecessor)
in-progress material, suitable for live preview during training.
Throws if every channel on material classifies as constant - see
NTCSource.classifyMaterialChannels - since there's then nothing for a
network to fit; construct directly from a classification's
constantValues in that case instead.
Parameters
renderer
any
material
any
options?
any = {}
Returns
Promise<{ channelClassification: { activeChannels: NTCLayoutChannel[]; constantValues: Record<string, unknown>; packCount: number; renderFlags: { side: unknown; transparent: boolean | undefined; }; totalChannels: number; }; cpuModel: NTCGridPyramidModel; iteration: number; iterations: number; loss: number; material: any; stoppedEarly: boolean; }>