Development Blog: Modeling – Triangle Counts to the Extreme -Updated
This sort of larger goal we’ve had with City17 is improving the visual quality as best we can. Taking advantage of what the Orange box version of Source shipped with, and more or less exploiting that to our needs and wants. The majority of those shipped features and enhancements has mainly contributed straight to either performance, lighting and shadowing, and shaders galore. One of the more mysterious pushes we’ve been working on lately is a combination of not only hardware advances in the past years since Orange Box shipped in 2007, but something the OB engine version also shipped with: Slightly better model rendering performance.
That budget isn’t going into new weapons, or higher poly npcs, but straight into the world where it really belongs. It’s a change we’ve made we’re really happy with. In terms of how much it’s pushed City17EP1 away from the flatness of the standard City17 art aesthetics, while maintaining a level of performance we’re also happy with. We’d like to think of it as a total conversion approach, without fully going total conversion. We’ve taken on the task of replacing a decent amount of stock content so we can not only get better rendering costs, but richer environments.
Some of the current additions:
Making things not as flat!
- There are currently 8 skin variations of each window
- There are three window models in total, one thats basic square, one that has fancy egdes, and one thats meant for tall thin panes, the more elegant windows you’d natrually find in the real world Sofia Bulgaria.
- The window models sit between 20-40 Triangles.
One of the biggest things we’ve learned is that window models get expensive fast. For us that’s double the quick because we’re already rendering god rays. God rays redraw the world to understand whats opaque, and whats translucent. Sadly we can’t selectively draw certain parts of the world. If the sun is visible, so are our sun rays, and that means the world is being drawn a second time. You can consider it like doubling the cost of a single window model. In a type of example, its current triangle cost goes up from 20 to 40 instantly.
Thats not even the end of it yet. We also have projectedtextures, which are more commonly know as the flashlight. These entities cast real-time shadows, by (you guessed it) redrawing the scene again based on thier casting distance. So this isn’t as expensive as rays, but it does double the cost of what is within it’s casting range. Generally thats around 25x25x25 feet in front the player. So now we’re drawing the world twice now and then, AND thats STILL not even it yet. The player can turn on his own flashlight at any given time, re-rendering that same scene again.
What was once 40 triangles can now be considered 120. On average there are about 30 windows visible on a building’s face. Each one is decorated with a window prop. That’s generally about 400-600 triangles just on one single building face. This is added on top of the other scenery we’re already rendering, including NPCs. How do we handle such a cost?
One of the greatest advantages of having windows as models is that we no longer are constrained to the repetitive-ness building textures provide.
We’re still limited in terms of how many variables of windows we can have visually. We’d like to keep them light on overall texture memory.
Before, we would have to place walls, and cut them up every 128 units vertically if we wanted to have a different set of windows per each story of the building. This was still fairly cheap, but the largest cost went over to brush rendering. We still use a slight variation of the previous method to change the borders and trimming now and then, but because we can place windows anywhere we no longer have to worry about using the textures we did before. Now we can use versions of the building textures that are windowless and save on texture memory. Secondly because we can now place windows anywhere we don’t have to worry about splitting up brushes. Brush cost goes down and the cost transitions over to the GPU rather than the CPU which is always going to be faster for this kind of a job.
The triangle count is still fairly high per building face. City17 is all about the debris and destruction though. Where one triangle count is high; it’s likely it’s way higher somewhere else. Higher than it honestly needs to be. 600 triangles per building face seems like a lot, thats also 600 more per building than what valve maps shipped with. We’re still reaching a higher cost than general, but heres where that got better; Part of the “replacing stock content” goal came in the form of this little guy:
We changed the texture for those familiar with this model.
He’s 1411 triangles. Yes. 1411. We often had at least 5-6 of these guys rendering at once, much like valve did. But we had a few problems with this model:
- It was really expensive for it’s size. It’s a debris pile with a radius of 256x256x32.
- Because of its height it didn’t cover a large area and often we had sections that where beyond 512 units in length that would require multiple instances of this single model, resulting in a decent triangle count in that scene.
So we didn’t remodel it, and we still use it for variety now and then, but we sure did replace it:
The upright concrete slab thats lit up is not part of the model.
That pile is a single model, albeit a little larger (these areas are still WIP) but it’s tons cheaper than the previous model. How cheap? 578 triangles, yes thats right 578. Not only do they cover a wider area, but they are less than half the cost of the previous model mentioned. We can have two of these newer models in place of the older ones; end up having way more detail and still less cost than before. These ended up being so cheap we opened up a huge headroom in the overall budget we had, allowing us to afford more detail overall while still being able to afford sun rays and flashlights in the scene.
We fade out all the window models at certain distances, so that keeps rendering overall fairly cheap. One small cost we’ve been able to reduce is also moving ashes from client-side CPU handled effects to particle system based ones, which in turn brought particle cost way down, but thats a story for another day.
Morale of the story: Don’t use stock content Valve made back in 2003.
Next time we’ll talk about sun rays.