-
Notifications
You must be signed in to change notification settings - Fork 52
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
Using three_cpp as Three.js accelerator #14
Comments
except threre is no heavy computations in three.js :) |
not at all... below it's just one of functions which gets calculated for every object on every frame. Then you have matrix inversion, euler to quaternion and reverse etc. There's a lot happening in three.js
Three.js does a very good job of hiding complexity and it has a nice API but 3d graphics are CPU intensive and even small, low-level optimisations impact performance in big projects. Having it in a worker would allow adding SIMD plus making use of OffscreenCanvas could bring massive performance gains so developers could focus mostly on GPU performance |
these computations are not heavy at all, versus actually drawing these objects, shadows, post effects or handling video textures. they will likely amount to a couple of ms in total for average scene. |
You're talking about GPU effort and that's not what I started this topic for. Using three.js in a worker wont't affect any GPU bottlenecks. When it comes to CPU there are also skinned meshes and other animations. Then there must be overhead for physics, HUD, networking, and browser-specific stuff left. For simple scenes non of it matters at all but we're talking about real multiplayer games at 60fps |
I've personally used Three.js vectors for heavy computation and I would be very surprised if no one else did. Drawing objects takes very little time because all it amounts to is passing data to the GPU. It's what you do with those objects that can be slow. However, I will say this: if you are doing heavy computation with Three.js, the biggest performance gain is probably going to come from addressing data locality issues. That's something that will require you to switch to a different data structure, and that's not something Three.js will provide. |
This is a cool project but how to make it really useful?
Export a renderer to Web assembly so people can still use regular three.js and this library will work as a significant performance booster.
Use case:
-WebGlCPPRenderer creates a worker and sends scene data using SharedArrayBuffer (or transferable objects because of current Meltdown situation on each frame)
-worker does all the updates, matrices multiplying, skinned mesh vertices computation and renders scene in Canvas using OffscreenCanvas
Performance boost will be synergetic because it's not only wasm and SIMD perfomance gain, but also freeing main thread by utilising OffscreenCanvas.
Programmer is unaware of how worker version works and uses Three.js just as usual but gets extreme performance boost as all heavy computations happen in workerised renderer!
The text was updated successfully, but these errors were encountered: