-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Expose runtime baking functionality in OccluderInstance3D #90590
base: master
Are you sure you want to change the base?
Expose runtime baking functionality in OccluderInstance3D #90590
Conversation
5525c4a
to
535c7b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs are fine now and the feature is intriguing by itself, but the TODO is intriguing, as well:
Move saving to disk to a different method
This can be used in editor plugins and exported projects.
535c7b0
to
108ad4f
Compare
i need this for my game... 😭 |
Looking at the proposal it seems that the user was just asking for the simplify function to be exposed. They are already able to bake occluder nodes at run time, but they are missing the ability to simplify the generated mesh. Accordingly, I wouldn't go forward with exposing the bake function as-is, instead, to solve their problem, we should be exposing the simplify function in an easier to use way. The problem with the bake function is that it does a bunch of additional things that will be harmful:
|
"Bake" isn't 100% correct here, as the user has to manually create the ArrayOccluder3D and set its vertex data by manually traversing the scene. This is still nontrivial to do correctly for users (especially when multimeshes are involved), so I think a high-level Stalling the GPU is inevitable either way (it will also happen if you manually query mesh data in your script), but it's expected that you only bake occluders when loading a scene, not during gameplay. The operation takes too long to be viable during gameplay anyway, and changing occluder data triggers an Embree BVH rebuild which further slows things down. |
This can be used in editor plugins and exported projects.
Testing project: test_occluder_runtime_bake.zip
TODO
bake_scene_and_save()
), so you can bake without saving to disk. This can be useful for procedurally generated levels that are discarded after a gameplay session, so caching wouldn't be relevant here.