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

Add Option for WebWorker for AmmoJS #19

Closed
DeeElGee opened this issue May 24, 2020 · 13 comments
Closed

Add Option for WebWorker for AmmoJS #19

DeeElGee opened this issue May 24, 2020 · 13 comments
Labels

Comments

@DeeElGee
Copy link

Where supported, it would be a real performance improvement to include a webworker for the Ammo JS calculations.

See example here: https://playground.babylonjs.com/#N7PGG3#2

@yandeu
Copy link
Member

yandeu commented May 24, 2020

I plan definitively to add it, once the project becomes more popular. I have never used the Web Workers API, so I would first have to make some tests.

For now I have no performance issues, since enable3d loads the wasm build if the client browsers allows it.


Btw, I see you reference babylonjs. I have already played around rewriting the @enable3d/ammo-physics to use with babylonjs. This is also on my todo list.

@DeeElGee
Copy link
Author

We've been playing around with Enable3D - it's really great. But with any Ammo.JS project (presumably other physics engines too) when the FPS starts to drop due to other processes (e.g. running a Teams video call, which has a big impact on the GPU), or it's a low performance machine, then the Physics start to jank or glitch.

So any performance tweaks you can include would be very helpful going forwards. The Babylon reference I included shows how to implement Ammo JS with an inline webworker. It looks relatively straight forward.

@yandeu
Copy link
Member

yandeu commented May 24, 2020

We've been playing around with Enable3D - it's really great.

Thanks 😃

I guess I will start trying to put the physics update loop in a worker. It seems to be well supported. I'll see what I can do :)

@DeeElGee
Copy link
Author

Thanks! Look forward to seeing what you come up with :-)

@yandeu
Copy link
Member

yandeu commented May 25, 2020

I just looked into Web Workers + Ammo.js. It looks very promising, but it requires a lot of refactoring. I will definitely try to implement it :)

@DeeElGee
Copy link
Author

So glad you agree it's worth trying. Think it could be hugely beneficial.

@yandeu
Copy link
Member

yandeu commented May 26, 2020

I'm making progress:
https://youtu.be/p1iVl1p89SA

@DeeElGee
Copy link
Author

Looking really promising

@DeeElGee
Copy link
Author

DeeElGee commented Jun 8, 2020

@yandeu just wondering how progress was with this? Am keeping my fingers tightly crossed for awesome news...

@yandeu
Copy link
Member

yandeu commented Jun 8, 2020

Sorry not finished yet. My guess is that it take 2 month to add it (at my current speed, since it is not a top priority). But I will definitively add it. All my test where successful. 👍

@nipmarsh
Copy link

nipmarsh commented Apr 9, 2021

Hi,

Great lib, easy to use ;-)
I work on complex scenes with many objects and in my case the current implementation run slow.
Maybe, it will be much better with workers.
How far are you to integrate it ?

Sincerely

@github-actions
Copy link

github-actions bot commented Feb 4, 2022

This issue is stale because it has been open 300 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the Stale label Feb 4, 2022
@github-actions
Copy link

This issue was closed because it has been stalled for 10 days with no activity.

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

No branches or pull requests

3 participants