-
-
Notifications
You must be signed in to change notification settings - Fork 21.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
Implement simplification of generated occluders in OccluderInstance3D #50408
Implement simplification of generated occluders in OccluderInstance3D #50408
Conversation
926954e
to
fa92872
Compare
fa92872
to
c0cfea3
Compare
This looks great! 👍 I wonder whether with the bake simplification values exposed to the user whether it be a good idea to standardize these (to say a range 0.0 to 1.0, with 0.5 default), and then convert these values to the meaningful (esoteric) values used by the mesh library. This could make it easier from a user perspective, and also give a bit of insulation should we decide to change the mesh library at a later date. |
c0cfea3
to
15204d6
Compare
|
Does this work well with concave geometry? My concern is that such a simple decimation of the mesh will result in false positives I'm the occlusion code. We should experiment with a range of meshes. |
The meshoptimizer library is used if the `bake_simplify` property is set to a value greater than 0. The default simplifcation threshold (0.02) is fairly aggressive, but occluders don't need to be very detailed to work well. This also adds documentation for occlusion culling in the class reference XML.
15204d6
to
e6199a5
Compare
I made a testing project: test_oc.zip The whole level (from https://github.com/Calinou/game-maps-obj) is a single mesh, but dynamic objects (boxes here) can still be occluded. I've subdivided them and duplicated them at the same location so that you can spot them easily while using the wireframe and overdraw debug draw modes. With the default simplifcation factor, I couldn't notice any false negatives (objects being occluded when they shouldn't be) after several minutes of flying around the level. False positives (objects not being occluded when they should be) will happen more often with simplification enabled, but it's likely not as problematic. If this is an issue, we could default to having simplification disabled, or set to the most conservative value (0.0001). |
The meshoptimizer library is used if the
bake_simplify
property is set to a value greater than 0.The default simplifcation threshold (0.02) is fairly aggressive, but occluders don't need to be very detailed to work well.
This also adds documentation for occlusion culling in the class reference XML.
Testing project: test_occlusion_culling.zip
Preview
In this particular scene, even the most aggressive simplification still provides good culling capabilities. However, this may not be true in more complex scenes.
Remember to tweak the Bake Mask to exclude dynamic objects, small objects and fixtures from your occluder mesh.
No simplification (0.0)
Lots of stuttering.
Most conservative simplification (0.0001)
Still a fair bit of stuttering.
Balanced simplification (0.01)
No more stuttering.
Note: The default simplification value is now 0.02, which is more aggressive but still works quite well.*
Aggressive simplification (0.1)
No more stuttering.