-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
WEBGLRenderer occlusion culling #20554
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
Conversation
|
Is this a duplicate of #15450? |
|
@Mugen87 not really as it is done internally as a feature of WEBGLRenderer and very user friendly with a simple boolean for activation |
|
This would be a nice feature but I think I agree with @Mugen87 in #15450 (comment) -- I prefer Babylon's more selective API. It's also worth noting that If something like a depth prepass is used though (#8676) where you have to render the full scene ahead of time anyway this type of more precise occlusion culling could probably come for (almost) free aside from the reading the query results back. It's a bit long but this GPUGems article has some nice information about how use occlusion queries to speed up rendering. It get's into a lot of extra optimizations we probably can't add and don't really need here but was still useful to dig in to. |
|
Hi, I'm the author of the other PR #15450. I found a few issues here:
It doesn't seem to do this in WebGL
It's actually very expensive to do it like this, and it would cause flickering. The CPU cost of dispatching and reading the queries is suprisingly large. And the results of the queries is guarenteed not to return until at least the next frame. (Both of these problems are WebGL specific). |
I didn't realize this was the case. For those interested it's outlined in the WebGL2 spec page.
By flickering do you mean full display flickering from missing a frame because queries are taking a long time?
I only meant to say there wouldn't be extra incurred draw calls or rasterization (unless a bounding box was used for a query) because the depth buffer would already be finished and the color pass could be used for the query provided the depth prepass is performed for the full scene before drawing to the color buffer. The query results would still have to be read the next frame. I think occlusion settings for objects should still be individually controllable as they are in the Babylon API. And if queries are expensive I'd expect you'd only want to enable them for complex meshes / shaders. |
|
Closing, see #15450 (comment). |
Implement WEBGL2 occlusion queries in WEBGLRenderer for occlusion culling