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