As a Roblox developer, it is near impossible to tell if some rendered content has been culled. It’s possible to do, but it’s very slow, hard to test, and hard to perfect.
What is rendered content?
- Texture
- BasePart
- GuiObject
- LayerCollector
Culling exists to stop the rendering of content the user cannot even see. This is a revolutionary set of improvements for performance! However, your code still wastes time updating the content’s appearance or acting on it every frame, even when it is not visible. What a waste!
In the following example, each part is doing a lot of expensive work. The engine automatically stops rendering the parts you cannot see, but they are still doing redundant working in the background… wasting CPU time.
The game stays at 30 FPS or worse no matter how many parts are on screen.
Now in the following video, the parts only work when they are on screen.
The FPS starts at 30 and rises to 100! Keep in mind I added artificial lag for each part to mock a lot of work being done. Changing color and orientation isn’t very expensive. If you had more complicated rendering needs, it would have a similar impact.
It’s not getting the maximum FPS because frustum culling in Luau is expensive. The internal calculations have already been done… so exposing some sort of property, method, or event to tell if the part has been culled wouldn’t be expensive at all. Keep in mind that you’ll also be benefiting from Occlusion and Distance culling.
Bonus
Yes, the parts are actually not working when they aren’t on screen. No fakery here, other than the artificial work for each part.
Here’s the place file if you want to experiment or view the code! You can use anything here with no attribution and for free. If I make changes, I’ll add a new file instead of replacing this one.
CullingProblem.rbxl (70.9 KB)
3/23/2025
In conclusion, having a way to tell if some rendered content has been culled would help developers optimize their games.
If you update something every frame that the user may not see all of the time, you need this!