Simple Dynamic Occlusion Culling for Procedural Games
Simeon Pfeiffer
$5.00
(no ratings)
Date |
Price |
---|---|
Date |
Price($) |
03/16(2018) |
5.0 |
11/21(2024) |
5.0 |
Jump AssetStore
Occlusion culling is a great way to optimize your game's performance. The idea behind this technique is that only stuff that is visible to the camera should be rendered and objects that are occluded and therefor invisible to the camera are not rendered.
In what way is this solution unique?
There is a build in occlusion culling system within Unity3D. That system, however, needs to be manually setup and does not support procedural worlds or dungeons.
There are other assets that accomplish occlusion culling by raycasting from the camera to every single object in the scene, which is more accurate, but very expensive and as an approach not at all scalable for larger projects. This small script however uses a linear and heavily optimized approach. It works by dynamically configuring the far clipping plane whenever the view of the camera is completely obstructed - which can be checked with a very limited and fixed number of raycasts.
What can I expect if inside a cave/building or behind a very large object?
* Fewer draw calls
* Fewer Tris and Verts
* Fewer shadow casters
* Better shadow quality
Will this help me?
This script is meant for procedural worlds that are completely indoors or that mix open worlds with closed spaces. It's highly optimized so there should be very little overhead whenever the occlusion culling is not working. When the occlusion culling is working it should save you much more CPU/GPU time than it costs.
If your game does have large mountains or other large objects or closed spaces like caves or interiors of buildings than this script may greatly help improve your performance within those areas by culling stuff the player can't see.
Can this be integrated in my project?
Most likely, yes. It's just a single script that has to be attached to your camera.