I’ve got some strange problems with rendering speed. Let’s say I’ve got model of the city surrounded by a wall. Inside the city there are buildings and people. Strange thing happens that when I look at the city from outside the walls, frame rate is dropping radically, even that all complex models (buildings and people) are behind the walls. There are maybe 100 of models inside, and I don’t understand why Unity even tries to render them all the time.
This isn’t a ‘strange’ performance problem at all.
3d rendering works by rendering everything within the view frustrum, starting from the back (far clip) and moving to the front (near clip). If there are complex models obstructed by a wall, they still get rendered, even though they subsequently get painted over by the foreground!
Unity Pro has an inbuilt solution to this, called ‘Occlusion Culling’. Occlusion culling checks for whether objects should be visible to the camera before rendering them- so instead of naively rending the entire view frustrum, it only renders the bits of it that should be relevant to the viewer.
Occlusion culling is very straightforward to set up, and will give you the performance boost you need here. If you use the 3.5 beta, it’ll even manage dynamic objects to a certain extent!