resl icon indicating copy to clipboard operation
resl copied to clipboard

glTF loader

Open milcktoast opened this issue 8 years ago • 6 comments

Maybe this is out of scope for this module, but having a built-in glTF parser/loader would be useful. Three.js, BabylonJS, Cesium, PEX, .. have such loaders.

milcktoast avatar Aug 31 '16 18:08 milcktoast

This would be really fantastic!

Here are some related links, including links to some existing glTF loaders:

  • https://github.com/cx20/gltf-test/#gltf-test
    • https://cx20.github.io/gltf-test/
  • https://github.com/GrimoireGL/grimoirejs-gltf/blob/master/src/index.ts
  • https://github.com/emadurandal/GLBoost/blob/master/src/js/middle_level/loader/GLTFLoader.js
  • https://github.com/mrdoob/three.js/blob/dev/examples/js/loaders/GLTFLoader.js
  • https://github.com/syoyo/tinygltfloader
  • https://github.com/xelatihy/yocto-gl/blob/master/yocto/yocto_gltf.h

cvan avatar Dec 13 '16 11:12 cvan

I've written a gltf loader (no animations support yet, regl version is about to be pushed) https://github.com/pex-gl/pex-gltf and can assure you that its way beyond regl and even resl. Parsing the json, loading the resources and constructing the buffers is only the beginning. What you need next is:

  • some kind of scene graph to reconstruct transformation matrices based on parent/child relationships
  • materials support with understanding of uniform semantics and some default shaders
  • cameras
  • skinning, animations etc
  • physically based rendering pipeline (coming soon to gltf via extensions, but only on material level)

vorg avatar Dec 26 '16 13:12 vorg

I think the question would be whats the intended use? Regl doesn't even have a mesh format. I think the most regl-way would be to get a list of objects with properties matching regl command syntax as much as possible eg { attributes, vert, frag, modelMatrix, parentIndex } that then could be consumed by the application as it wishes.

vorg avatar Dec 26 '16 13:12 vorg

Looks like someone wrote a loader: https://github.com/gamedev-js/regltf

Haven't had the chance to look too closely yet; the example is failing with errors that indicate some dependencies might be broken.

donmccurdy avatar Nov 13 '17 06:11 donmccurdy

Has anyone made any more headway here, or have plans to?

zzmp avatar May 02 '18 18:05 zzmp

No plans here but would be excited to try a loader out if anyone is working on it :). I think I agree with @vorg above — glTF uses abstractions that aren't within scope for regl, so treating the glTF file as a library of meshes and materials seems pretty reasonable. The PBR pipeline mentioned above has (in glTF 2.0) replaced the GLSL materials from glTF 1.0. ~glTF 2.0 will eventually also support GLSL through the KHR_techniques_webgl extension, but~ (outdated) we expect the vast majority of glTF 2.0 models to use WebGL-agnostic materials: metal/rough PBR, spec/gloss PBR, and unlit materials.

donmccurdy avatar May 02 '18 19:05 donmccurdy