coballast / elm-gltf

Loading and working with 3D models in the GLTF format

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Elm GLTF

UNFINISHED! Working on it took very long so I stopped. I'm putting it here so others can take a look at it and potentially fork.

A package for loading and working with 3D models in the GLTF format.

Link to GLTF cheat sheet here.

Run the example

npm install
cd examples
npx elm reactor # compile elm code and spin up a dev server

Features

The glTF spec is quite large, especially when also considering extensions. The following gives a quick overview of feature that elm-gltf aims to support in the foreseeable future.

Data extraction

  • Extracting scenes
  • Extracting nodes
  • Extracting buffers
  • Extracting buffer views
  • Extracting accessors
  • Extracting meshes
  • Extracting textures
  • Extracting texture properties
  • Extracting TRS properties (separate rotation, scale and translation)
  • Extracting meshes with different vertex attributes (right now only position, normal, texCoords)
  • Extracting different materials (PBR, Lambertian, etc)
  • Extracting different mesh types (lines, etc)
  • Extracting orthographic and infinite perspective projection

Formats (Where are the assets?)

  • Embedded glTF(all assets like buffers and images are embedded as base64, single file)
  • Hyperlinked glTF(assets are referenced via URL, multiple files)
  • Binary GLB (everything is bundled into a single binary container file)
  • possibly extensions like DRACO

Current Results

Idea: Create 3 levels

  1. Low-Level: Raw GLTF (normalized, looks like GLTF, Buffers unparsed)
  2. Mid-Level: Tree of things(denormalized, buffers parsed)
  3. High-Level: Just a list of Drawables, and a list of cameras.

Things that can get expensive when done a lot:

  • parsing buffers
  • resolving relationsships:
    • accessors
    • nodes -> meshes
    • material -> textures

Scene could be just something simple to draw. If something like modifying the scene data is needed, there could be an integration with elm-3d-scene for that.

2020-01-21 Using a Camera contained in the glTF

Third Result

2020-01-17 Showing some (hardcoded) texture

Second Result

2020-01-12 Displaying some geometry

First Result

About

Loading and working with 3D models in the GLTF format

License:Mozilla Public License 2.0


Languages

Language:Elm 100.0%