processing / processing/p5.js

add a glTF / GLB model loader

Open
#9,093 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
24k
Forks
3.8k
Avg merge
3d 16h
Merged PRs (30d)
25

Description

Increasing access

gltf is what most model sites hand you now, sketchfab included. p5 can load obj and stl, so anyone who finds a gltf model has to go convert it first, and conversions routinely lose the materials. supporting it directly means the models people actually find are the models they can use.

Most appropriate sub-area of p5.js?
  • WebGL
Feature request details

follow up from the multi-material work in #8879, #8955, #9066, #9067 and #9089.

a lot of the groundwork is in place now. models are drawn one part per material, so a gltf file's separate meshes and materials have somewhere to go, and normalTexture() already takes tangent space normal maps, which is the kind gltf uses.

the main thing standing in the way is materials: gltf 2.0 describes them with metallic-roughness rather than phong, so #9092 (pbr materials) is really a prerequisite if imported models are going to look the way they were authored.

rough shape of the work:

  • parse .gltf (json) and .glb (binary), including buffers, accessors and embedded or referenced images
  • map each gltf primitive onto a geometry part with its material state
  • map the pbr material fields onto whatever pbr support lands from #9092
  • handle the node hierarchy and its transforms
  • leave animation and skinning out of a first pass

as discussed on discord, it may be worth doing this as an addon outside p5 first, so its behaviour can settle before committing to it in core. happy to help guide whoever picks this up.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the prerequisite PBR materials work in issue #9092 and the multi-material issues #8879, #8955, #9066, #9067, and #9089. Define an addon or core implementation that parses .gltf and .glb buffers, accessors, images, meshes, materials, and node transforms while excluding animation and skinning; done means imported models preserve their authored PBR materials and transforms.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.