@threenative/ueformat API

Every public function and class in @threenative/ueformat. UEFormat v10 .uemodel parser and Three.js loader for meshes exported from Unreal packages by CUE4Parse/FModel.

On this page

Generated from the engine's capability manifest: 4 functions and 2 classes. Each entry is the exported signature, what it is for, and a working example. Start with the package overview.

createThreeGeometry

function · import { createThreeGeometry } from "@threenative/ueformat"

Converts one parsed Unreal mesh LOD into a THREE.BufferGeometry — coordinates, scale, winding, normals, tangents, UVs, vertex colours, morphs, skin weights, and material groups.

ts
function createThreeGeometry( lod: IUEModelLOD, adapterOptions: IThreeAdapterOptions =

Needs

  • npm i @threenative/ueformat

Use it to

  • convert one Unreal mesh LOD into a three.js BufferGeometry by hand
  • build custom scene objects from Unreal mesh data instead of a whole model

Example

ts
const geometry = createThreeGeometry(model.lods[0]);

Good to know

  • rejects indices, channels, or material sections that disagree with the vertex count before any geometry is constructed

createThreeObject

function · import { createThreeObject } from "@threenative/ueformat"

Builds a renderable Three.js object — a Group for single-LOD models, a THREE.LOD for multi-LOD ones — from parsed .uemodel data, with collision geometry on userData.

ts
function createThreeObject( model: IUEModelData, adapterOptions: IThreeAdapterOptions =

Needs

  • npm i @threenative/ueformat

Use it to

  • put a mesh exported from an Unreal package on screen
  • load an Unreal static or skeletal mesh with LODs, sockets, and collision geometry

Example

ts
const hero = createThreeObject(parseUEModel(buffer), { lodDistances: [0, 25, 50] });

Good to know

  • every material comes from the game through materialFactory; the fallback is three.js's own GLTFLoader default, a plain MeshStandardMaterial
  • parsed bones are exposed on userData but never bound into a THREE.SkinnedMesh — skeletal rendering is the game's job

parseUEModel

function · import { parseUEModel } from "@threenative/ueformat"

Parses a UEFormat v10 .uemodel body — the interchange format CUE4Parse and FModel export from Unreal packages — into validated, plain mesh data without building any Three.js objects.

ts
function parseUEModel( input: ArrayBuffer | ArrayBufferView, options: IParseUEModelOptions =

Needs

  • npm i @threenative/ueformat

Use it to

  • parse a mesh exported from an Unreal package without Unreal installed
  • inspect the LODs, skeleton, sockets, and collision inside a .uemodel file

Example

ts
const model = parseUEModel(await file.arrayBuffer());

Good to know

  • only UEFormat v10 UEMODEL files are accepted; anything else throws UEFormatError with the byte offset
  • ZSTD-compressed bodies require an injected zstdDecoder; the package never bundles a ZSTD implementation

summarizeUEModel

function · import { summarizeUEModel } from "@threenative/ueformat"

Summarizes a parsed .uemodel — LOD, material, skeleton, collision, and unknown-attribute counts — without dumping vertex arrays, for logs, validation, and build reports.

ts
function summarizeUEModel(model: IUEModelData): IUEModelSummary

Needs

  • npm i @threenative/ueformat

Use it to

  • report what a UEFormat model contains without dumping its vertex data
  • validate a .uemodel file before building geometry from it

Example

ts
const summary = summarizeUEModel(parseUEModel(buffer));

Good to know

  • the summary reflects one already-parsed model; it does not read files itself

UEFormatError

class · import { UEFormatError } from "@threenative/ueformat"

The error thrown for every malformed, truncated, or unsupported .uemodel input, carrying a stable code and the byte offset where validation stopped.

ts
class UEFormatError extends Error

Needs

  • npm i @threenative/ueformat

Use it to

  • tell why a .uemodel file failed to load
  • report a malformed Unreal export with its byte offset instead of a generic error

Example

ts
catch (error) { if (error instanceof UEFormatError) log(error.code, error.offset); }

Good to know

  • every parse and geometry failure surfaces as this error; nothing malformed is silently skipped

UEFormatLoader

class · import { UEFormatLoader } from "@threenative/ueformat"

Loads a .uemodel file as a Three.js loader — load(url) for the browser, parse(data) for bytes you already hold — with the parser and three-adapter options passed straight through.

ts
class UEFormatLoader extends Loader

Needs

  • npm i @threenative/ueformat

Use it to

  • load a .uemodel asset in the browser with the standard three.js loader protocol
  • hand a game's Unreal-exported meshes to the framework's asset loading

Example

ts
const model = new UEFormatLoader(manager).parse(data);

Good to know

  • ZSTD-compressed bodies require an injected zstdDecoder in the parse options
View source on GitHub ↗