发表于 2014-1-30 23:25
本帖最后由 紅塵市長 于 2014-1-30 23:34 编辑 |
How Things Work: Architecture and Space in SimCity
Jan 30, 2014 Cristian St. Aubyn, Senior Technical Artist
I'm Cristian St. Aubyn, a Senior Technical Artist at the Maxis Emeryville studio, and I work on the art creation process. Recently we released our Modding Policy; you can read that here. Modding is an important part of the history of our studio, and we're excited to see what you create.
Today, I'm happy to introduce you to the first in a series that we call "How Things Work". This series will help you understand the underlying ideas and processes of how we create game assets for SimCity. We hope that this gives insight and understanding that will help you create and build Mods.
This first blog is an introduction to how we create buildings in SimCity. Our pipeline is complex so I will start with a basic description of the building geometry and then go into the more involved topics later. For those interested, we use Maya in combination with a series of in-house custom tools to create almost all of our game models.
SimCity is a sandbox style game. A player's city can have an unpredictable combination of buildings, roads, and the like. Unlike "Levels" in more linear games we do not have strict control over the type and amount of geometry that needs to be rendered at any given time.
Our game engine needs to perform well regardless of the city that a player winds up creating. To address this issue we look at the play area and set various "budgets"; in this case polygon budgets which are based on the two dimensional space a game asset occupies.
Smaller buildings have lower polygon budgets, bigger buildings have larger ones. As long as all buildings stay within their budgets, a city filled from edge to edge with any combination of buildings should stay within the polygon limits of our rendering engine.
Here are a series of screenshots showing what various building geometry looks like.
This image shows one of the smallest buildings in the game, the "Shotgun Shack." It has the lowest polygon budget of all, but due to its small footprint it turns out to be a potential performance hog. While each one isn't very complicated, they can be placed very close together. When they all add up, a city filled edge-to-edge with "Shotgun Shacks" would represent a lot of polygons.
Here's the "Highrise Office", an example of a larger more detailed building. Buildings like this take up much more area and therefore have higher polygon budgets.
The repetitive nature of the middle of the building allowed us to concentrate most of the geometric detail at the street-level and at the top of the building where a player is more likely to see it.
"Highrise Office" Street Level
You can see that polygons have been used at the base to create architectural detail at the street level. This helps make the model unique compared to other tower style buildings. It also adds interest at the street level that players will see when they are zoomed in.
"Highrise Office" Roof
Considerable polygons were also focused on the top and roof of the model as this part of the building will show significantly as the game camera passed over the building.
"Medium" sized buildings can actually vary in size, but the lot space they take up on the game map affords then a higher budget than small buildings. While modeling such a building the polygons need to be used where they will give the building detail appropriate to its design.
The coal mine shown below needs to have a skeletal industrial look. Modeling this much cross bracing would not be possible in the budget allocated to small buildings. However, this relatively small building sits on a medium size lot and has a fairly generous budget for the physical size of the model itself.
"Coal Mine" Detail
Level of Detail:
When a model is close, it needs a lot of detail, but when it’s seen from far away, it can be represented with simpler geometry.
This is common technique in game engines, and involves building multiple LOD’s (Level of Detail) for each model. Using LOD’s dramatically improves performance, and can also help mitigate aliasing and other visual problems.
In SimCity, buildings are authored in four LOD’s, going from the most detailed to the least detailed. The game engine automatically selects a given LOD based on the model’s distance from the camera.
LOD-0 is the highest resolution version, LOD-1 is reduced by 50%, LOD-2 is reduced by another 50%, and finally LOD-3 is reduced another 50%.
Here’s a High Wealth, Low Density House and its chain of LOD’s.
"Modern House" LOD-0
Highest polygon version of the model. In this case it is under budget so there is less difference between LOD-0 and LOD-1
"Modern House" LOD-1
Decorative details have been removed such as the balcony railings and the trim at the edges of the metal roves.
"Modern House" LOD-2
Geometry has been significantly simplified while maintaining the overall mass of the building. Curved shapes use less divisions and narrow elements such as the roof edges and decorative cross beams have been removed.
"Modern House" LOD-3
This LOD appears when the camera is at a significant distance from the model and the building will be fairly small on screen. Polygons have been removed everywhere possible leaving only the forms that would show a visible “Pop” if they disappeared when the model transitioned from LOD-2 to LOD-3.
Technically speaking a Maya unit translates to one meter in our game engine. However, the assets in our game are not true to scale. Small elements are usually exaggerated and very large objects are scaled down. Consider the image on the right comparing a house, a three story building and the Empire State Building (which is over 1200 feet tall). If the game represented a modern skyscraper to scale small buildings, cars, and pedestrians would be all but invisible by comparison.
The best approach to creating a building in SimCity is to find something that “Looks” like the right size in the game and work from there.
A bit more about polygon budgets:
As I mentioned before polygon budgets are based on the area a building occupies. This is actually measured by the lot size of the building not the model itself. Square area is what is taken into consideration not volume. So a taller building is not allowed more polygons simply for being tall. Fortunately most tall buildings sit on larger lots and therefore have reasonable budgets compared to smaller buildings.
The budget is: 0.5 triangles per square meter (for LOD0)
As an example all Shotgun Shacks sit on 16m x 32m lots:
16m x 32m = 512m2
512m2 x 0.5 triangles / m2 = 256 triangles
LOD-0 = 256 x 100% = 256 triangles
LOD-1 = 256 x 50% = 128 triangles
LOD-2 = 256 x 25% = 64 triangles
LOD-3 = 256 x 12.5% = 32 triangles
For LOD-3, the “Shotgun Shack” would need to be reduced to 32 triangles or less. 32 triangles isn’t much, but when a player sees LOD-3 of a building, it’s pretty far away.
Our buildings fall into two categories:
"RCI Buildings": The residential, commercial, and industrial buildings that appear automatically in zoned areas
"Placed Buildings": The player placed buildings such as fire stations, power plants, tourist attractions, etc.
When creating Player Placed buildings we are often more generous on the polygon budgets for two reasons. Firstly, we want these buildings to look a little more interesting as they are special assets. Secondly, they typically show up in limited amounts; you cannot fill the playable area with City Halls for example.
When creating custom buildings you could of course ignore the budgets we follow, but keep in mind the performance problems. If high polygon buildings start to fill a city it will not only affect frame rate, it could even start to take up too much memory. This can become a significant problem on lower spec machines.
I hope this helps give you an idea of how to create building geometry that fit within budget. Next time, I will tell you more about the building shader we use. Here’s a sneak peak at how the building shader allows us to add detail, depth, color variations and more.
Same Model in game with shader applied
Head over to our Modding thread here.
Until next time,