Normal and Parallax Mapping Tips and Tricks

0

Introduction

This document is a repository for any useful methods, philosophies, or tricks for creating and working with normal maps and parallax maps (also called offset bump in UE3). It is divided into separate sections for different application, with subjects that transcend applications detailed in General Methods. It’s a rather eclectic document, containing information that ranges from relatively obvious to completely esoteric.

General Methods

Neutral Normal Color

For parts of the normal map that contain no additional detail, the image should be flooded with a color that has 50% red, 50% green, and 100% blue. In RGB values, this corresponds to 127, 127, 255. This is a neutral color for normal maps, which interprets the surface as facing exactly upward in relation to the geometry normal. There should never be black or 50% gray anywhere in a normal map. In regular images these colors have traditionally been used as neutral background, but they have very different effects in a normal map, and will cause terrible lighting problems.

neutralblue2

Optimal Angles

One of the greatest weaknesses of normal maps are their inability to display normals that are at a full 90 degrees from the actual geometry surface, and the closer one gets to a 90 degree angle, the less realistic the representation becomes when the surface is viewed obliquely. Thankfully this can be compensated for somewhat by parallax maps, which will adjust the texture coordinates to further enhance the illusion, but when taken too far this can cause some unsightly distortions and stretching. For this reason it is often best to choose lower angles when creating high poly geometry that is to be made into a normal map. On many mechanical surfaces the most realistic way to represent certain elements (bevels, overlapping plates or boards, etc.) is often at or near 90 degrees, but it is usually best to take artistic license and lower those angles in order to create a better looking normal map, regardless of how unrealistic such an angle might be.

optimalangles

For example, in this image the hexagonal shape has been scaled down to improve the angle of its bevel. The version on the right will look better at extreme viewing angles. Also while the Z-depth is the same on both shapes, the normal maps created from them will make the right one seem to be much deeper, because more space is devoted to the angled surfaces.

A related weakness of normal maps is that as one views them from an increasingly oblique angle, they appear to become flatter and flatter. When the camera approaches the angle of the surface, it becomes quite apparent that the surface does not actually contain any of the detail shown in the normal map. For this reason it is often best to represent major features in real geometry rather than in the normal map. A classic example is the brick wall in the Unreal 3 Engine demo, where most of the bricks are done with the normal map, but a few more prominent ones are modeled in geometry. Another useful technique is to create geometry in such a way that one can seldom get a flat view of most of it. This involves making many concave surfaces, and breaking up large flat surfaces with geometry details that would obscure viewing from a low angle. A good example is placing pillars along a wall to keep the viewer from walking up to that wall and seeing its flatness stretching away into the distance.

Parallax Map Strengths and Weaknesses

Parallax maps can help a great deal to complete the illusion of depth on a surface alongside the normal map, but great care should be taken when using them, because they can often cause distortions and artifacting that are bad enough that it might be worthwhile not to use the parallax map at all. Artifacts are particularly noticeable on certain kinds of surfaces. Hard, sharp lines with large sudden changes in elevation, like floorboards with deep cracks between them, can cause problems. Surfaces with more gentle transitions of elevation work far better. Also, noise and irregularity in the texture can help hide artifacting.

Regardless of whether a parallax map will actually be used, it is often useful to render height data along with normals when projecting from high poly models, because they can be used for other purposes. In particular, height maps can be useful in Photoshop, as described below in the Photoshop section.

Photoshop

Height Data As Selection Source

threshold

Height data, which is usually rendered out for a parallax map, can also be used for extracting selections. The levels on the parallax map can be adjusted and used as a way to select different elevations. A good tool for this is the Threshold Adjustment Layer, which will isolate everything brighter than a certain amount as pure white, and darken everything below it to black. With this one can easily scrub through the elevations of the image. A good example of the use of this technique would be if a beveled surface needed corrosion painted on the base of the bevel, on the part that is the lowest elevation. That section could be easily isolated through a Threshold pull of the height data.

Overlaying Normal Maps

Normal maps can be layered atop each other in Photoshop so that information can be added piecemeal from different sources. Maps can be prepared for this by shifting the levels of the Blue channel down by 50%. In the Blue channel of the Levels dialog change the Output maximum number from 255 to 127. The image can now be used as a Hard Light layer on top of any other normal map, adding in fine details and other information while preserving the curvature of the original map. While this is the most accurate method, it should be noted however that Hard Light is not the only way to combine normal data. An Overlay will achieve a similar result, but will better preserve certain extreme values of the base image to the detriment of the overlaid one. Soft light is another option, which produces a less harsh result. Experimentation will often be necessary to get multiple layers of a normal map to work properly together without interference or unwarranted reinforcement.

Luminance Fidelity

