Skip to main content

Class: NTCExporter

An exporter for .ntc (Neural Texture Compression) assets.

Encodes an already-trained NTCNodeMaterial (see the sibling three-ntc runtime package's NTCNodeMaterial.js, and this package's NTCTrainer.js)

  • its shared multiresolution latent grid plus MLP decoder, and the channel layout it was fit against - into the compact JSON manifest NTCLoader reads back (see NTCManifest.js for the format itself).

material must be an NTCNodeMaterial instance (or any object exposing the same cpuModel/activeChannels/channels fields that constructor leaves on this - see NTCNodeMaterial.js), not a general Material; there is no path from an arbitrary material back to a trained grid+MLP model.

const exporter = new NTCExporter();
const manifest = exporter.parse( ntcNodeMaterial, { name: 'Gold' } );
const blob = new Blob( [ JSON.stringify( manifest ) ], { type: 'application/json' } );

Constructors​

Constructor​

new NTCExporter(): NTCExporter

Returns​

NTCExporter

Methods​

parse()​

parse(material, options?): any

Parses the given trained NTC material and generates the .ntc manifest.

Parameters​

material​

any

A trained NTCNodeMaterial (must carry cpuModel, activeChannels, channels).

options?​

NTCExporterOptions = {}

The export options.

Returns​

any

The .ntc manifest - JSON-serializable as-is (JSON.stringify( manifest )).