GLTFExporter

I would like to use this issue to keep track of the GLTF2 exporter features. I’ve copied the initial list of features discussed on the PR #11917 and I’ll keep updating the list as we progress in the implementation.

Features / TO-DO

  • Export options

    • trs to export TRS instead of matrix
    • input:
      • Single scene
      • Array of scenes
      • Single object
      • Array of objects
    • truncateDrawRange: force exporting just the attribute values defined by drawRange:
    • Non-index buffer geometry
    • Indexed buffer geometry
  • Include userData in extras?

  • Scenes

    • Support for multiple scenes
  • Nodes

    • Meshes
      • Primitive mode:
        • TRIANGLES
        • TRIANGLE_STRIP
        • TRIANGLE_SPAN
        • POINTS
        • LINES
        • LINE_STRIP
        • LINE_LOOP
      • Geometry types:
        • BufferGeometry
        • Geometry
      • Primitive attributes:
        • POSITION
        • NORMAL
        • TEXCOORD_0
        • TEXCOORD_1
        • COLOR_0
        • JOINTS_0
        • WEIGHTS_0
        • TANGENT
      • Multi-material meshes as primitives
    • Lights
    • Camera
    • Skin
  • Materials:

    • Ignore if default material is being used
    • Export as lines if material.wireframe === true
    • pbrMetallicRoughness for MeshStandardMaterial
      • Attributes:
        • baseColorFactor
        • metallicFactor
        • roughnessFactor
        • baseColorTexture: It’s supported (material.map) but the texCoord is always set to 0.
      • doubleSided
      • KHR_material_unlit
  • Samplers

  • Images

    • uri using map.image.src
    • uri base64
    • bufferView
    • Deal with flipY images
    • Merge channels into one texture
  • Accessors

    • Use the same bufferView for the same componentType instead of creating a new one for each attribute (WIP @takahirox)
    • Support sparse?
    • Attributes:
      • bufferView
      • byteOffset: Currently it’s using 0 always as I’m creating a new bufferView for each accessor.
      • componentType
      • count
      • max
      • min
      • type:
        • SCALAR
        • VEC2
        • VEC3
        • VEC4
  • BufferViews: Currently I’m creating a new bufferView for each Accessor, this should be fixed to use just one for these attributes that share the same componentType

    • Attributes:
      • buffer
      • byteOffset
      • byteLength
      • byteStride
      • target
  • Buffers: Currently I’m saving everything to a single buffer so it will be just one entry in the buffers array.

    • byteLength
    • uri
  • Animations

  • misc:

  • GLB

Example

Current demo:
image

Exported gltf loaded on @donmccurdy ‘s gltf viewer
image

GLTF: https://gist.github.com/fernandojsg/0e86638d81839708bcbb78ab67142640

Author: Fantashit

3 thoughts on “GLTFExporter

  1. Great work, great list and good to know there is already so much support on the format! Also works very well together with gltf blender exporter too. Can’t wait for lights support! Keep up the great work.

  2. Hi @siddhartpaiTHREE.GLTFExporter only converts THREE.AnimationClip objects to glTF animations, whereas A-Frame’s animation system uses TweenJS. So currently this isn’t possible. You may want to open an issue on A-Frame or the A-Frame Inspector, which also use GLTFExporter, to request it as a future feature.

Comments are closed.