Occlusion Culling

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

8 Likes

Why? Honest question.

4 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.

22 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)?

31 Likes

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

4 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.

7 Likes

Occlusion culling is on the 2024 roadmap.

16 Likes

No wayyyy! After all these years of “mobile doesn’t support it” it’s coming!?

1 Like

We already toggle whether or not something can be hit by raycasts (CanQuery) so I don’t think an occlusion property is a crazy concept, especially for devs who are into optimization.

tl;dr - lots of the arguments made in the past (including my own post above from 10 years ago) don’t apply anymore, so it’ll be exciting to see how this is implemented.

6 Likes

guys, Roblox is not a general-purpose video game engine, it is a scriptable RAD platform, that’s it

1 Like

Let’s change that! Some developers have been on here for 10 years, I think they deserve some revolutionary improvements by now.

6 Likes

I hope there’s a related public API for this too.

I’m looking for an API that will return an array of BaseParts within the camera’s view frustrum that are unoccluded in order to reduce the amount of parts being cloned into ViewportFrames (the use case being something like split screen, picture-in-picture, mirrors, etc.).

Something along the lines of Camera:GetUnobscuredPartsInView(farPlaneZ: number): { BasePart } would be absolutely ideal! It’s currently causing me great pain trying to figure out a speedy and efficient software occlusion method.

2 Likes

It’s 2024 now so add this feature

5 Likes

It’s coming now :sunglasses: watch the RDC24 keynotes!

2 Likes

I see it but i don’t know when it’s coming still

1 Like

It’s already out to some extent. Select games have it enabled, so I expect it to be out for other games soon.

3 Likes