So not so long ago I learned that Roblox may or may not do occlusion culling.
For context:
Here is occlusion culling with an image.
It’s basically just discarding objects that are hidden behind other objects and not rendering them.
Roblox does frustum and backface culling which are pretty much basic in nearly every modern game engine.
Roblox as far as I know however, does not cull hidden objects.
In most cases this is not an issue, Roblox has been doing fine for years without occlusion culling and it also has potential draw backs such as the added overhead for having to check visible objects every frame.
The big but,
for a game project I might want to design and play around with an experimental Lua implementation of a culling algorithm to see how much it affects performance and perhaps my project will run a lot better on old/low-end computers.
My current idea so far:
My current idea is to give models a smaller “visibility” hitbox and put them in chunks so I don’t have to cycle through the entire workspace.
Perform a simple raycast and it it does not reach the camera without intersecting it’s marked as “hidden” and I can make it invisible to improve performance.
Now… making the object SHOW UP again is a different challenge, because for that I would technically have to raycast every single frame for every single object.
So while graphical performance would increase, CPU performance would decrease for every hidden object that gets added to the list of hidden objects.
That’s not good.
My method for making objects appear again was to have an inflated volume/hitbox that the player’s camera has to look and raycast into for it to appear again.
But I wonder if that’s truly the most convenient way to do it, I feel like it might not.
Game engines actually implement a lot of these culling optimizations with buffers, textures and whatnot but Roblox ain’t some engine where you can do low-level programming so I have to think of a simpler, more naive approach that makes use of higher-level functions like the physics engine and raycasts or region checks.
It might actually not be worth it to implement a custom culling system but I honestly want to give it a shot.
It might actually prove to be very useful for games that are open-world with massive mountains or indoors and have many rooms full of objects and whatnot.
All your feedback, comments and thoughts will be greatly appreciated!