I’ve been using Unity3D for about 2 weeks, and could not figure this out/find an answer to it on the forums (if this has already been answered a link is sufficient)…
I have a scene that is basically a floor plan with a few different rooms. When I am in an empty room, there is large dip in frame rate when i am looking in the direction of a large number of verts that are culled out of view…What is the best method for optimizing the scenario in this case.
Thanks in advance,
-M
I fear they are not culled out.
You mean visually blocked by something I assume? In this case they are still rendered but then overdrawn by the object in front.
Your rooms are distinct models I assume? (just to be sure)
It is possible they are not being culled (Unity says 1.7M verts loaded in certain directions), but I am directly facing a wall…
No these are not different models, everything was created in the same level. Do I have to put the different rooms in different levels with portals? I thoguht the wall/obstruction would be enough to cull out the verts in other rooms.
Thanks
It is possible that you are facing a wall. But Unity has no PVS and BSP so everything thats within the view field (your screen rect and that expanded into your camera range depth) will be rendered, independent if the view upon it is blocked by something or if you can see them.
If your setup requires the things there to vanish you will likely have to build your world in a way that allows you to use triggers to remove whole areas from rendering.
So yes they are pretty much all rendered if they are within your view direction and camera range, but you don’t see them due to the wall.
No you don’t need different levels. But you need distinct models. Given you have 1.7M vertices thought you are already doing that as you wouldn’t be able to have that as a single model.
http://unity3d.com/support/resources/unite-presentations/performance-optimization
Check out this video, crozierm. It’ll be very helpful to you in setting up your scene for maximum performance.
***Just saw the video link, I will watch that immediately, thanks
You’re right, actually every entity is a different model (mostly prefabs), and each room may contain a bunch of these models…Is there info on how to structure this so that the different models are excluded?
I’m not overly familiar with PVS and BSP, is there documentation on how to set these up within Unity?
There is no PVS or BSP within Unity
If you want something alike, you must script your own system which decides when which things are rendered and which not.
If you have pretty small rooms thought the best starting solution is just to reduce the camera view range to a usefull value which means the maximum distance you can see within the whole area.
D’oh, misread your comment on PVS / BPS, sorry for the dumb question…
If i were to set up different sections as different layouts, what is the best method to link them? so it would be fairly seemless when walking from one section to another? Is there an easy way to jump levels based on a zone trigger? Docs?
You wouldn’t use different scenes (I guess thats what you mean by level?)
I would recommend that if you have tunnels or passages that connect them that you place “portals” in those connections.
Such a portal would be a trigger with a component that is able to hold 2 game objects / transforms.
Each of your rooms would have all distinct objects attached as child to a root node (empty game object). This root node then would be put into the portals node through drag drop
now if a player enters a portal, the previously active root nodes are disabled and the two that are linked to the portal are enabled
Basing on this you can expand it to do more and handle different things differently depending on what your game type requires.
Alternatively if each room is meant to be a level, you naturally can put them in different scenes which you load from trigger components once you enter the trigger.