Skip to content

Support compressed meshes via meshopt #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wrangelvid
Copy link
Contributor

@wrangelvid wrangelvid commented Apr 24, 2025

Let's wait on #189 before merging this.


This change is Reviewable

@wrangelvid wrangelvid changed the title Support compresse meshes via meshopt Support compressed meshes via meshopt Apr 24, 2025
Copy link
Contributor

@jwnimmer-tri jwnimmer-tri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 8 files reviewed, 1 unresolved discussion


src/index.js line 10 at r1 (raw file):

import {GLTFLoader} from 'three/examples/jsm/loaders/GLTFLoader.js';
import {KTX2Loader} from 'three/examples/jsm/loaders/KTX2Loader.js';
import {MeshoptDecoder} from 'three/examples/jsm/libs/meshopt_decoder.module.js';

This file has a different license than threejs (three has vendored it).

The license is suitable and compatible (MIT license), but it does require that we redistribute the license text when we redistribute the code. (See https://github.com/zeux/meshoptimizer/blob/master/LICENSE.md.)

Therefore, somehow or another, we need to get that license text into the THIRD_PARTY_LICENSES.json summary file.

Possibly it would be easier to pull in the decoder directly from our package.json somehow, instead of the three copy? I don't know.

Copy link
Contributor

@jwnimmer-tri jwnimmer-tri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 8 files reviewed, 3 unresolved discussions (waiting on @wrangelvid)


a discussion (no related file):
Digging into the API, I guess this is adding support for the EXT_meshopt_compression extension documented at https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/EXT_meshopt_compression/README.md.

We should at least mention the extension name in the commit message.


test/meshfile_object_gltf.html line 15 at r1 (raw file):

            var viewer = new MeshCat.Viewer(document.getElementById("meshcat-pane"));

let gltf_contents = `

Meshcat needs to support glTF files both with and without the meshopt compression. Therefore, this PR should add a new test case, not remove any existing test cases.

There is an existing test case meshfile_object_gltf_optimized which was added for testing a different compression extension (KHR_texture_basisu). Now that we have two different compression schemes in play, probably that test case should be renamed for clarity.

@wrangelvid wrangelvid force-pushed the enable_meshopt branch 2 times, most recently from da184d4 to ba41585 Compare April 25, 2025 18:14
Copy link
Contributor Author

@wrangelvid wrangelvid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 10 files reviewed, 1 unresolved discussion (waiting on @jwnimmer-tri)


a discussion (no related file):

Previously, jwnimmer-tri (Jeremy Nimmer) wrote…

Digging into the API, I guess this is adding support for the EXT_meshopt_compression extension documented at https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/EXT_meshopt_compression/README.md.

We should at least mention the extension name in the commit message.

Done.


src/index.js line 10 at r1 (raw file):

Previously, jwnimmer-tri (Jeremy Nimmer) wrote…

This file has a different license than threejs (three has vendored it).

The license is suitable and compatible (MIT license), but it does require that we redistribute the license text when we redistribute the code. (See https://github.com/zeux/meshoptimizer/blob/master/LICENSE.md.)

Therefore, somehow or another, we need to get that license text into the THIRD_PARTY_LICENSES.json summary file.

Possibly it would be easier to pull in the decoder directly from our package.json somehow, instead of the three copy? I don't know.

Done.


test/meshfile_object_gltf.html line 15 at r1 (raw file):

Previously, jwnimmer-tri (Jeremy Nimmer) wrote…

Meshcat needs to support glTF files both with and without the meshopt compression. Therefore, this PR should add a new test case, not remove any existing test cases.

There is an existing test case meshfile_object_gltf_optimized which was added for testing a different compression extension (KHR_texture_basisu). Now that we have two different compression schemes in play, probably that test case should be renamed for clarity.

Done.

Copy link
Contributor

@jwnimmer-tri jwnimmer-tri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems good on paper now.

Reviewed 1 of 8 files at r1, 9 of 9 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @wrangelvid)

Copy link
Contributor

@jwnimmer-tri jwnimmer-tri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @wrangelvid)


a discussion (no related file):
Working

The Drake bump RobotLocomotion/drake#22935 needs to be approved prior to merging this PR.


a discussion (no related file):
Working

I need to cross-check that I can repro the minified dist file locally.

@jwnimmer-tri jwnimmer-tri self-assigned this Jun 8, 2025
Copy link
Contributor

@jwnimmer-tri jwnimmer-tri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @wrangelvid)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants