Occlusion Culling

I’ve been having some trouble with lag lately because of using more and more bricks, which made me wonder something.

Why doesn’t Roblox have an occlusion culling feature?

If you don’t know what this is, it’s a rendering optimization that could greatly speed up Roblox and allow even bigger places to be build without lag. Basically, if a “camera” object can’t see something, the rendering system would unload it. As an example, you are looking at a wall. There are boxes on the other side, but you can’t see them. So, to reduce lag, the rendering system wouldn’t render them, but if you went around the wall, it would render them. Almost every professional-level game uses this. Of course, you would have an option to enable/disable it for certain blocks.

So basically, it renders the view of the camera only which reduces a LOT of rendering time. I’m just wondering, why doesn’t Roblox have this (yet)?

40 Likes

It’s because of all the dynamic content, I imagine they’d only do it for Anchored parts.

2 Likes

Then howcome even bloody minecraft has this.

It’s a feature that’s even built in OpenGL

Also surely parts that are covered by fog shouldn’t be rendered?

10 Likes

Then howcome even bloody minecraft has this.

It’s a feature that’s even built in OpenGL

Also surely parts that are covered by fog shouldn’t be rendered?[/quote]

I’m not going to go into anything Minecraft related. Minecraft is rarely as dynamic as ROBLOX. As for items that shouldn’t be rendered outside of fog, yes they should. Create a new place, place a part down. Cover it with fog then look at it with the skybox in the background. You still need to render that part.

3 Likes

Roblox doesn’t render parts outside of the field of view. That’s different from what is visible.

5 Likes

We don’t use occlusion culling because hardware occlusion queries are supported only on a small portion of mobile devices. They also have spotty support on older desktop cards.

Software rasterizer solutions like in CoD (I believe) won’t work on mobile.

Classic methods like portals or PVS require knowledge of the level geometry, involve a lot of preprocessing; and highly dynamic nature of Roblox levels (e.g. any part can move) pretty much precludes their use in Roblox.

16 Likes

[quote] We don’t use occlusion culling because hardware occlusion queries are supported only on a small portion of mobile devices. They also have spotty support on older desktop cards.

Software rasterizer solutions like in CoD (I believe) won’t work on mobile.

Classic methods like portals or PVS require knowledge of the level geometry, involve a lot of preprocessing; and highly dynamic nature of Roblox levels (e.g. any part can move) pretty much precludes their use in Roblox. [/quote]

Then don’t add it on mobile?It feels like mobile is holding ROBLOX back so hard. We’ve had to wait an extra, what, 2-3 weeks for CSG just because we had to wait for iOS to accept the update.

Why are you restricting PCs to what mobile can support? I don’t understand what you wrote whatsoever. Of all of the cross-platform games I’ve been involved in, mobile has significant changes to it. This answer just doesn’t make any sense to me and feels like an excuse to not do it. (Unless there’s something I’m missing)

24 Likes

Occlusion culling is not an ‘addon’ but rather the engine has to be built around it. You can’t just plug it in.

That’s ok, I’ll tell you a little secret: cross-platform games aren’t really cross-platform. If a particular title is advertised as “available on PC, XB360, PS3 and Mobile” - in (grim) reality those are four different games that share some common assets.

15 Likes

I’d imagine your Android app is a completely different game to PC Roblox too, and shares common assets. It runs in a completely different languages. So what’s the issue here?

Everything was better before people decided they wanted PCs in the pockets.

6 Likes

It’s not. Unlike most games, Roblox runs the same code on all platforms.

7 Likes

Why? Honest question.

3 Likes

What I meant earlier is that the cross platform games I’ve been involved in use different-ish code. We basically take the platform we’re working on, using their SDK recreate the base functions used for the game, then you can almost entirely copy-paste your game’s code and it will run.

However there are obvious exceptions. For mobile release we used different controls code, same for pc and game controllers.
We also nerfed a lot of rendering features for mobile and platform.

Why can’t ROBLOX do the same? If an 18 year old developer could achieve this, I’m fairly certain ROBLOX can do so. It makes no sense to force your code to run on all platforms without any slight changes.

5 Likes

Isn’t there a way to check if the device your on has Occlusion Culling support on a hardware level? I’d imagine so since really occlusion culling is a client-side feature so I would think it wouldn’t be too hard to detect if it does then apply the setting on startup. Also, occlusion culling has to be done carefully or it could actually reduce performance.

2 Likes
  1. ROBLOX mostly uses a shared C++ codebase. We do have platform-specific code (as any game out there does somewhere), but outside of the platform-specific UI (that uses Java on Android, Objective C on iOS, and C++ on other platforms) the amount of platform-specific code is very small, probably <5% (and mostly includes graphics support code and platform-specific optimizations that e.g. use NEON for iOS/Android). However, there is platform-specific code (and platform-specific optimizations) - we don’t really have constraints along the lines of “this will not work on mobile so we can’t implement it”, it’s just that code that works everywhere is more valuable.

  2. Most games out there follow the same pattern. If your game uses Unity you use a big cross-platform C++ codebase even if you’re not aware of it. Same for Unreal Engine-powered games and a lot of games using various in-house engines. If a game goes mobile there could be a complete rewrite if it’s a port made by a different company, of course - but then even the art assets are generally not used as is. If a game is largely preserved during the port, the codebase is likely to be largely preserved as well.

  3. We can implement occlusion culling, we just never got to doing it. While the choice of possible occlusion algorithms is severely restricted in ROBLOX due to platform constraints - we can not do heavy precomputation, and we can not force developers to tag objects as likely occluders, so the system has to be automatic and has to handle dynamically changing environments. Having said that, there are algorithms that can do that. They are usually hard to implement efficiently (Sparker22 is correct in saying that occlusion culling is a careful balance, implementations could inadvertently introduce sync points between CPU and GPU and make the game slower).

  4. Finally, due to constraints of the platform, the choice of the algorithms is likely restricted to ones using GPU occlusion queries - the only good way for us to implement this without compromising the performance would be to introduce extra latency for occlusion checks. You might have seen it in Unreal Engine-based games - you go inside the corridor and the far end of the corridor briefly flashes with i.e. white before showing the geometry - this is usually due to the fact that occlusion results are delayed by a few frames. I don’t think this is a barrier to implementing this, just wanted to mention it.

20 Likes

Very late but I’m assuming there is still no occlusion culling because this lags (gray clump is many subdivided cubes)

Are there plans to ever add occlusion culling to Roblox? Or is this something we developers will have to script ourselves (at least for the next 3 months)?

30 Likes

Streaming kind of helps but this would be nice. My game has way too many trees.

3 Likes

I wished they would add a way to remove shadow casting only for terrain…

Streaming doesn’t work in my instance, I’m making a huge map, and we need to be able to EXCLUDE models from being streamed in and out.

4 Likes

Apologies for necro-bumping this.

Part 1 / 2

@maxvee
It is currently 2024, most PCs and consoles by now pretty much in some way support the hardware or software version of occlusion culling.

The “mobile doesn’t support it” argument has been used to disregard countless of feature requests.

A lot of developers don’t make mobile games and being denied features and optimizations that do work on the platforms we target is inconvenient at best.

If we could at least get some engine optimizations on the platforms that do support it, I and probably many other developers as well would be very grateful for it.

It would save A LOT of time and headaches, if not having to switch over to a different game engine and learning a completely new workflow and way of programming just for the sake of having a more optimized game or using some pc/console exclusive features.

Part 2 / 2

@zeuxcg thanks for the informed reply that I read after writing.

I’m fully aware some features are very hard and challenging to implement, being someone who’s also learning all about the ins and outs of low-level programming.

I do wish however that some solution can be found in the future.

Oh I wanted to mention here, Unreal Engine actually does by default, tag everything as an occluder.
I honestly get Roblox might not want to give developers too many settings and options since it would make the engine more complicated and harder for new developers to learn.

Though part of me wishes Roblox had a “checkbox” or a “switch” in Studio to expose advanced settings, objects and perhaps auto-completions inside the script editor for more system-level control, hidden by default but available for those who want to tweak every little setting in the engine.

I know this stuff can get complicated, being someone who’s learning Unreal Engine.
Unreal has a option for almost everything and sometimes very specific things that I end up reading whole wiki articles about before knowing what it is.

Though, I feel like exposing advanced settings and scriptable properties for power users would be a really neat thing for the small % of developers who truly wish to push the Roblox engine to it’s absolute limits.

6 Likes

Occlusion culling is on the 2024 roadmap.

10 Likes