Just wondering, what method does the Unity engine use to partition a level. for example, I want to create an entire level for, say, a racing game that would consist of 500,000 polygons or more. Obviously, not all of them will be visible on the screen at any one time. What does Unity do to draw only the polygons on screen? Portals? OctTrees? BSP?
Rendering-wise, it’s not (strictly speaking) partitioned, it’s just that objects outside the camera’s far clip plane are not rendered.
It’s easy to set up a partition system using trigger colliders and SetActiveRecursively, if you have more specific needs (like looking farther straight down the raceway than you need to be looking to the side of the track)
Well, that depends on what you’re doing. Sometimes you don’t want to rely on just the built-in culling, which is view frustum culling. For example, if you’re doing an indoor game with a lot of rooms, it doesn’t make sense to render those rooms that you can’t see just because they’re also within the view frustum. However, this is exactly what happens now. Fortunately it’s not hard to implement your own solutions for things like portal culling, using triggers like StarManta said to turn off objects you can’t see.
A racing game would probably be fine with just view frustum culling. Just make sure to keep the view distance sensible, and maybe implement some kind of LOD system depending on what sort of stuff you’re drawing. The upcoming terrain system in 2.0 might make this easier depending on what sort of racing game you’re doing.
I bet Unity implements a system where they also don’t render polygons that are behind other polygons. I’m thinking that’s the “really, really fast” part means.
Actually, it doesn’t. (And yes, that’s a fact. ) That would be kind of hard, and also not what you want a lot of the time. (For example, you need objects to be drawn behind other objects in case you’re using transparent textures.)