For greater fidelity when converting images into normal maps, there is a version of the Normal Map Filter available on UDN that can process 16 bit per channel images used as elevation maps. RGB images contain a greater range of luminance than 8-bit grayscales, because the total luminance is actually an average of the 3 channels, but both versions of the filter will take that dynamic range into account when processing a 24 bit RGB, so there is no need to convert it to a 16 bit grayscale. For this reason it is often best not to desaturate an image before putting it through the filter, despite the fact that visualization is easier when viewing in grayscale. Temporary desaturation can be achieved through a Hue/Sat adjustment layer which can be easily turned off before using the filter.

High Pass

It can often be beneficial to run a High Pass filter on photo source to extract small scale details while suppressing the larger scale changes in luminance before using the Nvidia Normal Map Filter. Experimentation with the radius setting will be necessary depending on the image.

Intensity Adjustment

The intensity of a normal map can be adjusted in the red and the green in the same ways as one adjusts contrast in a normal image. If the image has been altered for overlaying, this works with the blue channel as well. However with an unaltered normal map the white point of the blue channel should be kept the same, with the levels midpoint being moved instead. The accompanying image shows a curves adjustment that properly increases the intensity of the blue channel.

bluecurves

Transforming Normal Maps

Because of their directional nature, normal maps should not be freely transformed. With a little extra work however, they can be rotated 90, 180, or 270 degrees, or flipped vertically or horizontally. This process involves some alteration of the red and green channels. Depending on the operation, this means possibly switching the two channels, inverting one or both, or all of these things together. Whats important to remember is that in the red channel, the lightest pixels should be the ones whose normals are facing right, while the darkest should be the ones facing left, and in the green channel the lightest should be facing downward, while the darkest should be facing upward.

rotation

So for example, if we rotate a normal map 90 degrees clockwise, now the red channel contains vertical data instead of horizontal, and vice versa with the green. So we can temporarily duplicate the green, copy the red into the green, then copy the temporary duplicated original green into the red. Now the green looks correct, but the normals in the red are facing the incorrect way, with the lighter pixels towards the left rather than the right. To correct this we can invert the red channel.

It is best to automate this process by keeping a collection of Photoshop Actions that automatically switch and invert channels as necessary depending on the operation. With a separate action for Flip Horizontal, Flip Vertical, and Rotate, transforming normal maps can be very easy.

Library of Sources

It can be very useful to keep a library of sources for common normal map elements, like linear and circular bevels, rivets, and various noise patterns. When used in combination with the transformation technique described above, such libraries can save a great deal of time when detailing. It is even possible to save diffuse, specularity, and height data for a parallax map in separate linked layers as well as the normal. In some cases the height data will actually be more versatile than the normal. Firstly, the height data can be converted with the Nvidia filter using different Filter Type values to achieve different normal map results than the original. Also, height data can be used elsewhere, such as for stencil and displacement use in ZBrush. Whenever possible, it is advantageous to keep height data in 16-bit grayscale images if the original images have such fidelity. Even if such detail is unnecessary for its original purpose, an extreme levels pull might be needed for some unexpected future use, and having the extra bit depth of source data will then prove its worth.

3DS Max

Sheet Detailing

A useful method for detailing models, particularly mechanical ones, is to create the high poly geometry laid out over a plane with the texture and UVs of the game model displayed on it, rather than building a true high poly model to project down onto the game model. There are several advantages to this. First, arranging details such as rivets and bevels can often be much easier on a flat unwrapped version of the geometry than having to properly distribute them in 3D. Also it is easier to reuse and alter duplicate elements when they are all laid out together over a 2D plane, rather than having to grab them from elsewhere in the 3D scene and reorient them. Often many things such as bevels could never be reused in 3D anyhow, because they must conform the to the shape of the object. When things are unwrapped to a plane however, this is not a problem. Another reason is that projecting normal maps down to a plane is much cleaner than projecting from a high poly model down to the game model. Often when projecting directly to the game model, unanticipated distortions and artifacts can occur, particularly around curved surfaces and corners. When everything is projected straight down onto the texture sheet this never happens.

sheetmax2


The accompanying image shows an orthographic top view of a sheet, with the UVs laid out in blue on a base plane, and geometry built above it in yellow.

Notice that the details are placed directly above the sheet, with individual geometries separated for the various UV pieces. It is much easier to build it this way piece by piece than to actually cut into a single sheet. Elements dont need to be connected up, or even exist anywhere near each other in elevation, so long as their normals face in the correct direction. Discrepancies in height that carry over to the parallax map can be fixed later in Photoshop.

Of course not all normal map elements should be done on the texture sheet. There are some high poly details that are much easier to create in full 3D, and these certainly should be done so.

