ldraw-bricks-glb / README.md
anxuanng's picture
Add card
53a1a05 verified
|
Raw History Blame Contribute Delete
6.99 kB
---
license: cc-by-4.0
license_link: https://creativecommons.org/licenses/by/4.0/
pretty_name: LDraw Interlocking Bricks GLB
tags:
- 3d
- glb
- gltf
- ldraw
- bricks
- technic
- cad
- procedural
- threejs
- webgpu
configs:
- config_name: default
data_files:
- split: train
path: data/train-*.parquet
---
# LDraw Interlocking Bricks GLB
<video src="assets/preview.mp4" autoplay loop muted playsinline width="540"></video>
![All 3551 interlocking brick and Technic CAD parts](assets/banner.jpg)
Curated interlocking bricks, plates, tiles, slopes, arches, Technic beams/gears/axles/pins, wheels, doors, windows, windscreens, hinges, and botanical CAD parts from the LDraw.org Official Parts Library. Converted to Y-up metric stud-grid GLB (1 LDU = 0.0004 m, 1 stud = 8.0 mm), grounded at y=0 with 38-deg crease-split normals, ABS/transparent/rubber PBR with a 1-line 'ldraw_main_color' recolour material, and extracted stud/anti-stud/Technic snap coordinates.
> Independent open-source conversion of the LDraw.org Official Parts Library (CC BY 4.0 / CC BY 2.0). Not affiliated with, sponsored by, or endorsed by any toy brick manufacturer.
3551 interlocking brick and Technic CAD parts from [LDraw Official Parts Library](https://library.ldraw.org/library/updates/complete.zip) by LDraw.org, 24.8 MB of source files packed into 94.6 MB of GLB (web tier). Credit: LDraw.org Official Parts Library (https://www.ldraw.org/article/349.html), LDraw.org contributors, CC BY 4.0 / CC BY 2.0 (see licenses/LDraw_CAreadme.txt). Independent CAD conversion by CodePawl; not affiliated with, sponsored by, or endorsed by any toy brick manufacturer.
Viewer: https://huggingface.co/spaces/codepawl/ldraw-bricks-glb-viewer
## Files
| Folder | Size | What | For |
|---|---|---|---|
| `objects/` | 94.6 MB | meshopt geometry, WebP textures | three.js, Babylon.js, any glTF viewer with the meshopt decoder |
| `lods/` | 134.8 MB | three simplified levels aimed at 50, 20 and 6 % of the triangles; each stays within 1, 1.5 and 2 % of the model size from its source, so detailed models keep more | distance LOD, crowds, far props |
| `engine/` | 404.0 MB | no meshopt, no quantization | Blender and desktop engines that cannot decode meshopt |
| `collision/` | 10.2 MB | convex collision shapes, plain glTF | Rapier, Jolt, PhysX, Unity colliders |
`metadata.jsonl` has one line per item: title, kind, licence, authors, triangle count and the path and size of every tier. The Dataset Viewer and `load_dataset` read `data/*.parquet`: the same rows with the mesh (`Mesh`, the plain `engine/` GLB, decoded by trimesh) and the thumbnail (`Image`) embedded. Thumbnails are also in `thumbs/`.
## For web games and WebGPU
Load the `objects/` files in web games: small files with meshopt geometry and WebP textures. `collision/` holds convex shapes for physics.
glTF extensions each tier uses (also per row in `metadata.jsonl`, field `extensions`):
- `web`: `EXT_meshopt_compression`, `KHR_mesh_quantization`
- `engine`: none
Measured on 12 items spread over triangle count. Phone page: 390x844 at 3x, pixel ratio capped at 2, CPU throttled 4x, network at Chrome's Fast 4G (150 ms, 9 Mbit/s), so phone load includes the download. The GPU is a desktop RTX 3060 and is not throttled: frame time shows the CPU side only, a real phone GPU is slower. VRAM is geometry plus texture bytes on the GPU.
| Tier | File (median) | VRAM (median) | Triangles | Phone load (4G) | Frame time | WebGPU load (local) |
|---|---|---|---|---|---|---|
| web (12) | 0.0 MB | 0.0 MiB | 2,560 | 188 ms | 0.2 ms | 2 ms |
| lod2 (12) | 0.0 MB | 0.0 MiB | 704 | 185 ms | 0.2 ms | 2 ms |
three.js WebGPU:
```js
import * as THREE from 'three';
import { WebGPURenderer } from 'three/webgpu';
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
import { KTX2Loader } from 'three/addons/loaders/KTX2Loader.js';
import { MeshoptDecoder } from 'three/addons/libs/meshopt_decoder.module.js';
const renderer = new WebGPURenderer({ antialias: true });
await renderer.init(); // KTX2Loader needs to know which compressed formats this device takes
const ktx2 = new KTX2Loader().setTranscoderPath('https://cdn.jsdelivr.net/npm/three@0.187.0/examples/jsm/libs/basis/').detectSupport(renderer);
const loader = new GLTFLoader().setKTX2Loader(ktx2).setMeshoptDecoder(MeshoptDecoder);
const gltf = await loader.loadAsync('https://huggingface.co/datasets/codepawl/ldraw-bricks-glb/resolve/main/objects/3001/3001.glb');
```
## Use it in Crucible
[Crucible (formerly 67js)](https://github.com/codepawl/crucible) loads these files as they are:
```bash
npm install @codepawlhq/crucible meshoptimizer
```
```js
import { CrucibleRenderer } from '@codepawlhq/crucible';
import { loadGltf } from '@codepawlhq/crucible/addons/gltf';
import { MeshoptDecoder } from 'meshoptimizer';
const asset = await loadGltf('https://huggingface.co/datasets/codepawl/ldraw-bricks-glb/resolve/main/objects/3001/3001.glb', { decoders: { meshopt: MeshoptDecoder } });
const renderer = new CrucibleRenderer(document.querySelector('canvas'), asset.parts, { ground: true });
renderer.render({ eye: [1.5, 1.2, 2], target: [0, 0.5, 0] });
```
## Tested
Every file was loaded and drawn (drawn pixels counted) in each engine, three.js 0.187.0 and Crucible 0.21.0, files from a local copy of this repository.
| Tier | three.js WebGL | three.js WebGPU | Crucible |
|---|---|---|---|
| web | 200/200 | 200/200 | 200/200 |
| lod1 | 200/200 | 200/200 | 200/200 |
| lod2 | 200/200 | 200/200 | 200/200 |
| lod3 | 200/200 | 200/200 | 200/200 |
| engine | 200/200 | 200/200 | 200/200 |
| collision | 200/200 | 200/200 | 200/200 |
Blender 5.2 import: engine 200/200, objects 200/200, collision 200/200.
Converter check: 3551/3551 passed.
## Licence and credit
LDraw.org Official Parts Library (https://www.ldraw.org/article/349.html), LDraw.org contributors, CC BY 4.0 / CC BY 2.0 (see licenses/LDraw_CAreadme.txt). Independent CAD conversion by CodePawl; not affiliated with, sponsored by, or endorsed by any toy brick manufacturer.. Licence: CC-BY-4.0 (https://creativecommons.org/licenses/by/4.0/).
Changes made: Curated non-obsolete, non-sticker structural and Technic parts from LDraw complete.zip (2026-11-09 LDConfig), expanded recursively with p/48/ high-res primitives, BFC winding resolution, 38-deg crease-angle split normals, metric stud-grid scale (1 LDU = 0.0004 m, Y-up, grounded at y=0, stud-grid centered in X/Z), PBR materials with 'ldraw_main_color' recolour hook, extracted stud/anti-stud/Technic snap coordinates in extras.ldraw.snaps and snaps/*.json, meshopt web/LOD tiers, uncompressed engine tier, and 64-pt convex collision hulls.
Source: https://library.ldraw.org/library/updates/complete.zip. Packed by [CodePawl](https://huggingface.co/codepawl). Follow CodePawl on [X](https://x.com/anxuanng), [GitHub](https://github.com/codepawl), [Threads](https://www.threads.com/@codepawl) and [YouTube](https://www.youtube.com/@codepawlhq).