# scene-with-glb-model

Load a GLB model (plain, Draco or KTX2-compressed) into a lit three.js scene with orbit controls, auto-framing and a fallback message on load errors

- **Space:** threejs-public (https://github.com/Tech-Realm/space-threejs-public/tree/main/scene-with-glb-model)
- **Level:** L1 (as the registry reports it)
- **Keys it needs (names only):** none
- **Tools:** python3, playwright-python, chromium
- **Routes:** static-local; checks: 2
- **Uses:** new (no recorded use yet)
- **Install:** `logicpacks pack use threejs-public/scene-with-glb-model` or MCP `get_pack threejs-public/scene-with-glb-model`
- **Files:** CHANGELOG.md, code/boot.js, code/index.html, code/main.js, code/model.glb, outcome/EVIDENCE.md, outcome/checks.yaml, outcome/results.json, pack.yaml, spec/SPEC.md, spec/source.md

## Purpose (spec/SPEC.md)

## Goal
A page that loads any `.glb` (via `?model=` or the bundled sample), centres and frames it, lights it and lets the user orbit, with Draco and KTX2 decoders wired so compressed assets also load.

## Steps
1. Copy `code/` and put the model next to `index.html` (or pass `?model=path.glb`).
2. Compress big models first: `npx gltf-transform optimize in.glb out.glb --compress draco --texture-compress ktx2` (decoders are already wired).
3. Serve and open; the model is centred and the camera distance is set from its bounding box.
4. Run the check: `python3 ../tools/webgl_check.py code --js "window.__model && window.__model.meshes >= 1"`.

## Edge cases
- Draco/KTX2 decoder paths point at the jsdelivr copy of the same three version; self-host them for offline use.
- Huge scenes: check `window.__stats()` triangles; split or LOD above ~500k on phones.
- Wrong scale from DCC tools: auto-framing hides it; check real units before physics.

## Don'ts
- Don't mix three versions between the core and the addons/decoders.
- Don't ship uncompressed 4K PNG textures to phones.



---

Canonical URL: https://logicpacks.io/packs/threejs-public/scene-with-glb-model

Developed by TechRealm (techrealm.online), the software team. Operated by Al Jash Trading (Establishment), Abu Dhabi, since 1994, the legal entity that hosts and is responsible for the service. Economic licence CN-1030597, Abu Dhabi Registration Authority. Address: Office 5, Bani Yas West 4, Bani Yas, Abu Dhabi, UAE. Website: https://aljashtrading.com. Contact: hello@logicpacks.io, security@logicpacks.io, WhatsApp +1 713 632 2262 (https://wa.me/17136322262).

Machine-readable index: [/llms.txt](/llms.txt). Plain facts: [/about.md](/about.md). Safety: [/safety.md](/safety.md).
