Skip to content

GLTF

angular-three-plugin:gltf generates Angular components from gLTF 3D models; optimizing and transforming the models in the process.

Usage

Terminal window
ng generate angular-three-plugin:gltf [model-path] [options]

Arguments

ArgumentDescription
model-pathPath to the GLTF model file (required)

Options

Component Generation

OptionDescriptionDefault
—class-name, -CName for the generated component class”Model”
—selector-prefix, —prePrefix for the component selector”app”
—header, -HCustom header to add to the generated file""

Model Optimization

OptionDescriptionDefault
—simplify, -SEnable mesh simplificationfalse
—ratio, -rSimplification ratio (0-1)0
—error, -eSimplifier error threshold0.0001
—precision, -pNumber of fractional digits3

Materials & Meshes

OptionDescriptionDefault
—keep-materials, -MPrevent material palette joiningfalse
—keep-meshes, -jPrevent joining of compatible meshesfalse

Textures & Format

OptionDescriptionDefault
—format, -fTexture format (jpeg|png|webp|avif)“webp”
—resolution, -RResolution for texture resizing1024
—draco, -DEnable DracoLoader for compressionfalse

Model Structure

OptionDescriptionDefault
—bones, -bLayout bones declarativelyfalse
—keep-groups, -gPreserve groups in the modelfalse
—keep-names, -nPreserve object namesfalse
—keep-attributes, -aKeep unused vertex attributesfalse
—shadows, -sEnable mesh casting and receiving shadowsfalse

Transform & Degrade

OptionDescriptionDefault
—transform, -tTransform meshes via @gltf-transform/extensionsfalse
—degrade, -qDegrade meshes (specify method)""
—degrade-resolution, -QResolution for mesh degradation512

Output & Debug

OptionDescriptionDefault
—output, -oCustom output path-
—console, -cPrint output to consolefalse
—verbose, —debugEnable verbose loggingfalse
—meta, -mInclude meta informationfalse
—dry-run, -dRun without writing filesfalse
—forceOverwrite existing filesfalse

Examples

Basic usage:

Terminal window
ng g angular-three-plugin:gltf models/character.gltf

Optimize model with simplification:

Terminal window
ng g angular-three-plugin:gltf models/scene.gltf --simplify --ratio 0.5

Generate optimized component with custom name and compression:

Terminal window
ng g angular-three-plugin:gltf models/asset.gltf --class-name="Character"
--draco