3D viewers: LDraw_to_GLB converter (trimesh)

GLB is the standard 3D format for internet and could even include animations.

Would be creat, converting LeoCAD (LDR) models, into GLB files.
Creating those 3D buildings/structures, will be more appealing, when viewed inside a 3D viewer, so it's time for some coding.

With the help of ChatGPT, managed writing some Python code, converting LDraw geometry into GLB, using the awesome trimesh.org/.

Workflow:

  1. Create custom LeoCAD library (convert: .stl → .dat)
  2. Create custom building (export to: .ldr)
  3. Convert LDraw model into GLB (.ldr → .glb)
  4. Upload model and display on internet.
    (Various methods.)

In finally uploaded all 3D models to SketchFab.

Some examples showing GLB 3D content inside WordPress, below.

WordPress plugin - Mobaco model 4-73:

Using a '3D Viewer' plugin, which allows for basic functionality, inside a WordPress website. For this case, the model is uploaded on site too.

Sketchfab.com - L'Edifice model 4-13:

Another way is uploading the model to Sketchfab and using their embedded viewer:


Poly.cam - Mobaco, front cover model:

Also poly.com has an option for uploading & embedded viewer:

Issue: Colored meshes are not visualized.

Cgtrader - Mobaco model 4-80:

Uploading a GLB is done, but need to wait for moderation? Let's see what is happening.

???

At least the model is colored again.


Current status:

  • First step converting models, including textures & smart file structure: done.
  • Second step: improve creating smaller files size (less polygones, smaller textures): on hold.
    (This will requires simplified geometry, so less polygones and lower resolution textures.)