@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
Converts one parsed Unreal mesh LOD into a THREE.BufferGeometry — coordinates, scale, winding, normals, tangents, UVs, vertex colours, morphs, skin weights, and material groups.
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
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
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.
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
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
userDatabut never bound into a THREE.SkinnedMesh — skeletal rendering is the game's job
parseUEModel
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.
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
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
Summarizes a parsed .uemodel — LOD, material, skeleton, collision, and unknown-attribute counts — without dumping vertex arrays, for logs, validation, and build reports.
function summarizeUEModel(model: IUEModelData): IUEModelSummaryNeeds
- 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
const summary = summarizeUEModel(parseUEModel(buffer));Good to know
- the summary reflects one already-parsed model; it does not read files itself
UEFormatError
The error thrown for every malformed, truncated, or unsupported .uemodel input, carrying a stable code and the byte offset where validation stopped.
class UEFormatError extends ErrorNeeds
- 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
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
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.
class UEFormatLoader extends LoaderNeeds
- 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
const model = new UEFormatLoader(manager).parse(data);Good to know
- ZSTD-compressed bodies require an injected
zstdDecoderin the parse options