-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
WebGLRenderer: option to enable multi_draw / gl_DrawID in vertex shader #27630
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
Because objects are rearranged for object sorting and filtered for frustum culling the |
How I understand it the Unless Ive missed something the size of the texture will be a lot smaller in most cases wont it ? In this presentation I found on khronos.org they also say on page 14
Dunno if this is helpful compared to buffer attribute, I really do not know enough about this stuff. |
This is the case but you wind up using another one of your limited texture slots. I don't think it's worth changing BatchedMesh until it can be shown this is causing issues. It does occur to me that a separate texture like this, though, can be used to render multiple of the same geometry in a single BatchedMesh without having to duplicate the data in the vertex buffers. So effectively we could cover instanced meshes and batched rendering all with a single object and draw call. An API with this in mind would need to be designed, though, which doesn't sound straight forward. I suppose we can add this extension for experimentation, then. @Mugen87 is there anything else we need to change for adding support for the extension? I'm less familiar with what needs to be done. |
Clean up.
Related issue: #XXXX
Description
Was trying to make a modified Batchedmesh, but I could not not use
gl_DrawID
in shader.now it should be possible to enable it like this:
See here for more information:
https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_multi_draw
Note: Although the extension name is named WEBGL_multi_draw, the extension must be enabled with the #extension GL_ANGLE_multi_draw directive to use the extension in a shader.
When this extension is enabled, the gl_DrawID built-in can be used in shader code. For any multi* draw call variant, the index of the draw i may be read by the vertex shader as gl_DrawID. For non-multi* calls, the value of gl_DrawID is 0.