-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
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
WebGPURenderer: Render Bundle + Shared Bind Group (WIP) #28719
Conversation
Incredible. This PR marks a significant leap forward as the WebGPURenderer will now offers way better performance and a more modern API, surpassing the WebGLRenderer and aligning with the latest 3D API. The UBO and static part will also benefit the WebGLBackend. An interesting example could also be a split-screen camera view (3D Editor Tools UI / Mario Kart style) rendering the same scene multiple times from different camera angles. |
Currently, one thing we need to figure out soon is how to update a specific object within the bundle. Using something like Additionally, we can later introduce frustum culling via indirect draw calls. For example: _renderBundle( bundle, sceneRef, lightsNode ) {
if ( renderBundleNeedsUpdate ) {
...
} else {
const renderContext = this._currentRenderContext;
const renderContextData = this.backend.get( renderContext );
for ( let i = 0, l = renderContextData.renderObjects.length; i < l; i ++ ) {
const renderObject = renderContextData.renderObjects[ i ];
if ( renderObject.object.needsUpdate === true) {
// TODO 1: ... update object here if needed
}
if ( renderObject.object.visible !== prevVisible ) {
// TODO 2: ... handle .visible flag here and maybe layers?
}
if ( renderObject.object.frustumCulled === true ) {
// TODO 3: handle frustum culling via indirectDraw call in WebGPU and CPU in WebGL
}
this._nodes.updateForRender( renderObject, renderGroup );
this._bindings.updateForRender( renderObject, renderGroup );
this.backend.draw( renderObject, this.info );
}
} /cc @sunag |
Great progress - Can I suggest: I prefer to avoid interfaces like this:
Which are going to guarantee O(n) iterations Write "batch" interfaces
(or whatever) Batch operations allow for O(1) updates and more generally allow batching work performance optimizations. Of course there are many factors to balance in designing an API. |
I think that when we have sub-children it is better to define the property on the object instead of on the group, since the renderer deals with RenderObject, it seems easier to implement it as well. I am inclined to add object class terms to handle this, like |
|
These are interesting... How about: group.updateChildAt(i) |
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
@RenaudRohlinger @aardgoose I think all related implementations have been done in separate PR. Thanks for the help 🙏 |
Related issue: #28347, #28705
Description
Shared Bind Groups bring great results in rendering optimization, together with the Render Bundle it is beautiful to see, it was so simple when setting
object3d.static=true
to get this result.Live example