Skip to main content

Class: NTCLoader

A loader for .ntc (Neural Texture Compression) assets - a compact, quantized multiresolution latent grid pyramid plus a float16-packed MLP decoder, jointly fit against a set of PBR channels (see NTCManifest.js / NTCFormat.js).

parse() reconstructs { name, cpuModel, channelClassification } - exactly what new NTCNodeMaterial( cpuModel, channelClassification, options ) expects (see NTCNodeMaterial.js) - the same shape a live NTCTrainer run / NTCFit.fitNTCMaterial() call produces.

Example​

import { NTCLoader } from 'three-ntc';

Extends​

  • "three"

Indexable​

[key: string]: any

Constructors​

Constructor​

new NTCLoader(manager?): NTCLoader

Constructs a new NTC loader.

Parameters​

manager?​

unknown

The loading manager.

Returns​

NTCLoader

Overrides​

Loader.constructor

Methods​

load()​

load(url, onLoad?, onProgress?, onError?): void

Starts loading from the given URL and passes the parsed NTC asset to the onLoad() callback.

Parameters​

url​

string

The path/URL of the JSON file to load.

onLoad?​

(asset) => void

Executed when loading has finished.

onProgress?​

(event) => void

Executed while loading progresses.

onError?​

(err) => void

Executed when errors occur.

Returns​

void


parse()​

parse(data): NTCParsedAsset

Parses a .ntc manifest.

Parameters​

data​

string | NTCManifest

The JSON manifest, either parsed or as a string.

Returns​

NTCParsedAsset

{ name, cpuModel, channelClassification }, ready for new NTCNodeMaterial().