brianzinn / react-babylonjs

React for Babylon 3D engine
https://brianzinn.github.io/react-babylonjs/
809 stars 102 forks source link

Enable webgpu support #289

Closed DenysAshikhin closed 1 month ago

DenysAshikhin commented 1 year ago

Hi,

I apolgize for the rough initial pull request, but I would like to help enable webgpu support and get the ball rolling. Please advise on any next steps to make this all work together nicely!

brianzinn commented 1 year ago

this is a great idea. let me have a look this weekend! i'll need to verify the async nature - wonder if it's better with <Suspense .../> and also the async behaviour before rendering starts and how the observables are passed. Additionally, it needs to be the ref to the canvas (not a selector). I'll check more this weekend. cheers.

brianzinn commented 1 year ago

I did have a look on the weekend. The main issue is that the create is async, so there is nothing to create the render loop on. Did you have this working on webgpu? You can npm/yarn link your local build if you want to try it out in a real project. Otherwise you can use the storybook or gatsby site in docs. I think we'll need webgpu options as a param- they look different than regular EngineOptions. i'm quite busy this week, but definitely would like to add webgpu support. thanks

buuhvprojects commented 6 months ago

some news about this pr?

emilx-cell commented 3 months ago

Hi, Is there any update on this PR? Not being able to leverage the GPU will force me to move to plain Babylonjs implementation. Thanks. EL.

brianzinn commented 3 months ago

Would this PR meet your needs? I haven't tried it out - not sure how the async part will playout. I originally had in mind a separate <WebGPUEngine .../> component and then a wrapper that would do the check for support and render children. Maybe this way is better?

emilx-cell commented 3 months ago

Hi, Yes, that sounds great. I would love to try it! Thanks, EL.

brianzinn commented 3 months ago

I wanted to provide more options including explicit <WebGPUEngine .. />. Thank-you @DenysAshikhin - I really appreciate your efforts to get the ball rolling and apologize for taking so long to move things along. I have started a different way here #315 - there is also a FallbackEngine component. Looking for community feedback on which way is better.

brianzinn commented 1 month ago

thanks @DenysAshikhin for your contribution. it helped move this long overdue feature along. there wasn't much feedback on a preferred way! 😄 i need to wait for my PR on @babylonjs/core and then it will be live - instead of extra props as you were proposing - new Components will be:

<WebGPUEngine .../>

and

<FallbackEngine .../>