How its done – Bump mapping
In the article about the awesome CG ape, I somewhat explained – in the most basic way – how games and some movies extract detailed information from highly detailed models, and apply it to their “low-res” 3D models (such as a character, a vehicle, etc).
In this article though, I’d like to cover a few aspects of game development as a 3D artist, and what techniques are used to fake the detailed sweetness you see on the screen!
Normal / Bump mapping
What is it?
The terms “bumpmap” and “normalmap” are often used to describe the same thing. They are techinally different in several ways, but I’ll refer to the techniques as “bump-mapping” or “bumpmap” from here on.
A bumpmap is a 2D “texture” that contains information about how the artificial light in a game should react to the surface of a 3D model (or 2D texture). Let’s use 3D models as the example of choice here, and before we dive right into how bumpmapping works, I should talk a bit about how a 3D model is built up.
A 3D model is a collection of triangles
As the title suggest, a 3D model consists of several triangles that make up the entire shape. Each triangle is connected to eachother, and often (to keep it tidy) forms polygons. A polygon is simply two triangles connected to eachother in a way that it forms a rectangle.
Take a look at this image of the Halo character from one of the older games:
This “wireframe” render of the model, does not display the triangulation of the polygons, but only the polygons themselves. You can still see triangles here and there though. The reason for that, is that a polygon has been “collapsed” to use the least amount of polygons/triangles possible to form the entire shape. The more triangles/polygons the model consists of, the more your GPU/CPU has to process to render it.
The image here shows a part of a shape with the un-triangulated polygons on the right side, and the triangulated version on the left. The game engine “sees” the left version when it computes and renders the shape. The artist however, would rather like to work with the triangulation off, so that the scene does not become a mess.
How this is all relevant to bumpmapping
Each of these polygons/triangles has something that is called a “normal”. The normal of a polygon/triangle is the direction the polygon/triangle is facing, relative to itself. This next image illustrates just that.
As the blue arrow shows, the normal of that polygon starts at the middle of it, and follows the absolute direction that the polygon is facing.
This information (about ALL the polygons of a 3D model) is used to calculate how the light is rendered on the model, and where shadows should be cast.
But a bumpmap can manipulate this data, to make the engine “think” that there are several different normals on this particular polygon (or a set of adjacent polygons), making the light render differently on the model.
This is why a game can look as amazing as it does. The character models, the vehicles, the walls, floors, weapons and much more, have their own bumpmap that makes it look like it has more detail on it, than it does.
The technique is not flawless though. The closer you get to it (in-game), and the steeper the angle you see it in, the more you can spot that it is “faked” depth and detail.
This is why it’s important to always have the most silhouette defining shapes on the actual 3D model, and only have details such as buttons, creases, dents, wrinkles and that sort in the bumpmap. The bump map also helps to “round off” rectangular shapes, so that they look really smooth and high-detailed.
This is the red hulk! The left side of the image shows the character model as it would be used in a game. It does not consist of millions of polygons but rather 10-20 000 polygons. This is quite normal for a game-character in any modern gameengine.
The right side shows the “high-poly” (translates to “high number of polygons”) that contains absolutely all of the details you’d want to have in the game. This model probably consists of several million polygons, and would require a insane amount of computing power to render in a game engine. This obviously can’t be done (not today anyways).
So, how do we get the details from the right-hand side model, to the left hand side model? We “bake” a bumpmap from the detailed model!
This bumpmap, will simulate the muscles, blood veins and wrinkles on the left hand side model, by telling the engine that the light should pretend that it is hitting a more bumpy surface than it really is.
This next image displays this. The image shows a goblin 3D character, with and without a bumpmap.
The left model does have a few additional accessories such as the shield, the “belt” and the sword. But other than that, it’s the exact same model.
This is only the bump map applied as well. When the actual diffuse (the texture with the color information, such as skin tone, leather etc) is applied to it as well, it would looke quite nice!
How does this technique help the game?
A game scene on a mobile device that is quite powerful should not consist of much more than 30-40 000 polygons. Now this includes all characters, weapons, environment etc.
On a game optimized for PC, a game scene could consist of anything from 200 000 to 1 000 000 polygons rendered at the same time. 1 000 000 is quite a lot though, and I imagine ~ 100 000 – 600 000 is most common.
So let’s say that the budget of a game scene is 500 000 polygons, and you have the following assets:
- Main character – Uses the most amount of polygons, especially in third-person games : ~ 20 000 polygons
- Companions/Sub-characters – In Call of Duty, you are often accompanied by other team-members that should look quite good : ~ 15 000 polygons x 2 ( We’ll assume that you have 2 team-members )
- Civilans – Let’s say there are 10 random civilians roaming around, each at ~ 10 000 polygons
- Enemies – What is a game without awesome, detailed enemies? In a combat scene, we’ll assume waves of 10 enemies at any given point : ~ 15 000 polygons
- Environmental props – Tables, doors, plants, fences, light fixtures, windows, trees etc – Say each low-priority prop uses anything from ~ 100 – 3000 polygons. Let’s also assume the total of these are accumulated to 20 000 polygons in a highly detailed scene
- Vehicles – Quite often you come over vehicles, like in a parking garage, in the streets, or the one you’re driving. These are often quite detailed, especially if it’s a vehicle that you’re driving ~ 12 – 20 000 polygons x 4 = ~ 60 000 polygons
- Weapons – Everyone has weapons! Often laying around after dead enemies as well. But let’s consider only the weapon that the main character is using in a third-person shooter. These weapons are not as detailed as you’d think, as they are “world-models” and not “view-models”. The difference between the two is apparent in first-person shooters, where the weapon is close up to the camera. In a third-person shooter, you see them at a distance, and they probably won’t be more than 1000 polygons at most, and let’s assume there are 20 of these (1000 * 20). This is all relative though.
- Terrain / Walls etc – Every game engine incorporates the building of terrains and constructual elements differently. Most uses 3D models as the building-blocks however (except for the terrain, which is created in-editor quite often). These are not detailed models, but rather only sets the layout of the environment. Let’s assume 10000 polygons in a indoor/outdoor scene.
Lets summarize: 20 000 + (15 000 * 2) = 50 000 + (10 000 * 10) = 150 000 + (15 000 * 10) = 300 000 + 20 000 + 60 000 + (1000 * 20) + 10000 = 410 000.
This fictional game scene would consist of ~ 410 000 polygons. Here we didn’t even include particle effects, probably muuuch more on environmental props (we used 20 000 polygons). It would probably be closer to 100 000 on details. Imagine a gas station in example. The logo/sign, gas pumps, windows, store-shelves, items, handles, posters, gas canisters, tyres, pump truck, etc etc.
So, we “used” 410 000 polygons out of a budget of 500 000 polygons. The point is: The accumulation of polygons in a game scene must be considered when an artist is creating 3D assets. You’d really love to put in a vast amount of awesome details to your uber-cool bucket and fire hydrant. But consider that it would be used maybe 10 times in the same scene, along with hundreds of other models, that should be reserved that detail to look better.
So the budgeting of polygons needs to be prioritized to the complexity of the object, as well as how it will dominate the scene. A huge carneval should focus on the big carousels, not the sausage stand.
Now, imagine if each of these models didn’t know what a bumpmap was, and would rather use their high-detailed version of the model in the game..
Well, you’re way off budget now.. Main character alone: 1 million or more polygons (depending on complexity and kit). So your computer would have to compute and render about ~ 20 million polygons at least 30 times per second! And that’s just the geometry! You also have the shader effects, lighting effects, particles, explosions, sound, AI, networking (online games), physics calculation (that btw uses a simplified version of the geometry of a model to calculate how everything collides and behaves). In short: Forget it…
So, a bump/normal map tech eliminates a huge load of problems, while still providing a fine level of detail to the environment.
Always use bump mapping?
Some models indeed does not need a normal map. A small model such as a bottle, or a cup don’t need a normal map. It’s so small and insignificant that the overhead of calculating a normal map for the rendering engine, is not worth it. There isn’t much detailed bumps you could add for a bottle/cup anyway.
Bump mapping is only really necessary to make a piece of cloth look like a piece of cloth, or make the buttons and seams in a jacket look realistic, or simply to define a wrinkeled and bumpy surface on something.
The quality of the bump map is also relative to the resolution of the bump-map texture itself. For a important character model, or a large vehicle, this might be as large as 2048×2048 pixels (most common for next-gen games). The higher, the more information must be stored in the video-memory. So one should use as low res as possible, and still get the fine details.
So if you have a wooden crate that needs a little extra detail from a bump map, you should keep it between 256×256 – 512×512 pixels. Depending on the generation of games it’s for. Some game engines can’t handle larger resolutions than 1024 / 2048.
I won’t go into too much detail on the most technical parts, like the compution of the normal map, and how it works mathematically. I trust you understand the principal of this technique.
As you might have noticed, the bump-map does not work alone in a material for a model. There are several techniques that are used to make it look glossy, highlighted, shadowed and colored.
I’ll go over a few of these in articles to come! The next article, we’ll talk about materials and diffuse texture maps!
Thank you for reading, and please comment if you spot anything, or have questions! Regards, Øyvind