One slightly unfortunate side effect of the Sheet Detailing method is that there will be no complete high poly 3D model to showcase for pimp renders. With the advent of normal mapping, an informal tradition has arisen among artists of showing off the high poly model for critique alongside the low poly, long before UV mapping or texturing has taken place. With the Sheet Detailing method, this is not an option. The detailing can only be done after the UV mapping for the game model has been completed, and all that can be showcased is the game model with the resulting normal map applied.

Projecting Lighting

The projection system in Max is used most often for normal and height maps, but it should be remembered that it can handle other projections as well, including Lighting. A Skylight that casts shadows will create global illumination that can be projected down to the game model. The global illumination shadows in small normal map details like cracks, bumps, and bevels help a great deal to make them look realistic.

One less known feature of the Render to Texture system is that it can capture global illumination that is caused by a normal map alone, without any geometry. This will only work when projecting to another object, not through a simple Render to Texture. Note that it will not work with some GI renderers like the new Light Tracer. Be sure to select “no lighting plugin” from the Render>Advanced Lighting tab. The shadow map shown below was extracted by projecting lighting from one flat plane to another, with a normal map on the top plane, illuminated by a Skylight (note that the lighting has been switched to omni simply for the purposes of this screenshot, because a skylight wont display in the viewport).

shadowprojection

This can be particularly useful with normal maps that are made either with ZBrushs 2.5D tools and/or by layering different elements in Photoshop. In such situations, there is no high poly geometry to create the global illumination, but with this method it can be rendered out anyhow.

Library of Sources

High poly model components can be collected in much the same way as image sources. Many mechanical details can be re-used from one model to another, particularly when using the Sheet Detailing method. It is therefore beneficial to maintain a library of high poly model components for reuse and adaptation. By its nature, this collection will most likely mirror in many ways the collection of normal and parallax map images mentioned in the Photoshop section. There are no hard and fast rules for which to use, when there is both the geometry and the maps to choose from, but with the geometry there are two benefits. First, in Max the placement and distribution tools are generally more robust (for example, you can easily distribute rivets along a path with the Spacing Tool), and secondly, placed 3D geometry will incorporate the global illumination from its surroundings, which can be baked to texture. On the other hand, however, pulling from the image library rather than the geometry one would allow for much easier simultaneous work with diffuse, specular, and other maps, which is often a valuable freedom.

ZBrush

A Quick Word About ZBrush

ZBrush is probably the strangest tool that has arisen in the realm of game content creation for a very long time. It simply does not work in a way that is at all congruent with any previous 3D or 2D programs. The boundaries of what can be accomplished with it are still being pushed and explored by artists every day.

Unfortunately, because of the strangeness of its toolset, the workflows that have developed for it, and to some extent its interface, determining what should be considered appropriate for a Tips and Tricks document can be difficult. Indeed, one could make an argument that practically everything in ZBrush could be considered a tip or trick, because everything is peculiar compared with the traditional way of doing things.

For purposes of this document, we will focus on ways of working that are not readily apparent, or not well documented either in the ZBrush help or our own Technical Art Normal Mapping document.

Sheet Detailing

The sheet detailing method described in the 3DS Max section can also be used in ZBrush, both on a polygonal plane, and on the 2.5D canvas. Of course, for many tiled surfaces this is the only way of working at all, but even for texture sheets with explicit UVs from a complex model this can work very well. Certainly mechanical components and other things with clean lines should be done in Max, either with the Sheet Detailing method or the traditional way, but more organic things can be Sheet Detailed in ZBrush when applicable. This should not replace the regular use of ZBrush for working directly on the 3D modelst, but there will be times when it will be useful to create the depth information on the texture sheet rather than the 3D model. There are two ways of doing this in ZBrush, each with strengths and weaknesses.

The first method is to work directly in the 2.5D canvas on the pixols rather than with any polygonal geometry. Simply load up the Photoshop file in ZBrush, and start painting in depth. With this method one has the benefit of being able to use all the 2.5D painting tools, which are in many ways far more robust and versatile than the true 3D tools (and one could argue that they actually contain the 3D tools, since any 3D object can be dropped to the canvas). Also performance when working on a high res 2.5D canvas is substantially better than a high res polygonal model, which can often bring even a powerful machine to its knees. And the 2.5D painting tools might feel more comfortable for texture artists who want to create depth but work better on a 2D plane. This method maintains the paint program paradigm, but gives far more immediate and intuitive feedback than painting grayscales to run through the Nvidia filter in Photoshop. Since the tools work directly upon the pixols, another benefit is the guarantee that the depth information will be as high resolution as the texture needs to be, which is not always the case with a polygonal plane that can only be subdivided so much before it exceeds hardware limitations.

