Skip to content
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

[TODO] WebGPU example #118

Open
syoyo opened this issue Jan 15, 2024 · 8 comments
Open

[TODO] WebGPU example #118

syoyo opened this issue Jan 15, 2024 · 8 comments
Labels
enhancement New feature or request

Comments

@syoyo
Copy link
Owner

syoyo commented Jan 15, 2024

WebGPU is getting popular.

https://webkit.org/blog/14879/webgpu-now-available-for-testing-in-safari-technology-preview/
https://developer.mozilla.org/ja/docs/Web/API/WebGPU_API

Although currently WebGPU is not widely avaiable, it'd be nice to think about writing TinyUSDZ + WebGPU example at some point(Late 2024 ~ 2025?)

@syoyo syoyo added the enhancement New feature or request label Jan 15, 2024
@Cewein
Copy link

Cewein commented Jan 15, 2024

I will look into this, WebGPU seem the rigth fit for this as there is currently no "real" online USDZ viewer.
It would use the Wasm version of tinyUSDZ, so for some thing in safari migth lead to incompatibilities, rigth ?

@syoyo
Copy link
Owner Author

syoyo commented Jan 15, 2024

🙏

Yes, use WASM through Emscripten.

Something TinyUSDZ version of this effort:

https://github.com/Twinklebear/webgpu-cpp-gltf

i'm not sure how much inconsistencies will be happen for Safari. Probably we need to keep wasm(C++) part small(e.g, just for loading USD asset) and write more stuff in Javascript layer(e.g, setup shaders) to improve compatibilities across browsers.

@Twinklebear
Copy link
Contributor

I'm not sure I fully know what you're both referring to about the Safari inconsistencies here, but my WebGPU/glTF/C++ demo does run in Safari Tech Preview (and uses tinygltf 😁 ). I think it should be fine to write the whole renderer in C++ using tinyUSDZ and compile to Wasm like the glTF demo. I have a little template repo that the glTF renderer used: https://github.com/Twinklebear/webgpu-cpp-wasm which might be helpful.

If you want to have the demo app in JavaScript/TypeScript and call into the tinyUSDZ Wasm library to load files, then render w/ WebGPU in TypeScript, that should also be doable.

What are the Safari-inconsistency issues?

@syoyo
Copy link
Owner Author

syoyo commented Jan 24, 2024

I have a little template repo that the glTF renderer used: https://github.com/Twinklebear/webgpu-cpp-wasm which might be helpful.

👍

@Twinklebear
Copy link
Contributor

I started playing around with this a bit: https://github.com/Twinklebear/webgpu-cpp-usdz , https://www.willusher.io/webgpu-cpp-usdz/

@syoyo
Copy link
Owner Author

syoyo commented Jan 28, 2024

Awesome!

I'm working on Tydra https://github.com/syoyo/tinyusdz/tree/dev/src/tydra RenderScene API to convert USD scene graph to renderer-friendly data structure, including material/texturing/skinning and some basic animation support. Probably some working Tydra RenderScene is available from the beginning of Feb next month.

@Cewein
Copy link

Cewein commented Jan 30, 2024

You are fast, I am also working on my side on a native version with either webgpu-native.h or dawn.
There is a nice repo : https://github.com/eliemichel/WebGPU-distribution were you can select the webGPU version you want.

@syoyo
Copy link
Owner Author

syoyo commented May 11, 2024

I'm working on Tydra https://github.com/syoyo/tinyusdz/tree/dev/src/tydra RenderScene API to convert USD scene graph to renderer-friendly data structure, including material/texturing/skinning and some basic animation support

It took time than expected, but now Tydra RenderScene should work for some USDZ models(dev branch). xform_nodes/material/texture/skinning/blendshapes are supported.

See API usage examples in

https://github.com/syoyo/Vulkan-glTF-USDZ-PBR/blob/f3530a40b182fbdc106022af883733253f6beb5c/base/VulkanUSDZModel.cpp#L971

https://github.com/syoyo/tinyusdz/blob/dev/examples/tydra_to_renderscene/to-renderscene-main.cc
https://github.com/syoyo/tinyusdz/blob/dev/src/tydra/usd-export.cc
(Write RenderScene data to USD again)

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

No branches or pull requests

3 participants