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