meshcat-dev / meshcat

Remotely-controllable 3D viewer, built on top of three.js
MIT License
256 stars 48 forks source link

Add glTF support for DRACOLoader and KTX2Loader #176

Closed jwnimmer-tri closed 9 months ago

jwnimmer-tri commented 9 months ago

This increases the JS bundle size from 0.93 MiB to ~2.67 MiB~ 2.03 MiB.


My current recipe for making optimized meshes:

$ docker run -it node:20.11.0 /bin/bash
# wget https://github.com/KhronosGroup/KTX-Software/releases/download/v4.3.1/KTX-Software-4.3.1-Linux-x86_64.deb
# dpkg -i KTX-Software-4.3.1-Linux-x86_64.deb 
# npm install --global @gltf-transform/cli
# gltf-transform optimize --compress draco --texture-compress ktx2 input.gltf output.gltf

This change is Reviewable

jwnimmer-tri commented 9 months ago

+@SeanCurtis-TRI I'd appreciate your thoughts on the two open design questions posted in Reviewable.

jwnimmer-tri commented 9 months ago

My plan is to come up with a new test/*.html file before we merge this. (I expect it to be pretty easy.) The plan will be to have python3 -m httpserver in the loop to serve the unbundled files.

SeanCurtis-TRI commented 9 months ago

test/meshfile_object_gltf_optimized.html line 11 at r4 (raw file):

Previously, SeanCurtis-TRI (Sean Curtis) wrote…
BTW Can we think up a click javascrpt mechanism to recognize whether or not the user has loaded this page the right way an provide in-browser correction?

s/click/slick

jwnimmer-tri commented 9 months ago

@SeanCurtis-TRI do you want a last look at the new test/Readme.md?