Unfortunately there is a large drawback to Canvas Sheet Detailing as well, which is the fact that ZBrush only allows viewing of the canvas from the orthographic top view. This can make discerning true depth and surface angles a matter of moving the light around and guessing based upon how it interacts with the canvas, an imprecise method at best. This can be checked through capturing the canvas depth with the MRGBZGrabber tool, and using the resulting alpha to displace a subdivided geometry plane, but this is a very cumbersome workaround, and should not be used often. Nonetheless, an artist skilled with the 2.5D canvas painting tools of ZBrush can find Sheet Detailing with them quite useful.

The second method of Sheet Detailing in ZBrush is to work on a polygonal plane, using the 3D tools to alter the geometry. This has the benefit of letting the artist view the sheet from any angle, as well as giving them access to certain 3D-only tools, like the global displace and inflate sliders, the pinch tool, and the power of subdivision levels that allow macro changes without totally destroying the micro detail. However it should be noted that the display of the texture (with UV outlines) is dependent on the UVs of the plane itself, so tools like pinch and nudge could distort the plane laterally, which could be undesirable in this situation. Since a morph target of the original plane must be loaded into the base subdivision level before extracting a displacement map, lateral movement of the geometry is not compensated for properly.

A drawback to this method is that it can require extreme subdivision to reach a mesh resolution that is sufficient for small details on a full texture sheet, in some cases subdivision that is too high for hardware constraints. A good workaround for this is to create individual geometries for separate UV pieces much as one does in 3DS Max, then drop them down to a canvas of the texture. A plane can be trimmed to fit the UVs by masking the excess geometry and hiding it.

Methods For Creating High Frequency Detail

One of the great strengths of ZBrush is its ability to create in actual geometry high frequency detail that would otherwise only be achievable through the far less intuitive and less powerful method of converting images in Photoshop using the Nvidia filter. However painting in those details can often be very difficult. There are a few tools in ZBrush that can make this task far easier. While they are documented in the ZBrush help, their importance is often undervalued.

globaldisplacement

One of these is the ability to use the alpha image to displace the geometry. While it is not particularly useful for large features, it is excellent for high frequency detail. It is usually best to sculpt the form of the surface first, and when that is finished subdivide as high as hardware restrictions will allow, then apply displacement maps for the extreme high frequency detail. While ZBrush can maintain details from the highest subdivision level when alterations are made to lower ones, nevertheless such information is often lost when sculpting in the midrange, so it is best to add the high frequency detail last. Often this step will require several undos and some image alteration of the displacement map within Photoshop.

Another way of using alpha images to apply small scale detail is through the stencil system. This will allow greater control because the displacement is still constrained by brush strokes rather than a global constant, but the consistency can suffer because of this, particularly at the intersections of different stencil placements, so great care should be taken.

Global Deformation

Because most of the global deformation sliders in ZBrush are useless for working on game models, many artists make the mistake of ignoring these features. It should be noted however that there are a few which can be extremely helpful, particularly when used alongside the masking tools. While there are brush tools that correspond to most of the useful global deformation sliders, often is it far easier and more consistent to simply mask out areas that should not have a given deformation, then apply the slider. Offset, Size, Noise, Smooth, and Inflat can be used to great effect in this way. Of particular note is the Inflat slider, which will expand or contract a surface along the normal. This is often useful for further refining a global displacement, as it can create more realistic angles on many displacements, fill out cracks, expand bumps into sharper pebble-like details, and generally make surfaces look less muddy.

inflat

Hard Edges

One of the greatest weaknesses of ZBrush is that its lack of traditional polygonal tools makes creating and maintaining hard edges (and particularly clean, mechanical-seeming edges) very difficult. The digital clay paradigm of ZBrush has the unfortunate side effect of making things look generally very soft and claylike, without offering digital equivalents to the tools that physical sculptors can use to avoid this with real clay. For non-mechanical hard edges (like jagged rock) it is often sufficient to use the Pinch and Nudge tools. However for clean lines the best option is usually to model them precisely in Max before bringing them into ZBrush, keeping different UV Groups to use for creasing. A good rule of thumb for this is to do everything that can reasonably be done in Max before trying to do it in ZBrush. The strengths of ZBrush lay in accomplishing things that simply cannot reasonably be done at all in Max, and should be used as a supplement to those tools, rather than any sort of replacement.

Library of Sources

A collection of grayscale images for use as stencils and displacement maps can be quite valuable. These techniques become far more powerful when an artist has an array of high frequency detail masks to choose from at a moments notice. As mentioned above in the Photoshop section, a library of such images should be maintained for use with the Nvidia filter anyhow, and with ZBrush such a collection can serve double duty. Often height maps from other game assets already made with ZBrush can be used as a starting point for creating useful grayscales as stencils and displacements. For example, different rock and dirt height maps can be combined in Photoshop to create unique noise images which could be used in entirely different contexts. What makes this particularly appealing is that ZBrush outputs to 16-bit grayscale rather than 8-bit, so images constructed this way have far greater fidelity.



No Comment