Hi there unity fokes. Me and my semester group is in the middle of a game project.
We ended up in a discussion that sounded like this:
When creating a level for a game, what is the proper way of doing so when talking walls/floors (talking FPS game), and what is the easiest approach?
At first we were thinking building our walls/floors with boxes would suit our needs, but then we realized that proffesional companies doesn’t use boxes but instead uses flat planes (only for walls/floors which backside is not suppose to be visible to the player). As an example go check the Angry Bots demo that is brought with unity, they utilizes this to a certain extent.
Why is this approach taken, is this done to save computational power? If so, is this issue still relevant? Taking into considerations that characters and models now a days consist of thousand of vertices, while a simple expansion from plane to boxes would only create very few vertices.
Also, what would be the easiest approach for developing a level? Creating the entire level in programs such as Max or Maya or would it be more suitable to develop it from standard primitives in Unity?
Well, every vertex counts when you are low in performance. About designing the scene with primitives, I would suggest you to not do this, since you will lose a lot of flexibility and will have some repeated vertices. Do all the structure within a program like 3dsmax and then add the objects directly in Unity.
Check out youtube for examples lots of companies sketch up the levels, using basic blocks, prototype and test them before refining and modelling them.
For speed you could block things out in Unity using basic primitives, but to be honest probably better to use the primitives from your 3D modelling tool, as you will start to get the import settings and production pipeline started, and it will be easier for your artists to adapt an existing 3d prototype in their tool to modelling a scene from unity screenshots.
But once you start making modular elements then you can do most of the level design/tweeks in Unity.
Regarding planes and cubes plane 2 tri/4 vert, cube 12 tri/8 vert, 6x texture area then multiply by 100, 1,000, 10,000. Your GPU can only handle so many tri’s, and your CPU can only check for so many collisions a second.
In our case we are going to have a single level, which will be inside a big mansion. I personally think it will be too static to model the entire mansion’s walls, floors and ceilings into a single model, as this would create problems when imported into Unity. Instead I think it would be better to split up the entire mansion into several models, where each model represents a room.
Is this a suitable approach, or would it actually be better to model the entire level in one go?
Yes to take advantage of occlusion culling you will want separate rooms, also this will allow you to re-use rooms as modular pieces within the mansion.
Just to be pedantic, cubes can be even worse than that.
If you want a cube to be faceted (i.e each side has flat shading) then a cube needs 12 tris and 24 verts.
If each cube has a separate texture (not atlased) then that’s 6 draw calls instead of 1, and only gets worse with more lights/shadows/complex shaders etc.
Splitting up the model by rooms sounds good, as Arowx says it gives you the opportunity to use occlusion culling, but its also going to be easier to work with too (e.g. imagine you want to update a single room, you don’t want to export the whole mansion again).
However just because you have separate rooms, doesn’t mean walls should be modelled as cubes. The reason why in most cases they are planes is to reduce the performance overhead. Sure these days you can push huge amounts of polygons, but that doesn’t mean you can simply ignore polygon counts. Avoiding modelling unseen polygons, means you have more polygon budget to add detail elsewhere.
Okay thank you both, that answered my question. But I don’t have a clue what occulision culling is.
Edit: Okay, I just make a quick search about occulsion culling, and I must say I am amazed. I didn’t even know Unity could utilize such a powerful tool. +1 for Unity.
Your GPU will draw what is in front of the camera, everything that is in front of the camera, depth first so distant hills, clouds, buildings, walls right up to what you can see in front of you.
This means it’s drawing a lot of stuff, to make it go faster occlusion culling ensures that things that are not visible are not sent to the GPU.
Result more polygons for close up detailed stuff and a faster smoother game.
no, make the level a 3rd party program, so you can get the look and feel. You can either use generate colliders on it or use mesh colliders. I you want a more old school approach, you can just put colliders on manually for an invisible wall effect. lol.
I’m a bit shocked that the Unity docs state such an inefficient method, which i’d be surprised to discover if that’s how the Unity engine actually renders stuff. The GPU obviously has no clue to the (depth) order things are sent to it to be rendered, meaning the engine should be taking care to send the closer stuff first so that the depth buffer can be used to ‘early out’ anything that is behind what has already been drawn, its one the advantages of using a depth buffer in the first place. There are a few exceptions, but essentially for solid geometry it should closest first.
[/quote]
I saw this in action when I played a MP game. If I looked out a window at a certain angle, geometry actually popped in. For a second, it through me off.
The trick that we face as game developers is that we’re on a resource budget.
3D Artists are always having to balance good looks and the graphics/memory contstraints of the system they’re working under. Too many polygons, and/or too deep of textures, and/or too complex of a shader, and you wind up with a sluggish game.
Programmers like me on the other hand have to make sure our code is as efficient and fast as can be. Of course, your question isn’t about code, so I’ll get off that.
An approach you might find useful is modular pieces. Pretty much, you make a generic part of a building or cave or whatnot. Give it a texture, and put it in your scene. Then, you just daisy-chain these modules together until you get a complex-enough house/cave/whatever.
Unity also makes this easy - hold down the Alt key while you’re sliding pieces around and you can perform vertex snapping (it helps - trust me!)
Thank you all for answering, so far we have gone with modelling all the rooms in separate models, and we are also planning on implementing occlusion culling if possible.