lighttransport/tinyusdz

[TODO] WebGPU example

syoyo opened this issue ยท 8 comments

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?)

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 ?

๐Ÿ™

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.

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?

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

๐Ÿ‘

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.

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.

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)