How to hide objects that stands out of sight


I understand there is Frustum Culling functionality in the camera. But it only works on objects out of camera viewport. Is it possible for me to edit, or at least make so, to hide objects that behind first objects that obstruct sight?

I am planning to make a big map and Frustum Culling would work when the player stands at the centre of the map. But when a player moves to the edge of the map they can see ALL meshes within the camera. I need the camera to stop rendering behind the first object that its raycast collides.

Please note that the map has wide areas to be shown at some points so restricting camera sight is not an option.

Please forgive me for this poorly drawn example:

Playcanvas is gonna be the best for my circumstances but the inability to control such meshes I mentioned above is an obstacle for me.

Edit: Accidentally hit “Send” button, editing to finish my writing.


What do you mean by ‘hide’ in this context?

Not render? Disable? Etc

What happens in the case of a mesh is only partially obstructed? Or behind a semi transparent object?

Not render at all. I made some research, Unity has something called Occlusion Culling, which is similar to Frustum Culling but it basically not renders the object behind first object. In fact, it doesn’t render some parts of the same object those occluded by the surface camera sees first.

(please forgive me if using other frameworks’ names on the forum is forbidden)

Edit: Sorry didn’t see last part of your comment;

Objects that partially obstucted or obstracted by transparent objects would be drawn if possible.

Also by the tests I conducted for Frustum Culling, when I move my mouse attached to FPS character camera lookAt, it freezes and turns the rotation way more than I intended to turn it. Researched a bit more on the internet about this and appearantly high DPI mouses cause this issue in other games as well, such as Rainbow Six Siege and CS:GO but developers resolved this issue by adjusting dt with DPI rates.

Hi @theronax,

There isn’t any implementation in the Playcanvas engine for occlusion culling, so you will have to code a solution yourself. To manually add/remove the mesh instances from the layers’ render lists.

Here is a relevant older post:

By the looks of it Unity had this at 2015 as a built in feature. It’s a shame Playcanvas couldn’t offer such features in 2020’s.

1 Like

Can you share these tests please? It be interesting to see what is causing these freezes.

It’s not a trivial feature unfortunately and taking into consideration of the apps and games that users generally make with PlayCanvas, occlusion culling doesn’t help in most cases.

PlayCanvas is a very small team compared to other game engines like Unity and Unreal so we try to prioritise features that we think would be most beneficial to the common use cases. :slightly_smiling_face:


Sorry I deleted the my test projects but basically if you have 50k tris within the occlusion culling enabled camera this occurs.

Also sorry for my blunt statement about year and comparison with other engines. I know Playcanvas made possible to work from web browsers on a lightweight editor. With few people working on it, Playcanvas is a miracle to have in our lives. Thanks for the great editor.

I was thinking it shouldn’t require much development time to implement occlusion culling, since there is already frustum culling, that’s why bring up the subject.

It’s a trivial feature for me and I am sure there is more people like me that would love to use such optimization features in their projects.

Frustum culling is straightforward check (is the bounding box of the model in a wedge).

Checking if something is visible from the camera is much less so (how do you check that every section of the bounding box is visible or not?) and mostly likely to be CPU intensive which is probably why Unity bakes the information in the Editor.

Was the 50k tris part of the same object, or made up many objects?

Many objects. I used batching and frustum culling, also deactivated basic collisions on each object when they are out of camera sight.

But nevermind, Playcanvas is not for me if there is no plans for occlusion culling anyways.

1 Like

I was thinking if there are any other optimisations that could be done to help your use case?

If it’s all opaque objects, maybe working out a way render objects front to back to prevent overdraw.

The frame drips you got when moving the camera is a bit worrying so would like to reproduce that if possible.

As a workaround, you can alternate when needed. If the camera is in a wide area, increase the “Far Clip”. If the camera is in the narrow areas, use a low “Far Clip”. A simple trigger box can make that possible :+1:

Also, maybe you can use fog when on a low end device.


Thanks for the answers but what I need is occlusion culling, not workarounds and other optimizations so I can save my work force in content instead of doing something that editor should do. So I already moved on to other engines.

That’s a shame but understandable if our engine doesn’t have all the features you need.

Good luck with the project!

Since I’m searching and haven’t seen a playcanvas solution for Occlusion Culling, here are two of the many occlusion techniques UE4 uses that I could see being worth implementing, since their concept is simpler and depends on a developer setup. One is Precomputed Vsibility Volumes, the other Cull Distance Volumes. Hope it will be implemented in some form one day, since interior scenes benefit extremely from it.


I read it again and noticed occlusion culling wasn’t implemented, but hinted.

1 Like

Just checking again but I guess there still isn’t occlusion culling. And meanwhile godot released this.

How will Playcanvas respond back? Or will there even an useful update other than fancy glass materials and VR/AR?

There are many limitations in WebGL, compared to native engines. Many features are simply not possible, others are very expensive. If you want to compare Godot, you should compare it with other system engines, like Unity or Unreal.

  • Configurable Render passes looks like it’s due for 1.68.0.
  • Compute shaders are in the works for WebGPU
  • ES Module build pipeline and treeshaking I think is on the works for the Editor
  • Clustered lighting and cascading shadows was added a while back
  • Gaussian splatting was added for 1.67.0
  • Draco compression for GLBs
  • Basis texture compression
  • Animation State Graphs
  • Version control additions/QoL updates
  • WebXR room capture and anchors
  • Area Lights
  • GLB asset import to the Editor with material support

@Leonidas 's SDK has Occlusion Culling as a feature