luaacro 2238006023 Fixed glTF file loader to work withY is UP and homogeneous coordinates 9 years ago
..
README.md 2238006023 Fixed glTF file loader to work withY is UP and homogeneous coordinates 9 years ago
babylon.glTFFileLoader.js 1b319b563e Fixing glTF animations for bones 9 years ago
babylon.glTFFileLoader.ts 2238006023 Fixed glTF file loader to work withY is UP and homogeneous coordinates 9 years ago
babylon.glTFFileLoaderInterfaces.js a29e733cc9 glTF File Loader. Fixed shaders support 9 years ago
babylon.glTFFileLoaderInterfaces.ts fd3485ee3f Updated glTF loader to 1.0 9 years ago

README.md

Babylon.js glTF File Loader

Usage

The glTF file loader is a SceneLoader plugin. Just reference the loader in your HTML file:

<script src="babylon.2.2.js"></script>
<script src="babylon.glTFFileLoader.js"></script>

And then, call the scene loader:

BABYLON.SceneLoader.Load("./", "duck.gltf", engine, function (scene) { 
   // do somethings with the scene
});

You can also call the ImportMesh function and import specific meshes

// meshesNames can be set to "null" to load all meshes and skeletons
BABYLON.SceneLoader.ImportMesh(["myMesh1", "myMesh2", "..."], "./", "duck.gltf", scene, function (meshes, particleSystems, skeletons) { 
   // do somethings with the meshes, particleSystems (not handled in glTF files) and skeletons
});

In order the fix the UP vector (Y with Babylon.js) if you want to play with physics, you can customize the loader:

BABYLON.GLTFFileLoader.MakeYUP = true; // false by default

In order to work with homogeneous coordinates (that can be available with some converters and exporters):

BABYLON.GLTFFileLoader.HomogeneousCoordinates = true; // false by default

Supported features

  • Load scenes (SceneLoader.Load and SceneLoader.Append)
  • Support of ImportMesh function
  • Import geometries
    • From binary files
    • From base64 buffers
  • Import lights
  • Import cameras
  • Import and set custom shaders
    • Automatically bind attributes
    • Automatically bind matrices
    • Set uniforms
  • Import and set animations
  • Skinning (BETA, sometimes wrong on tricky models)
    • Skeletons
    • Hardware skinning (shaders support)
    • Bones import
  • Handle dummy nodes (empty nodes)

To improve

  • Test on more geometries
  • Test on more animated models
  • Test on more skinned models
  • Improve shaders support (glitches with samplers can appear in particular configurations)