- Home /
Isometric occlusion culling inside buildings
I have a 3D scene using an Isometric camera, 35 degrees from the ground and 45 degrees around the Y axis. The scene contains full 3D models of houses, when the player character walks into the house, I'd like to cull parts of the house, so that the player is not obscured by the walls, ceiling & roof.
I've made a picture that describes what I'm trying to achieve, this is not from my scene, just an arbitrary isometric image taken from a google search. Faces r,s & t are to be invisible to the user as not to obscure the character.
From what I gather, I can use occlusion culling portals to occlude what is not visible outside of the room, but I don't think this will occlude faces r,s & t.
A ray can be draw from the player along r,s & t and the mesh renderers with a particular layer can be disabled, however this isn't entirely satisfactory as the faces r &s are made up of several different meshes and a single ray will miss these. Is it a case that I should use multiple rays to detect the objects to occlude?
one solution I can think of, but don't know if possible would be if I could specify volumes extending along r,s & t, which disables mesh renderers that are contained within.
Is there a way that I can use Unity's built in Occlusion culling to do this? How is this done in other games?
Answer by Batzuga · Jan 28, 2020 at 02:36 AM
You can create a "lightswitch" type of solution with a trigger. Inside every house add a trigger, and the trigger should turn off the renderers from the walls and objects you want to hide when you are inside the house. And when you exit the house you exit the trigger, and switch all of the back on.
Many isometric games also cast a ray from the camera to the player. And everything that the ray hits will be transparent or faded in some way. There are many other ways too but these are the first two that came in my mind.
Answer by craigjwhitmore · Jan 31, 2020 at 01:35 PM
The light switch idea is useful and probably the simplest.
I think occlusion culling the faces is probably overkill in complexity for my needs.