Online 3D model viewers...

Creating those LeoCAD 3D buildings/structures, will be more appealing, when viewed inside a 3D viewer, so it's time for some coding.
Since glTF is "the standard 3D format" for internet and could even include animations, this seems a good direction to try.

Converting LeoCAD to glTF

With a bit of help from ChatGPT, managed writing some Python code, converting LDraw geometry into GLB.
I did use the awesome trimesh.org/ library, which is doing the heavy lifting for the 3D meshes & conversions to the binair format.

There were quite some challenges getting this conversion right. My use-case does fit the glTF platform, but TriMesh is having a slightly different use-case (at the moment).

Main 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.)

And finally uploaded all 3D models to SketchFab.

Online viewers:

Quick search reveals 3 online platforms, for showing (free) 3d models:

WordPress plugin

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

Sketchfab.com

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


Poly.cam

Also poly.com has an option for uploading and using their embedded viewer:

Issue: Colored meshes are not visualized.

Cgtrader

GLB does not seem to be a standard format for Cgtrader. Maybe should try a different file format sometime....

???

During uploading, at least the model is colored again....

Summary online viewers

Although the WordPress viewer is shown a direct accessible viewer, I'm also needing to upload all models on this website.
'Media' control on (standard) WordPress is not handy, I'm not able to see a list of .glb files, so file control is difficult.
Since SketchFab is currently looking best, that's the one I'm using.

Summary 3D conversion


Conversion status & possible improvements:

  • Converting models into glTF (.glb): [Done]
    • Smart file structure:
      • Re-using textures and include only once.
    • Including transparent textures.
  • Improve files: [On hold]
    • Quite sure, same 3D meshes are used multiple times → could this be improved within TriMesh?
    • Decrease amount of polygons → Needing more simplified 3D solids (and most likely textures).
    • Optimize texture sizes.
    • Generating textures from 3 sides → how will this work on 'angled' surfaces?
    • Using more appealing textures:
      • Multilayer (wooden) textures. (great examples)
      • Cardboard (colored) textures.