-
Notifications
You must be signed in to change notification settings - Fork 22
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
Add WebAssembly / Emscripten as new compilation target #1
base: dev-backup
Are you sure you want to change the base?
Conversation
Co-authored-by: Roland Ruiters-Christou <[email protected]> Co-authored-by: Sebastian Dunkel <[email protected]> Co-authored-by: Aura Munoz <[email protected]> Co-authored-by: Philipp Frericks <[email protected]> Co-authored-by: Cedrick Muenstermann <[email protected]>
Co-authored-by: Roland Ruiters-Christou <[email protected]> Co-authored-by: Sebastian Dunkel <[email protected]> Co-authored-by: Aura Munoz <[email protected]> Co-authored-by: Philipp Frericks <[email protected]> Co-authored-by: Cedrick Muenstermann <[email protected]>
Co-authored-by: Roland Ruiters-Christou <[email protected]> Co-authored-by: Sebastian Dunkel <[email protected]> Co-authored-by: Aura Munoz <[email protected]> Co-authored-by: Philipp Frericks <[email protected]> Co-authored-by: Cedrick Muenstermann <[email protected]>
I tried a build under CentOS, using the command line noted in the instructions above, but got hung up right away:
I wonder if there's a little more set up required for emsc. |
Hm, good question. So far I have only tried compiling on Ubuntu - someone else successfully built it on Mac though. Maybe the Dockerfile contains something useful? It looks like cmake cannot find pthread for some reason. Does a standard compile of USD work on this machine? |
Minor thing. I successfully build the docker container on my M1 Mac. But the package.json file binding path is "bindings/RelWithDebInfo/jsBindings." but the docker container path is "bindings/Release/jsBindings." |
Took some time this weekend to get this up and running with React-Three-Fiber. This is very exciting!
|
Just started following this PR. Fantastic work @kaischroeder + team really awesome to see this progress. A few thoughts/questions;
|
yes, but I'll refer to the team working on this currently. :-)
I don't think so. You can fetch assets directly from within WASM (https://emscripten.org/docs/api_reference/fetch.html)
Yes, then we would not need support for a 32bit architecture anymore, which this PR adds. But this can still take a while until all browsers and especially web views support this. |
Description of Change(s)
This Draft PR adds support for compiling USD to WebAssembly/Emscripten, which allows us to run the library in a browser or in node.js. It comes with a JavaScript binding for the UsdStage.
The purpose of this PR is to gather early feedback from interested parties before making a real PR to the main USD repository. Please use Github's review functionality to share comments.
Known limitations:
To try this out, install emscripten https://emscripten.org/docs/getting_started/downloads.html and build
The build folder will contain a bin subfolder with a sample (test.html), which creates a USD Stage and prints its content to the console.
The SharedArrayBuffer feature that is used requires cross-origin isolation: https://web.dev/cross-origin-isolation-guide/
For debugging purposes you can run Chrome with a parameter to always enable SharedArrayBuffer so that you don't need to worry about this: --enable-features=SharedArrayBuffer
The better solution is of course to add the proper headers on the server.
Note: This build depends on a version of TBB (Threading Building Blocks) for WebAssembly. https://github.com/hpcwasm/wasmtbb - unfortunately, the corresponding Github project seems to be unmaintained. Luckily it mostly contains changes to build files, so hopefully this situation can be improved in the future. We have also fixed a small problem in this branch: https://github.com/sdunkel/wasmtbb/
In follow-up PRs to be published soon, we intend to open-source:
We have already deployed a few samples using the above mentioned RenderDelegate:
https://autodesk-forks.github.io/USD/
Support for materials in this RenderDelegate is still minimal. Some of the examples use animations, which are directly handled by the USD runtime.