- Home /
How to exclude certain moving objects from occlusion culling
Hi, I've successfully set up occlusion culling areas which are now culling most of the objects I need culled. The issue is that I am making a networked game which involves a mechanic that allows players to see others through walls. This uses a shader which is activated on the player mesh allowing the other player to see them. The problem is that the occlusion culling areas are also culling the other players, causing them to be invisible even to the 'xray camera'.
We need the occlusion culling areas because they are culling other moving objects and have even helped with culling static objects, but we don't want the players occluded. Is it possible to exclude specific moving objects from the culling?
I've fixed my issue so that we can see other players through walls now by using a second depth only camera. Problem is that the occlusion culling seems to be occluding one of the player's bodies and only showing their head... So excluding the character from the occluding would still be great.
Answer by Radiangames2 · Jan 20, 2017 at 07:07 AM
I ran into this problem as well (a distant game world marker would get occluded). The best workaround I've found:
mesh = this.GetComponentInChildren().mesh;
mesh.bounds = new Bounds(Vector3.zero, Vector3.one * 10000f);
Basically this makes the mesh always render, because the bounding box is enormous.
Thank you! this help me with my outline shader, because i cannot get working with occlusion. When you want to get the item in the normal state should i use: mesh.bounds = new Bounds(Vector3.zero, Vector3.one ); ??