Hints, tips and tutorials for 3D modelling & content creation
|
KatsBits
Creating 3D models, meshes &
game content
3D modelling & meshing, level editing and textures makingHints, tips and tutorials for 3D modelling & content creation [back]Understanding Oblivion's parallax mapsResourcesContents ^
What in Oblivion's name is going on? ^This is part one of a two part series on Oblivion's parallax mapping. This tutorial runs through the background of what parallax mapping is and how it differs from normal mapping. What we're essentially discussing here are the actual images used for the process, the 'maps', rather than the technical procedure, 'mapping', done by the game engine using clever mathmatics and 'pixel shaders' (special 'programs' used by graphics cards to process data in a particular way). This tutorial won't being using any heavy mathematical explanations, you can find that elsewhere on the InterWeb, and we won't be looking at how you create a parallax map.
What's the difference between 'parallax' and 'normal' maps? ^Aside from the pixel and vertex programs used by the game engine to render textures to screen, generally speaking, nothing. Here's why. A normal or parallax map can be produce in one of two ways; by rendering out a high resolution 3D model to 2D or by converting flat 2D artwork into a normal map by using a 3rd party program or photo editing 'filter'. Both methods of production result in a normal mapped image, similar to the images below, that will 'displace' on screen pixels in such a way as to create the visual illusion of depth in a game. As you can see in the images above, there's no significant difference between a normal map used in Oblivion to one used in Quake 4; both games - Oblivion's parallax mapping and Quake 4's normal mapping (i.e., the actual process or system of rendering, or 'mapping' images to the virtual world) physically use the same type of image, they just use that image in slightly different ways. A parallax map is a normal map from Oblivion's point of view. In effect, you could use a normal map of a brick wall in any game that supports normal maps; the only significant 'feature' that currently matters is the orientation of the RGB channels as they dictate whether the bricks of the wall stick out or recede back. Here comes the (semi) science bit! ^Any given image used in a computer game makes use of a 'red', 'green', 'blue' colour space; in other words, the colour 'palette' used contains the primary 'red', 'green' and 'blue' colours (remember, we're talking about coloured 'light' here and not the pigment found in paint), each of which is represented by a 'channel' or 'layer' that can be inspected on an individual basis in a photo editing application like Photoshop or the GIMP.
The normal map for a Ayleid Ruins
wall texture from Oblivion showing each of the Red, Green
and Blue channels combined ('RGB') and as separate
objects ('R', 'G' and 'B') What you're technically seeing when you do look at each channel like this is an 8 bit colour depth 'layer' that contains 256 tones of just a single colour; 256 tones of either red, green or blue - or to put it another way, how much of each individual colour is being used to produce the overall colour of the original image; combine the channels back together and you get the original image; separate them and you get the RGB colour components.
24 or 32 bit? It goes a step further ^Because each R, G and B channel is 8 bit - which gives a 'colour' or 'tonal' depth of 256 shades per channel - it means an RGB image has, in total, a colour depth of 24 bit; this gives us a standard image used in pretty much every game available. However, it goes one step further; another 8 bit channel called the alpha channel can be added to our 24 bit RGB image to give us what is then a 32 bit RGBA image.
The introduction of another channel, the alpha channel, brings the
image to 32 bit This 'A' or 'alpha' channel tends to be reserved for the use as a 'mask' or 'alpha' channel - typically containing objects that effect the appearance of the base RGB channels by removing parts of the texture or blending them together with other images to create additional effects in game. The alpha channel doesn't directly effect the colour of an image by it's presence; unlike the other channels, you can turn it 'on' or 'off' and the base image will remain unchanged. Why is it important to know about channels? ^Simply for the following reason;
If you imagine the corner of a box, as you look at that corner you'll notice three cardinal 'axis' which gather or terminate at the very tip of the corner itself;
Now depending on how the game engine is set up, one colour will represent one axis of either 'X', 'Y' or 'Z' - 'blue' for instance, might be coded to represent 'height', so the more blue present in the channel the greater the depth / height being represented, interpreted and then rendered to screen ('blue' usually is 'depth / height' by the way).
You may have noticed the alpha channel isn't mentioned here, that's because, as was mentioned above, we're dealing with an image's physical colour depth; alpha channels have nothing to do with describing the actual colour palette of an image, they act purely as 'masks'. How are normal maps used then? ^Although normal maps have 4 channels available for use; Red, Green, Blue (X, Y, Z) and Alpha, most games tend to use just two of them; the Red and Green ('X' and 'Y') channels (the alpha channel acts purely as a mask filter to blend / remove image sections in game). This means the Blue channel ('Z') may not get used (partially or wholly); if we look back to the information above we find that this is the channel that often corresponds to 'depth / height'. So instead of using the blue channel what some games do is make use of a separate grey scale toned image which acts as the 'height' map; it 'replaces' the information that would otherwise be contained and subsequently read from the images blue channel. This height maps is then combined back in game with the normal map using any extra settings that might be added via the interpretation of 'shaders' (extra calculated depth for instance).
This is where the main difference between Oblivion's use of normal maps for parallax mapping and other games use of straight normal maps plus height map for 'bumpmapping' come into play; Oblivion uses the blue channel rather than the combination of a separate images.
To stress the point made in the first paragraph of this tutorial, the main 'thing' to remember here is that normal maps as used for Oblivion's parallax mapping are exactly the same as normal maps used for other games, there's no difference between the two. Blue channel data is relative to the shape of the objects ^Take a look at the two images below, the one on the left shows the blue channel of a wall texture used in Oblivion (textures\dungeons\fortruins\rf1xarchunder_n.tga), the one on the right is the blue channel from a custom texture used in Quake 4; they're approximately the same 'technically', i.e. how the data is arranged relative to the objects they're trying to 'describe' - obviously there are positional differences because each is a channel from completely different texture of completely different objects. What this means for modders wanting to create custom textures is the following; so long as you're producing a standard normal map using whatever tools you have available, you shouldn't need to do anything else to the image. It really is that simple. In fact, unpack the texture assets and go through some of them, you'll find them all to have blue channels that look approximately the same as the images above. Can I edit the blue channel? ^Technically yes, but what you can do is limited in a number of ways, least of which is whether your photo editing software is will allow it; Adobe Elements for example has channels disabled so you can't view them let alone edit them. However, and this is important, if you're editing the channel attempting to paste in a height 'booster' you'll most likely find that not work the way you expected it to. As was mentioned in the section above, the data that's actually contained in the Blue channel is relative to the information of the other two, essentially this means if you edit one, you should really edit the others so that everything is balanced. By dropping in a 'booster' or editing the blue channel in isolation you may very well end up unbalancing the fundamental relationship between all the channels, the resulting image may look and behave incorrectly. What this means is that if you're wanting to edit the normal map you should generally speaking be doing it in normal edit mode (full colour RGB), that way all the channels remain balanced with each other (you can edit in single channel mode but you have to remember to edit the other channels in relation to the changes made). Conclusion ^To sum up some of the things learnt about Oblivion's parallax maps;
This seems like a lot of information to explain something relatively simple, however, it's fundamental information necessary to understand that parallax maps aren't any different to normal maps; they the same in fact, it's just the implementation in game that's different. Once you understand this you can move on to creating your own textures without getting confused over the terminology that's often floating around the Internet in relation to creating custom artwork, not just for Oblivion. |