<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://wiki.polycount.com/w/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.polycount.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Noors</id>
		<title>polycount - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.polycount.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Noors"/>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Special:Contributions/Noors"/>
		<updated>2026-04-15T21:29:31Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.23.2</generator>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-12-15T13:36:15Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Tutorials */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_modo_ohare.jpg|frame|none| When quads are triangulated in [http://www.luxology.com/modo/ Modo], the internal edges are sometimes flipped, which causes shading differences.&amp;lt;br&amp;gt;Image by [http://www.farfarer.com/|James &amp;quot;Talon&amp;quot; O'Hare]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_spec_tychovii.jpg|frame|none| The specular highlight is affected by triangulation. Flip edges to fix skewing. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66651 Skewed Specular Highlight?] for pictures and more info.&amp;lt;br&amp;gt; Image by [http://robertkreps.com Robert &amp;quot;TychoVII&amp;quot; Kreps]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_127seam.jpg|thumb|600px|none| Mirrored normal maps show a seam when (127,127,255) is used for the flat color; 128 is better.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:nrmlmap_blending_methods_Maps.png]]&lt;br /&gt;
|[[image:nrmlmap_blending_methods_RTTNormalMapFX.png]]&lt;br /&gt;
|-&lt;br /&gt;
|The blended normal maps.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|Screenshot of the 3dsmax viewport, using the RTTNormalMap.fx shader.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
&lt;br /&gt;
[[image:normalize_only.jpg|frame|none|The re-normalize option in the NVIDIA filter.&amp;lt;br&amp;gt;Image by [http://hirezstudios.com/ Scott Warren]]]&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[:Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
[[image:nrmlmap_ao.jpg|frame|none| AO can be baked into a normal map, shortening the normals (lower left model).&amp;lt;br&amp;gt;Model by [http://www.3dartisan.net/~kuman/ James Ku]]]&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:tree_front.jpg]]||[[image:tree_back.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Tree simulating subsurface scattering (front view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|Tree simulating subsurface scattering (back view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|[[image:tree_maps.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|The maps used for the leaves. The 2nd diffuse was simply color-inverted, hue-shifted 180°, and saturated.&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[image:nmtest_uv-splits_thumb.jpg|thumb|600px|none|Comparison of map baking methods in Maya and Max, and Ben Cloward's custom FX code.&amp;lt;br&amp;gt;Image by [http://www.bencloward.com/ Ben Cloward] and [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
[[image:normalmapfix_3pointstudios_thumb.jpg|frame|none|3 Point Studios' normal map display fix for 3ds Max.&amp;lt;br&amp;gt;image by [http://www.3pointstudios.com 3 Point Studios]]]&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:max2010_normalmap_workarounds.png|thumb|400px|none|]]&lt;br /&gt;
|[[image:max2010_normalmap_compare.png|thumb|400px|none|]]&lt;br /&gt;
|-&lt;br /&gt;
|Viewport methods in 3ds Max 2010.&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick] &lt;br /&gt;
|More baking methods in 3ds Max 2010.&amp;lt;br&amp;gt; Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
see; [[Normal Map Compression]]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[:Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[:Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
*  [http://www.polycount.com/forum/showthread.php?t=144715 Skewmesh tutorial for Max and Xnormal] by [http://www.exisinteractive.com/ PeterK] to prevent heavy distortions when baking with a cage, without the need to add extra supporting vertices.&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated!&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:TextureTypes]] [[Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-12-15T13:35:52Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Tutorials */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_modo_ohare.jpg|frame|none| When quads are triangulated in [http://www.luxology.com/modo/ Modo], the internal edges are sometimes flipped, which causes shading differences.&amp;lt;br&amp;gt;Image by [http://www.farfarer.com/|James &amp;quot;Talon&amp;quot; O'Hare]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_spec_tychovii.jpg|frame|none| The specular highlight is affected by triangulation. Flip edges to fix skewing. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66651 Skewed Specular Highlight?] for pictures and more info.&amp;lt;br&amp;gt; Image by [http://robertkreps.com Robert &amp;quot;TychoVII&amp;quot; Kreps]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_127seam.jpg|thumb|600px|none| Mirrored normal maps show a seam when (127,127,255) is used for the flat color; 128 is better.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:nrmlmap_blending_methods_Maps.png]]&lt;br /&gt;
|[[image:nrmlmap_blending_methods_RTTNormalMapFX.png]]&lt;br /&gt;
|-&lt;br /&gt;
|The blended normal maps.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|Screenshot of the 3dsmax viewport, using the RTTNormalMap.fx shader.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
&lt;br /&gt;
[[image:normalize_only.jpg|frame|none|The re-normalize option in the NVIDIA filter.&amp;lt;br&amp;gt;Image by [http://hirezstudios.com/ Scott Warren]]]&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[:Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
[[image:nrmlmap_ao.jpg|frame|none| AO can be baked into a normal map, shortening the normals (lower left model).&amp;lt;br&amp;gt;Model by [http://www.3dartisan.net/~kuman/ James Ku]]]&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:tree_front.jpg]]||[[image:tree_back.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Tree simulating subsurface scattering (front view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|Tree simulating subsurface scattering (back view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|[[image:tree_maps.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|The maps used for the leaves. The 2nd diffuse was simply color-inverted, hue-shifted 180°, and saturated.&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[image:nmtest_uv-splits_thumb.jpg|thumb|600px|none|Comparison of map baking methods in Maya and Max, and Ben Cloward's custom FX code.&amp;lt;br&amp;gt;Image by [http://www.bencloward.com/ Ben Cloward] and [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
[[image:normalmapfix_3pointstudios_thumb.jpg|frame|none|3 Point Studios' normal map display fix for 3ds Max.&amp;lt;br&amp;gt;image by [http://www.3pointstudios.com 3 Point Studios]]]&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:max2010_normalmap_workarounds.png|thumb|400px|none|]]&lt;br /&gt;
|[[image:max2010_normalmap_compare.png|thumb|400px|none|]]&lt;br /&gt;
|-&lt;br /&gt;
|Viewport methods in 3ds Max 2010.&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick] &lt;br /&gt;
|More baking methods in 3ds Max 2010.&amp;lt;br&amp;gt; Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
see; [[Normal Map Compression]]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[:Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[:Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
*  [http://www.polycount.com/forum/showthread.php?t=144715 Skewmesh tutorial for Max and Xnormal] by [http://www.exisinteractive.com/ PeterK] to prevent heavy distortions when baking with a cage, without the need to add extra suporting vertices.&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated!&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:TextureTypes]] [[Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-12-15T13:34:07Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Tutorials */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_modo_ohare.jpg|frame|none| When quads are triangulated in [http://www.luxology.com/modo/ Modo], the internal edges are sometimes flipped, which causes shading differences.&amp;lt;br&amp;gt;Image by [http://www.farfarer.com/|James &amp;quot;Talon&amp;quot; O'Hare]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_spec_tychovii.jpg|frame|none| The specular highlight is affected by triangulation. Flip edges to fix skewing. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66651 Skewed Specular Highlight?] for pictures and more info.&amp;lt;br&amp;gt; Image by [http://robertkreps.com Robert &amp;quot;TychoVII&amp;quot; Kreps]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_127seam.jpg|thumb|600px|none| Mirrored normal maps show a seam when (127,127,255) is used for the flat color; 128 is better.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:nrmlmap_blending_methods_Maps.png]]&lt;br /&gt;
|[[image:nrmlmap_blending_methods_RTTNormalMapFX.png]]&lt;br /&gt;
|-&lt;br /&gt;
|The blended normal maps.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|Screenshot of the 3dsmax viewport, using the RTTNormalMap.fx shader.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
&lt;br /&gt;
[[image:normalize_only.jpg|frame|none|The re-normalize option in the NVIDIA filter.&amp;lt;br&amp;gt;Image by [http://hirezstudios.com/ Scott Warren]]]&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[:Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
[[image:nrmlmap_ao.jpg|frame|none| AO can be baked into a normal map, shortening the normals (lower left model).&amp;lt;br&amp;gt;Model by [http://www.3dartisan.net/~kuman/ James Ku]]]&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:tree_front.jpg]]||[[image:tree_back.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Tree simulating subsurface scattering (front view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|Tree simulating subsurface scattering (back view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|[[image:tree_maps.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|The maps used for the leaves. The 2nd diffuse was simply color-inverted, hue-shifted 180°, and saturated.&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[image:nmtest_uv-splits_thumb.jpg|thumb|600px|none|Comparison of map baking methods in Maya and Max, and Ben Cloward's custom FX code.&amp;lt;br&amp;gt;Image by [http://www.bencloward.com/ Ben Cloward] and [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
[[image:normalmapfix_3pointstudios_thumb.jpg|frame|none|3 Point Studios' normal map display fix for 3ds Max.&amp;lt;br&amp;gt;image by [http://www.3pointstudios.com 3 Point Studios]]]&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:max2010_normalmap_workarounds.png|thumb|400px|none|]]&lt;br /&gt;
|[[image:max2010_normalmap_compare.png|thumb|400px|none|]]&lt;br /&gt;
|-&lt;br /&gt;
|Viewport methods in 3ds Max 2010.&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick] &lt;br /&gt;
|More baking methods in 3ds Max 2010.&amp;lt;br&amp;gt; Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
see; [[Normal Map Compression]]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[:Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[:Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
*  [http://www.polycount.com/forum/showthread.php?t=144715 Skewmesh tutorial for Max and Xnormal] by [http://www.exisinteractive.com/ PeterK] to prevent heavy distortions when baking with a cage.&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated!&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:TextureTypes]] [[Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Vertex_color</id>
		<title>Vertex color</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Vertex_color"/>
				<updated>2014-12-02T23:32:46Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: layout&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Vertex color =&lt;br /&gt;
Each vertex in a mesh can optionally store a RGB color value, called vertex color. These can be used for a variety of interesting effects and shader inputs.&lt;br /&gt;
&lt;br /&gt;
Vertex color can be used for [[MultiTexture|multitexturing]], [[Transparency map|transparency]], or [[Ambient Occlusion Map|ambient occlusion]] for example.&lt;br /&gt;
&lt;br /&gt;
= Vertex alpha =&lt;br /&gt;
&lt;br /&gt;
Because vertex alpha is simply a monochrome set of values it can be used for other purposes, like providing transparency, per-vertex sound effects in response to collisions, controlling foliage bend amount for a tree's animated vertex shader, etc.  The alpha channel works similar to the RGB channels otherwise.&lt;br /&gt;
&lt;br /&gt;
Depending on the game engine and mesh format, a single vertex can be assigned multiple vertex alpha values. This duplicates the vertex, once for each alpha value, which allows the alpha to change suddenly from one triangle to the next, creating a hard alpha edge.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
Vertex color is typically multiplied against the Diffuse Color, colorizing/darkening the color map. &lt;br /&gt;
&lt;br /&gt;
Vertex color can also be used for controlling blends between different texture sets, providing per-vertex sound effects in response to collisions, controlling which foliage vertices are affected by a &amp;quot;wind&amp;quot; vertex shader, etc. &lt;br /&gt;
&lt;br /&gt;
When used for non-color effects, typically each color channel is treated as a separate monochrome set of values, so for example RGB vertex color can control three different per-vertex effects.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Multiple Colors per Vertex ==&lt;br /&gt;
A single vertex can be assigned multiple vertex colors, depending on the game engine and mesh format. This duplicates the vertex when it is loaded into the game, once for each color, slightly increasing the memory cost. When vertices along an edge contain two different vertex colors, the color may change suddenly from one triangle to the next, creating a hard color edge instead of the typical blending normally seen across vertices. This is typically done by applying color to a face selection rather than vertices.  In Maya, Vertex Faces allows for applying color in a vertex/face hybrid mode.&lt;br /&gt;
&lt;br /&gt;
== Tutorials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[http://eat3d.com/free/vertex_painting Vertex painting for UDK @ Eat3d]&lt;br /&gt;
|-&lt;br /&gt;
|[[Foliage Vertex Color]] &lt;br /&gt;
|-&lt;br /&gt;
|[[Ambient occlusion vertex color]] &lt;br /&gt;
|-&lt;br /&gt;
|[[Removing Vertex Colors]] &lt;br /&gt;
|-&lt;br /&gt;
|[http://www.polycount.com/forum/showthread.php?t=41232&amp;amp;page=274 Vertex Color Tutorial for 3ds Max] &lt;br /&gt;
|-&lt;br /&gt;
|[http://www.polycount.com/forum/showthread.php?t=80166 Vertex Color Use in Maya Questions] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Texturing]] [[Category:TextureTechnique]] [[Category:Texture Types]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Foliage_Vertex_Color</id>
		<title>Foliage Vertex Color</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Foliage_Vertex_Color"/>
				<updated>2014-12-02T23:30:37Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: edit layout&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Vertex color]] can be used to add fake lighting to flat foliage meshes to create the illusion of a softly-lit foliage volume.&lt;br /&gt;
&lt;br /&gt;
Foliage meshes in game are usually made using flat planes with a [[TransparencyMap|transparent]] texture containing a bunch of leaves (or grass blades). These textures are used instead of modeling each leaf or blade of grass discretely, because the complex geometry renders slowly and also greatly increases the memory cost for the model. &lt;br /&gt;
&lt;br /&gt;
But flat planes generally do not shade very well when lit, so foliage models are often rendered in-game without any lighting (see [[EmissiveMap|Emissive]]). If lighting is an option however, editing the [[VertexNormal|vertex normals]] is one way to get better lighting.&lt;br /&gt;
&lt;br /&gt;
[[image:VertexColor_Tree.gif|frame|none| [[Vertex color]] can be used to add volume to unlit foliage geometry.&amp;lt;br/&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;Image by [http://ericchadwick.com Eric Chadwick] ]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Texturing]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/ModularMountAndBlade</id>
		<title>ModularMountAndBlade</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/ModularMountAndBlade"/>
				<updated>2014-12-02T23:24:54Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: changed table layout&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
= Modular Mount &amp;amp; Blade =&lt;br /&gt;
These tutorials were originally posted by [http://wypierpapier.blogspot.com/ 'gutekfiutek'] on the [http://max3d.pl/forum/showthread.php?p=813527 Polish forum max3d.pl], for a mod of the game Mount &amp;amp; Blade called &amp;quot;Polished Buildings&amp;quot;. Translations from the Polycount thread [http://www.polycount.com/forum/showthread.php?t=76190 Looking for a Polish translator!].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|[[image:Modular_MountBladeMod_01.jpg|center|200px]]&lt;br /&gt;
|[[image:Modular_MountBladeMod_02.jpg|center|200px]]&lt;br /&gt;
|[[image:Modular_MountBladeMod_03.jpg|center|200px]]&lt;br /&gt;
|[[image:Modular_MountBladeMod_04.jpg|center|200px]]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|Texturing tutorials for the Mount &amp;amp; Blade &amp;quot;Polished buildings&amp;quot; mod. Click image for full size.&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;Tutorials by [http://wypierpapier.blogspot.com gutekfiutek]. English translations by [http://level-design.org seir], [http://www.polycount.com/forum/member.php?u=29304 teaandcigarettes], and [http://level-design.org nastrash]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== More Information ==&lt;br /&gt;
* [[ConceptEnvironment]]&lt;br /&gt;
* [[Environment]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:EnvironmentModularity]] [[Category:EnvironmentModeling]] [[Category:EnvironmentTexturing]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Texture_Coordinates</id>
		<title>Texture Coordinates</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Texture_Coordinates"/>
				<updated>2014-12-02T23:22:37Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* UV Tutorials */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Texture coordinates, also called UVs, are pairs of numbers stored in the vertices of a mesh. These numbers are often used to stretch a 2D texture onto a 3D mesh, but they can be used for other things like coloring the mesh (see [[Vertex color]]), controlling the flow across the surface (see [[Flow map]]), etc.&lt;br /&gt;
&lt;br /&gt;
== UV Tutorials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|- style=&amp;quot;vertical-align:top;&amp;quot;&lt;br /&gt;
|[[image:skankerzero_uv_mapping_thoughts_p1of4.png|thumb|none]]&lt;br /&gt;
|[[image:skankerzero_uv_mapping_thoughts_p2of4.png|thumb|none]]&lt;br /&gt;
|[[image:skankerzero_uv_mapping_thoughts_p3of4.png|thumb|none]]&lt;br /&gt;
|[[image:skankerzero_uv_mapping_thoughts_p4of4.png|thumb|none]]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|UV mapping thought process. Images by [http://www.skankerzero.com/ Jesse &amp;quot;skankerzero&amp;quot; Sosa].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[image:uvtut_3dprojectionnetwork.jpg|thumb|left|An automated UV projection network in Maya.&amp;lt;br/&amp;gt;Image by [http://technicalartlead.blogspot.com Paul &amp;quot;prolow&amp;quot; Lohman].]]&lt;br /&gt;
|[[image:CarlosMontero_UVChannel2_3dsmax.jpg|thumb|left|How to edit multiple UV channels in 3ds Max.&amp;lt;br/&amp;gt;Image by [http://carlosmontero.com Carlos &amp;quot;cman2k&amp;quot; Montero].]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=1367536 UV Unwrapping Best Practice Factors &amp;amp; Priorities] Polycount Forum thread.&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=134749 3DS Max - UVing complex objects] Polycount Forum thread, UVs for complex cylindrical-shaped meshes.&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=133646 Best techniques for packing UV’s] Polycount Forum thread.&lt;br /&gt;
* [http://cg.tutsplus.com/sessions/an-introduction-to-uvmapping-in-3d-studio-max/ An Introduction To UVMapping In 3d Studio Max] by Ben Tate.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=70378 UV Theory] Polycount forum thread, how to plan good UVs.&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=80947 As it turns out, we all suck at unwrapping?] Polycount forum thread.&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/182-step-step-techniques-tiling-textures-3ds-max.html Step-by-Step Techniques for Tiling Textures in 3ds Max] - by Chris Holden, how to make [[TextureAtlas|texture atlases]].&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=82546 Organic rock UV seams] Polycount forum thread, how to create good UVs for spheroids.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=69961 Unwrapping a sphere] Polycount forum thread, good methods for UVing spheres. For sphere modeling tips see [[SphereTopology]].&lt;br /&gt;
* [[FirstPersonWeaponUV|First-Person Weapon UVs]] by [http://www.linkedin.com/in/earthquake Joe 'EarthQuake' Wilson], good weapon UVs.&lt;br /&gt;
* [http://www.cgsharpe.com/?p=55 Maya / Mudbox: Street Cop Workflow] by [http://www.fx81.com/ Mashru Mishu], good character UVs. &lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=69286 uv + turbosmooth= big problem] Polycount forum thread, how to prevent 3ds Max subdivision from distorting UVs. A similar thread: [http://boards.polycount.net/showthread.php?t=72686 Best way to approach unwrapping UVWs with Meshsmooth?].&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=80898 What's an 8-sided tiled texture ?] Polycount forum thread, how to edit textures so you can rotate and mirror them on adjacent polygons without seams.&lt;br /&gt;
* [[Light map#Light_Map_Texture_Coordinates]]&lt;br /&gt;
* [[TextureAtlas]]&lt;br /&gt;
&lt;br /&gt;
== UV Tools ==&lt;br /&gt;
=== 3ds Max ===&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=69736 TexTools]&lt;br /&gt;
* [http://www.polytools3d.com/polyunwrapper/index.html PolyUnwrapper]&lt;br /&gt;
* [http://www.scriptspot.com/3ds-max/scripts/texture-atlas-generator Texture Atlas Generator]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=71073 turboTools]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=52415 Normalize UVs Maxscipt]&lt;br /&gt;
* [http://www.luxinia.de/index.php/ArtTools/3dsmax LCSM Unwrap]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=72045 3ds Max Bridge to Headus UV Layout]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=71230 3ds Max Bridge to Roadkill]&lt;br /&gt;
* [http://users.skynet.be/arketip/arketip_morphMapENG.htm morphMap]&lt;br /&gt;
&lt;br /&gt;
=== Headus ===&lt;br /&gt;
* [https://www.uvlayout.com/ UVLayout]&lt;br /&gt;
&lt;br /&gt;
=== Maya ===&lt;br /&gt;
* [http://www.headus.com/phpbb/viewtopic.php?t=394 Maya Bridge to Headus UV Layout]&lt;br /&gt;
* [http://www.creativecrash.com/maya/downloads/scripts-plugins/texturing/c/ Texturing Scripts on CreativeCrash.com]&lt;br /&gt;
* [http://www.castorlee.com/maya-tools/auto-uv-mapper Castor Lee's Auto UV Mapper]&lt;br /&gt;
&lt;br /&gt;
=== Softimage / XSI ===&lt;br /&gt;
* [http://www.sshadows2005.narod.ru/main/programming/softimage/headusuvlayout.htm Softimage Bridge to Headus UV Layout]&lt;br /&gt;
* [http://www.creativecrash.com/xsi/downloads/scripts-plugins/texturing/c/ Texturing Scripts on CreativeCrash.com]&lt;br /&gt;
* [http://sculptwork.com/rr/bak/kim/roadkill.zip Softimage Bridge to Roadkill]&lt;br /&gt;
&lt;br /&gt;
== UV Map Grids ==&lt;br /&gt;
The grid is a texture to use while unwrapping a mesh. Sometimes called a custom UV map template, a UV checker, or a test grid. &lt;br /&gt;
&lt;br /&gt;
Good things to have in a UV map grid:&lt;br /&gt;
* A large checker grid to see large distortions.&lt;br /&gt;
* A fine per-pixel grid to see small distortions.&lt;br /&gt;
* Circles help with solving distortion, as it's easier for the human eye to see when a circle is distorted than a square. &lt;br /&gt;
* Unique colors across the map, to see where the UV is tiling. &lt;br /&gt;
* Letters and/or numbers to see when the UV is reversed. &lt;br /&gt;
* Letters and/or numbers to see where a mesh feature is located in UV space.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| [[File:uvrefmap_blackwhite.jpg|thumb]]&lt;br /&gt;
| [[File:uvrefmap_blender.jpg|thumb]]&lt;br /&gt;
| [[File:uvrefmap_checker_green.gif|thumb]]&lt;br /&gt;
| [[File:uvrefmap_checker_util-mark.jpg|thumb]]&lt;br /&gt;
|-&lt;br /&gt;
| [[File:uvrefmap_checkeredmap.jpg|thumb]]&lt;br /&gt;
| [[File:uvrefmap_circles.jpg|thumb]]&lt;br /&gt;
| [[File:uvrefmap_circles_letters.jpg|thumb]]&lt;br /&gt;
| [[File:uvrefmap_circles_noise.jpg|thumb]]&lt;br /&gt;
|-&lt;br /&gt;
| [[File:uvrefmap_circlesgreen_noise.jpg|thumb]]&lt;br /&gt;
| [[File:uvrefmap_circlessquares.jpg|thumb]]&lt;br /&gt;
| [[File:uvrefmap_grid_large.jpg|thumb]]&lt;br /&gt;
| [[File:uvrefmap_grid_small.jpg|thumb]]&lt;br /&gt;
|-&lt;br /&gt;
| [[File:uvrefmap_HarlequiN_grid.jpg|thumb]]&lt;br /&gt;
| [[File:uvrefmap_nvidia_greengrid.jpg|thumb]]&lt;br /&gt;
| [[File:uvrefmap_util-mark1.jpg|thumb]]&lt;br /&gt;
|  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:EnvironmentTexturing]] [[Category:CharacterTexturing]] [[Category:PropsTexturing]] [[Category:TextureTechnique]] [[Category:Glossary]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/VertexNormal</id>
		<title>VertexNormal</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/VertexNormal"/>
				<updated>2014-12-02T23:14:51Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: changed table style&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Game artists can manually alter the vertex normals to change the way an in-game mesh is lit, how it renders a reflection, how the fresnel falloff looks, etc. Basically any lighting effect that uses vertex normals can be tweaked by changing the model's vertex normals.&lt;br /&gt;
&lt;br /&gt;
Some game engines do not import edited vertex normals. For example UDK has been updated to support [http://udn.epicgames.com/Three/ContentBlog.html#Explicit%20Normal%20Support custom vertex normals via FBX], but your game engine may not support it.&lt;br /&gt;
&lt;br /&gt;
== What Is a Vertex Normal? ==&lt;br /&gt;
See the MSDN article [http://msdn.microsoft.com/en-us/library/bb324491%28VS.85%29.aspx Face and Vertex Normal Vectors].&lt;br /&gt;
&lt;br /&gt;
== Model Seams ==&lt;br /&gt;
Game models are often cut apart into different segments, for example to allow a player to customize their character by swapping out different clothing models. &lt;br /&gt;
&lt;br /&gt;
When a contiguous mesh is cut apart, the vertex normals along the edge usually change. Vertex normals are usually calculated automatically by the modeling software, to average out the local surface curvature. However this causes a shading seam along the cut, because the two models now have different vertex normals along their shared edge. &lt;br /&gt;
&lt;br /&gt;
To help hide this artifact, the seams between the pieces are usually cut along natural seams, like the belt line, shoulders, neck, wrists. This doesn't hide all of the seams though. &lt;br /&gt;
&lt;br /&gt;
Bent vertex normals can be used to hide these seams completely, by manually averaging the two models' edges together. &lt;br /&gt;
&lt;br /&gt;
== Foliage Shading ==&lt;br /&gt;
Foliage meshes in game are usually made using flat planes with a [[Opacity Map|transparent]] texture containing a bunch of leaves (or grass blades). These textures are used instead of modeling each leaf or blade of grass discretely, because they would slow the framerate too much. Also the increased vertex count uses much more memory.&lt;br /&gt;
&lt;br /&gt;
Flat planes generally do not shade very well when lit. To counteract this, the vertex normals can be bent to influence the shading, helping to hide the flatness of the geometry.&lt;br /&gt;
&lt;br /&gt;
Create the backfacing polygons manually, before editing the vertex normals. If you let a game engine create backfaces automatically, the engine has to generate new polygons so it has to figure out where the new normals will point, resetting them all in the process. If you want to import edited vertex normals, you must explicitly create the backfaces yourself.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:TreeMakerScript_plus_NormalThiefScript.gif]]&lt;br /&gt;
|-&lt;br /&gt;
|Foliage shading is improved by bending the vertex normals.&amp;lt;br/&amp;gt; The [[file:TreeMakerScript_plus_NormalThiefScript_Max2010.zip|model in Max 2010 format]] (textures copyright SpeedTree).&amp;lt;br/&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:Tree_Normals.gif]]&lt;br /&gt;
|-&lt;br /&gt;
|A comparison of different flat geometry types, with and without bent normals.&amp;lt;br/&amp;gt;Top row uses &amp;quot;crossing planes&amp;quot;, bottom row uses &amp;quot;tri planes&amp;quot;.&amp;lt;br/&amp;gt;Left to right: wireframe, default normals, &amp;quot;global&amp;quot; normals using [[#Normal_Thief|Normal Thief]], and clump-based normals.&amp;lt;br/&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:tree_shading_examples.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Foliage shading examples compared, with and without [[VertexColor]].&amp;lt;br/&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* [http://wypierpapier.blogspot.com/2010/02/vertex-normal-tutorial.html Vertex Normal tutorial] by [http://wypierpapier.blogspot.com/ 'gutekfiutek']. This is a blog post in Polish that explains in pictures how vertex normals can be used for better foliage shading ([http://translate.googleusercontent.com/translate_c?hl=en&amp;amp;ie=UTF-8&amp;amp;sl=pl&amp;amp;tl=en&amp;amp;u=http://wypierpapier.blogspot.com/2010/02/vertex-normal-tutorial.html&amp;amp;prev=_t&amp;amp;rurl=translate.google.com&amp;amp;twu=1&amp;amp;usg=ALkJrhiAwMTQRdRZ8uQcN3n4w1XypaFsVQ translation by Google here]). He used this technique to great effect in his [http://wypierpapier.blogspot.com/2010/03/polished-landscapes-m-mod.html Polished Landscapes Mod] for Mount &amp;amp; Blade.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: This technique only works in a game engine that supports edited vertex normals. You have to test your asset pipeline to see.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Editing Normals in 3ds Max ==&lt;br /&gt;
Vertex normals can be manually bent in 3ds Max by using the Edit Normals modifier. See the [http://docs.autodesk.com/3DSMAX/13/ENU/Autodesk%203ds%20Max%202011%20Help/files/WSf742dab04106313366400bf6112a1cea097-7f65.htm 3ds Max 2011 online help].&lt;br /&gt;
&lt;br /&gt;
Edited vertex normals are somewhat fragile in 3ds Max, they can be lost easily:&lt;br /&gt;
* If you take an Editable Mesh model, activate Attach, and try to attach an Editable Poly to it, the vertex normals of the Poly model will be reset. However using Attach in an Editable Poly model will work fine.&lt;br /&gt;
* If you Attach multiple meshes together, make sure each has at least one edited normal. Meshes without edited normals will have their vertex normals jumbled.&lt;br /&gt;
* If you Attach models that have been rotated, make sure to use Reset Xforms on them first. Attaching a rotated model to another will skew all its edited normals.&lt;br /&gt;
* If you use Detach to make a new object, the detached object's vertex normals will be reset. &lt;br /&gt;
* If you use Detach to create a new element in the same object, the detached element's vertex normals will be reset.&lt;br /&gt;
&lt;br /&gt;
Vertex normals can also be modified by using ''Smoothing Groups'', as long as the normals have not been edited by the Edit Normals modifier beforehand. See the tutorial [[../3DTutorials/Smoothing Groups in 3DSMax|Smoothing Groups in 3ds Max]] by [[poopinmymouth|Ben 'poopinmymouth' Mathis]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Slide Normal Thief MAXScript ===&lt;br /&gt;
[http://slidelondon.com/_downloads/SlideNormalThief/SlideTools-SlideNormalThief.rar SlideNormalThief] by the studio [http://slidelondon.com/ Slide London] is a 3ds Max MAXScript tool that projects vertex normals from one model to another, automating what would otherwise be a tedious manual process. &lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:SlideNormalThief_UI.png]]&lt;br /&gt;
|-&lt;br /&gt;
|Interface for the SlideNormalThief MAXScript. Script by [http://slidelondon.com/ Slide London].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The script is based on a much-slower script called [http://www.scriptspot.com/3ds-max/scripts/normal-thief NormalThief.ms] written by [http://br.linkedin.com/pub/mauricio-b-gehling/1b/9b6/5b6 Mauricio B. Gehling].&lt;br /&gt;
&lt;br /&gt;
The ''Reference Object'' is the model you wish to copy vertex normals from, and the ''Target Object'' is the model that will get its normals bent to match. The two models should be superimposed on one another, the normals on the Target will be bent to match the nearest normals on the Reference. This is similar to the way [[NormalMap]] projection works, the copying is based off location in 3D space. The vertex counts of the two models don't need to match, but both models need to have an Edit Normals modifier applied. &lt;br /&gt;
&lt;br /&gt;
=== AverageNormal MAXScript ===&lt;br /&gt;
[[file:AverageNormal.mcr.zip|AverageNormal]] by [http://mathieujacquin.free.fr/ Mathieu 'zOffTy' Jacquin] is a 3ds Max MAXScript tool that averages all the vertex normals for the selected faces, so they all point the same direction. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== GetVertNormalsFromFace MAXScript ===&lt;br /&gt;
[[file:GetVertNormalsFromFace_0_2.ms.zip|GetVertNormalsFromFace]] by [http://www.illusioncatalyst.com/ Enrico 'SyncViewS' Gullotti] is a 3ds Max MAXScript tool that aligns all the vertex normals for the selected faces so they point perpendicular to their polygons. In other words, the same direction as the face normal would be facing. This is similar to the [[#mig_Normal_Tools|mig Normal Tools]] option &amp;quot;Fillet Outside&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Once installed the script will be under the category ''Normal Tools'', named ''Get Vert Normals from Faces''. It works on Editable Poly objects only, and that must be the active modifier in the modifier stack. If an Edit Normals Modifier is not present, the script will add one right above Editable Poly. It should not mess with Smoothing Groups at all. &lt;br /&gt;
&lt;br /&gt;
Go into Face sub-object level, make a face selection and run the script. Every time a normal is modified by the script, it is made Explicit to retain the modifications. At the end the script will switch back to the base Editable Poly modifier and re-enter Face sub-object level (even if other modifiers are present in the stack). If you want to revert back to the original default normals, add an Edit Normals Modifier and reset the normals. &lt;br /&gt;
&lt;br /&gt;
See the Polycount forum thread [http://www.polycount.com/forum/showthread.php?t=75753 Editing vertex normals in Max, got scripts?].&lt;br /&gt;
&lt;br /&gt;
=== Exporting Edited Normals ===&lt;br /&gt;
Edited vertex normals can be exported from 3ds Max with some file formats:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|  '''File Format''' &lt;br /&gt;
|  '''Supports Edited Normals?''' &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;class=&amp;quot;red none&amp;quot;&amp;gt;| 3DS &lt;br /&gt;
|  no &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;class=&amp;quot;green none&amp;quot;&amp;gt;| ASE &lt;br /&gt;
|  yes &lt;br /&gt;
|-&lt;br /&gt;
|  CGF (CryEngine) &lt;br /&gt;
|  ? &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;class=&amp;quot;red none&amp;quot;&amp;gt;| Collada &lt;br /&gt;
|  no &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;class=&amp;quot;green none&amp;quot;&amp;gt;| FBX &lt;br /&gt;
|  yes &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;class=&amp;quot;green none&amp;quot;&amp;gt;| OBJ &lt;br /&gt;
|  yes &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;class=&amp;quot;red none&amp;quot;&amp;gt;| PSK (Unreal Engine) &lt;br /&gt;
|  no &lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;class=&amp;quot;red none&amp;quot;&amp;gt;| WRL (VRML) &lt;br /&gt;
|  no &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Editing Normals in Maya ==&lt;br /&gt;
Vertex normals can be adjusted in Maya by using the [http://download.autodesk.com/us/maya/2011help/files/Editing_polygons_Edit_the_vertex_normals_to_affect_polygon_shading.htm Normals tools in the Polygons menu] (Maya 2011 online help). &lt;br /&gt;
&lt;br /&gt;
Vertex normals can also be baked from one model to another by using [http://download.autodesk.com/us/maya/2011help/files/Mesh__Transfer_Attributes.htm Transfer Attributes].&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:maya_transferattributes.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;quot;Transfer Attributes&amp;quot; in Maya can be used to copy vertex normals from a dome to a tree.&amp;lt;br/&amp;gt;Select the dome, then the tree, then choose Mesh &amp;gt; Transfer Attributes, and enable only Vertex Normals.&amp;lt;br/&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=48876 'callebo'].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== mig Normal Tools ===&lt;br /&gt;
The [http://migugi.net/mel/normalTools/ mig Normal Tools] is a collection of MEL scripts for editing vertex normals in Maya. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:migNormalToolsUI.png]]&lt;br /&gt;
|-&lt;br /&gt;
|Interface for the mig Normals Tools MEL scripts. Scripts by [http://migugi.net/ Migugi].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== FaceNRMtoVert ===&lt;br /&gt;
[http://www.polycount.com/forum/member.php?u=38320 &amp;quot;passerby&amp;quot;] wrote a melscript that does a similar function as the [[#SetNormals_MAXScript|GetVertNormalsFromFace]] maxscript. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;#!highlight csharp&lt;br /&gt;
global proc FaceNRMtoVert() {&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    string $Fs[] = `filterExpand -sm 34`;&lt;br /&gt;
    select -cl;&lt;br /&gt;
    for ($F in $Fs) {&lt;br /&gt;
        select -r $F;&lt;br /&gt;
        string $normals[] = `polyInfo -faceNormals`;&lt;br /&gt;
        string $buffer[];&lt;br /&gt;
        tokenize $normals[0] $buffer;&lt;br /&gt;
        &lt;br /&gt;
        float $plane[3];&lt;br /&gt;
        $plane[0] = $buffer[2];&lt;br /&gt;
        $plane[1] = $buffer[3];&lt;br /&gt;
        $plane[2] = $buffer[4];  &lt;br /&gt;
        PolySelectConvert 3;&lt;br /&gt;
        polyNormalPerVertex -xyz $plane[0] $plane[1] $plane[2];&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For more info see the Polycount forum thread [http://www.polycount.com/forum/showthread.php?p=1584696#post1584696 GetVertNormalsFromFace script for maya].&lt;br /&gt;
&lt;br /&gt;
== Editing Normals in Modo ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:chai_bentnormals.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Baking normals in modo, using the [http://forums.luxology.com/topic.aspx?f=37&amp;amp;t=41509 pipelineIO plugin].&amp;lt;br/&amp;gt; Image by [http://www.svartberg.com/ Ariel Chai].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Normal Mapping ==&lt;br /&gt;
Vertex normals have a strong influence on tangent-space [[NormalMap|normal maps]]. Some game engines require a bit more geometry near areas that have a lot of change in angle (hard corners, etc.) otherwise the vertex normals [http://boards.polycount.net/showthread.php?t=68173 fight with the normal map] and create shading errors. Careful [[Topology|topology]] can minimize or avoid these errors altogether.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:CharacterModeling]] [[Category:EnvironmentModeling]] [[Category:TextureTechnique]] [[Category:EnvironmentFoliage]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Self_shadowed_bump_map</id>
		<title>Self shadowed bump map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Self_shadowed_bump_map"/>
				<updated>2014-12-02T17:27:02Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Self-Shadowed Bump Map =&lt;br /&gt;
This is a Normal Map variant that contains directional ambient occlusion information in the map, used in Valve's Source engine for self-shadowed bump mapping. See Valve's white paper [http://www.valvesoftware.com/publications/2007/SIGGRAPH2007_EfficientSelfShadowedRadiosityNormalMapping.pdf Efficient Self-Shadowed Radiosity Normal Mapping].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[http://ssbump-generator.yolasite.com/ SSbump Generator] is a tool for generating Self-Shadowed Bump Maps from existing height maps or normal maps.&lt;br /&gt;
&amp;lt;br&amp;gt;[http://www.xnormal.net/ XNormal] when properly configured can generate SSBump textures from a highpoly source, as explained [http://www.facepunch.com/showthread.php?t=529746 in this Facepunch thread].&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Texturing]] [[Category:TextureTypes]] [[Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Foliage_Vertex_Color</id>
		<title>Foliage Vertex Color</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Foliage_Vertex_Color"/>
				<updated>2014-12-02T17:16:39Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Vertex color]] can be used to add fake lighting to flat foliage meshes to create the illusion of a softly-lit foliage volume.&lt;br /&gt;
&lt;br /&gt;
Foliage meshes in game are usually made using flat planes with a [[TransparencyMap|transparent]] texture containing a bunch of leaves (or grass blades). These textures are used instead of modeling each leaf or blade of grass discretely, because the complex geometry renders slowly and also greatly increases the memory cost for the model. &lt;br /&gt;
&lt;br /&gt;
But flat planes generally do not shade very well when lit, so foliage models are often rendered in-game without any lighting (see [[EmissiveMap|Emissive]]). If lighting is an option however, editing the [[VertexNormal|vertex normals]] is one way to get better lighting.&lt;br /&gt;
&lt;br /&gt;
[[image:VertexColor_Tree.gif|frame|none| [[Vertex color]] can be used to add volume to unlit foliage geometry.&amp;lt;br/&amp;gt;Image by [http://ericchadwick.com Eric Chadwick] ]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Texturing]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Displacement_map</id>
		<title>Displacement map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Displacement_map"/>
				<updated>2014-12-02T17:14:54Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Displacement Map */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Displacement Map =&lt;br /&gt;
A grayscale texture that stores height information, projected onto a highly-tesselated mesh in order to create displaced surface detail. Also called a [[Height map|Height Map]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:displacement_zbrush_beta.jpg|frame|none| Displacement map example from ZBrush]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Displacement maps are usually saved in a floating-point file format like 16- or 32-bit TIFF/TGA/EXR, because standard 8-bit grayscale images only have 256 levels of gray which often causes height information to be lost.&lt;br /&gt;
&lt;br /&gt;
* [http://www.zbrushcentral.com/showthread.php?t=20310 Rendering ZBrush Displacement-Maps In External Renderers] thread on ZBrushCentral&amp;lt;BR/&amp;gt;Displacement rendering methods in multiple applications.&lt;br /&gt;
* See also [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Texturing]] [[Category:Texture_Types]] [[Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Texturing</id>
		<title>Texturing</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Texturing"/>
				<updated>2014-12-02T14:22:06Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Texture Techniques */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
Texturing refers to the act of producing 2d images for use with 3d models. Commonly referred to as &amp;quot;maps&amp;quot; or &amp;quot;skins&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Texture Techniques ==&lt;br /&gt;
Textures work in conjunction with [[Material|Materials]] and [[Shaders]] to produce the final rendering. The game model needs [[Texture Coordinates]] to wrap the texture onto the model. Multiple [[Texture Types]] are often used to control different parameters or channels of the shader, such as [[Normal map]] or [[Specular color map]]. A variety of techniques and [[Tools]] are used to make textures: painted by hand in a traditional 2d package, painted in 3d directly on models, created parametrically, or [[Normal_map#Baking|baking]] image data from one model to another.&lt;br /&gt;
&lt;br /&gt;
Artists need to make choices about the formatting of their textures, usually during the planning stage before creating the model/texture. Here is some technical information on 2d images.&lt;br /&gt;
&lt;br /&gt;
=== Texture Types ===&lt;br /&gt;
Depending on the engine and visual style, different types of maps are used for different effects. [[Vertex color]] is optionally used to control additional effects, such as blending between two images in the same model. Images are made up of [[Pixel]]s and are split up into Red, Green and Blue components, also known as channels, and may additionally have an Alpha channel which can be used to store [[Transparency_map|opacity]] or another type of map or mask. Masks are images or layers used to control &amp;quot;How much of What&amp;quot;, such as [[Specular color map]]s or [[Specular gloss map]]s, and are typically (but not always) greyscale (pixels only utilizing one channel).&lt;br /&gt;
&lt;br /&gt;
For the average prop, arrangements of map types might use Diffuse/Specular/Normal for a current-gen game. [[PBR|Physical Based Rendering]] setup might be Albedo/Microsurface/Reflectivity/Normal for a next-gen shader.&lt;br /&gt;
&lt;br /&gt;
Other surfaces need more specialized shaders and textures, such as Skin or water.&lt;br /&gt;
&lt;br /&gt;
For an expanded list, see [[Texture types]].&lt;br /&gt;
&lt;br /&gt;
=== Texture Size ===&lt;br /&gt;
The dimensions of the image, how the model is [[Texture Coordinates|unwrapped]], the scale of the model and scene scale all equate to the resolution of the textured model when seen in-game. It is important that all objects in the scene have similar texture scaling to keep the overall look consistent; a low-resolution image looks jarring when placed next to a high-resolution one. Texture size is the first place to start for this decision, determining [[Texel|texel]], the ratio between UV space/Texture resolution/Scene and object scale when uv unwrapping the model is the second.&lt;br /&gt;
&lt;br /&gt;
Images store pixels in two dimensions, and can be square or rectangular. Most engines require dimensions to be in powers of two: 2,4,8,16,3164,128,256,512,1024,2048,4096. Other engines may not require it, but an off-sized image can potentially harm performance.&lt;br /&gt;
&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=134911 How often are 4096 textures used in next-gen gaming] on the Polycount Forum&lt;br /&gt;
&lt;br /&gt;
=== Texture Channels ===&lt;br /&gt;
Channels are the color components in the image. Red, Green and Blue (RGB) are each stored as data in separate indices and some software can display each as a greyscale image. An additional channel named Alpha can also be present, but not always rendered into the composite. Some formats store other channel types, such as HSL (Hue, Saturation, Luminance), CYMK (Cyan, Yellow, Magenta, Chroma/Black), or simply luminance or alpha.&lt;br /&gt;
&lt;br /&gt;
=== Bit Depth ===&lt;br /&gt;
[[BitDepth|Bit depth]] is how much data is allotted to each pixel either in memory or in the file. More bits per pixel (bpp) increases the number of colors available for each channel. The 1 bit type has two colors, black and white (or off and on), and is often used for transparent alpha testing - a simple sorting for whether or not a pixel is visible. 8 bits gives 256 colors per channel (16.7 million RGB colors), and is often the default mode for most applications. However, higher bpp means increased file size and memory use. It's not uncommon for a format to store colors unequally: 5 bits red, 6 bits green, 5 bits blue, for an example of a total 16 bit storage. Compression is another method to decrease the file size.&lt;br /&gt;
&lt;br /&gt;
=== Texture Compression ===&lt;br /&gt;
&lt;br /&gt;
== Texture Tiling ==&lt;br /&gt;
See [[Tiling]].&lt;br /&gt;
&lt;br /&gt;
=== Texture Photography ===&lt;br /&gt;
* [http://renderhjs.net/shoebox/ ShoeBox: Mask Image] - by ''[http://renderhjs.net Hendrik-Jan &amp;quot;renderhjs&amp;quot; Schoenmaker]'' &lt;br /&gt;
* [http://udn.epicgames.com/Three/TakingBetterPhotosForTextures.html Taking Better Photos for Textures] - by ''[http://www.mutantspoon.com/ Jordan Walker]'' &lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=65262 Better Sharpening in Photoshop] - by ''[http://poopinmymouth.com Ben &amp;quot;poopinmymouth&amp;quot; Mathis]'' &lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorials Texture Photography &amp;amp; Processing Tutorials]&lt;br /&gt;
&lt;br /&gt;
== More Information ==&lt;br /&gt;
* [[CharacterSculpting]] and [[EnvironmentSculpting]] have information on 3D sculpting.&lt;br /&gt;
* [[:Category:Concept]] has drawing and painting fundamentals. &lt;br /&gt;
* [[TexturingTutorials]] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Discipline]] [[Category:Texturing]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Texture_Coordinates</id>
		<title>Texture Coordinates</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Texture_Coordinates"/>
				<updated>2014-12-02T14:20:44Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: changed table style&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Texture coordinates, also called UVs, are pairs of numbers stored in the vertices of a mesh. These numbers are often used to stretch a 2D texture onto a 3D mesh, but they can be used for other things like coloring the mesh (see [[Vertex color]]), controlling the flow across the surface (see [[Flow map]]), etc.&lt;br /&gt;
&lt;br /&gt;
== UV Tutorials ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:skankerzero_uv_mapping_thoughts_p1of4.png|thumb|none]]&lt;br /&gt;
|[[image:skankerzero_uv_mapping_thoughts_p2of4.png|thumb|none]]&lt;br /&gt;
|[[image:skankerzero_uv_mapping_thoughts_p3of4.png|thumb|none]]&lt;br /&gt;
|[[image:skankerzero_uv_mapping_thoughts_p4of4.png|thumb|none]]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|UV mapping thought process. Images by [http://www.skankerzero.com/ Jesse &amp;quot;skankerzero&amp;quot; Sosa].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|[[image:uvtut_3dprojectionnetwork.jpg|thumb|left|An automated UV projection network in Maya.&amp;lt;br/&amp;gt;Image by [http://technicalartlead.blogspot.com Paul &amp;quot;prolow&amp;quot; Lohman].]]&lt;br /&gt;
|[[image:CarlosMontero_UVChannel2_3dsmax.jpg|thumb|left|How to edit multiple UV channels in 3ds Max.&amp;lt;br/&amp;gt;Image by [http://carlosmontero.com Carlos &amp;quot;cman2k&amp;quot; Montero].]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=1367536 UV Unwrapping Best Practice Factors &amp;amp; Priorities] Polycount Forum thread.&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=134749 3DS Max - UVing complex objects] Polycount Forum thread, UVs for complex cylindrical-shaped meshes.&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=133646 Best techniques for packing UV’s] Polycount Forum thread.&lt;br /&gt;
* [http://cg.tutsplus.com/sessions/an-introduction-to-uvmapping-in-3d-studio-max/ An Introduction To UVMapping In 3d Studio Max] by Ben Tate.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=70378 UV Theory] Polycount forum thread, how to plan good UVs.&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=80947 As it turns out, we all suck at unwrapping?] Polycount forum thread.&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/182-step-step-techniques-tiling-textures-3ds-max.html Step-by-Step Techniques for Tiling Textures in 3ds Max] - by Chris Holden, how to make [[TextureAtlas|texture atlases]].&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=82546 Organic rock UV seams] Polycount forum thread, how to create good UVs for spheroids.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=69961 Unwrapping a sphere] Polycount forum thread, good methods for UVing spheres. For sphere modeling tips see [[SphereTopology]].&lt;br /&gt;
* [[FirstPersonWeaponUV|First-Person Weapon UVs]] by [http://www.linkedin.com/in/earthquake Joe 'EarthQuake' Wilson], good weapon UVs.&lt;br /&gt;
* [http://www.cgsharpe.com/?p=55 Maya / Mudbox: Street Cop Workflow] by [http://www.fx81.com/ Mashru Mishu], good character UVs. &lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=69286 uv + turbosmooth= big problem] Polycount forum thread, how to prevent 3ds Max subdivision from distorting UVs. A similar thread: [http://boards.polycount.net/showthread.php?t=72686 Best way to approach unwrapping UVWs with Meshsmooth?].&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=80898 What's an 8-sided tiled texture ?] Polycount forum thread, how to edit textures so you can rotate and mirror them on adjacent polygons without seams.&lt;br /&gt;
* [[Light map#Light_Map_Texture_Coordinates]]&lt;br /&gt;
* [[TextureAtlas]]&lt;br /&gt;
&lt;br /&gt;
== UV Tools ==&lt;br /&gt;
=== 3ds Max ===&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=69736 TexTools]&lt;br /&gt;
* [http://www.polytools3d.com/polyunwrapper/index.html PolyUnwrapper]&lt;br /&gt;
* [http://www.scriptspot.com/3ds-max/scripts/texture-atlas-generator Texture Atlas Generator]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=71073 turboTools]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=52415 Normalize UVs Maxscipt]&lt;br /&gt;
* [http://www.luxinia.de/index.php/ArtTools/3dsmax LCSM Unwrap]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=72045 3ds Max Bridge to Headus UV Layout]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=71230 3ds Max Bridge to Roadkill]&lt;br /&gt;
* [http://users.skynet.be/arketip/arketip_morphMapENG.htm morphMap]&lt;br /&gt;
&lt;br /&gt;
=== Headus ===&lt;br /&gt;
* [https://www.uvlayout.com/ UVLayout]&lt;br /&gt;
&lt;br /&gt;
=== Maya ===&lt;br /&gt;
* [http://www.headus.com/phpbb/viewtopic.php?t=394 Maya Bridge to Headus UV Layout]&lt;br /&gt;
* [http://www.creativecrash.com/maya/downloads/scripts-plugins/texturing/c/ Texturing Scripts on CreativeCrash.com]&lt;br /&gt;
* [http://www.castorlee.com/maya-tools/auto-uv-mapper Castor Lee's Auto UV Mapper]&lt;br /&gt;
&lt;br /&gt;
=== Softimage / XSI ===&lt;br /&gt;
* [http://www.sshadows2005.narod.ru/main/programming/softimage/headusuvlayout.htm Softimage Bridge to Headus UV Layout]&lt;br /&gt;
* [http://www.creativecrash.com/xsi/downloads/scripts-plugins/texturing/c/ Texturing Scripts on CreativeCrash.com]&lt;br /&gt;
* [http://sculptwork.com/rr/bak/kim/roadkill.zip Softimage Bridge to Roadkill]&lt;br /&gt;
&lt;br /&gt;
== UV Map Grids ==&lt;br /&gt;
The grid is a texture to use while unwrapping a mesh. Sometimes called a custom UV map template, a UV checker, or a test grid. &lt;br /&gt;
&lt;br /&gt;
Good things to have in a UV map grid:&lt;br /&gt;
* A large checker grid to see large distortions.&lt;br /&gt;
* A fine per-pixel grid to see small distortions.&lt;br /&gt;
* Circles help with solving distortion, as it's easier for the human eye to see when a circle is distorted than a square. &lt;br /&gt;
* Unique colors across the map, to see where the UV is tiling. &lt;br /&gt;
* Letters and/or numbers to see when the UV is reversed. &lt;br /&gt;
* Letters and/or numbers to see where a mesh feature is located in UV space.&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
| [[File:uvrefmap_blackwhite.jpg|thumb]]&lt;br /&gt;
| [[File:uvrefmap_blender.jpg|thumb]]&lt;br /&gt;
| [[File:uvrefmap_checker_green.gif|thumb]]&lt;br /&gt;
| [[File:uvrefmap_checker_util-mark.jpg|thumb]]&lt;br /&gt;
|-&lt;br /&gt;
| [[File:uvrefmap_checkeredmap.jpg|thumb]]&lt;br /&gt;
| [[File:uvrefmap_circles.jpg|thumb]]&lt;br /&gt;
| [[File:uvrefmap_circles_letters.jpg|thumb]]&lt;br /&gt;
| [[File:uvrefmap_circles_noise.jpg|thumb]]&lt;br /&gt;
|-&lt;br /&gt;
| [[File:uvrefmap_circlesgreen_noise.jpg|thumb]]&lt;br /&gt;
| [[File:uvrefmap_circlessquares.jpg|thumb]]&lt;br /&gt;
| [[File:uvrefmap_grid_large.jpg|thumb]]&lt;br /&gt;
| [[File:uvrefmap_grid_small.jpg|thumb]]&lt;br /&gt;
|-&lt;br /&gt;
| [[File:uvrefmap_HarlequiN_grid.jpg|thumb]]&lt;br /&gt;
| [[File:uvrefmap_nvidia_greengrid.jpg|thumb]]&lt;br /&gt;
| [[File:uvrefmap_util-mark1.jpg|thumb]]&lt;br /&gt;
|  &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:EnvironmentTexturing]] [[Category:CharacterTexturing]] [[Category:PropsTexturing]] [[Category:TextureTechnique]] [[Category:Glossary]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Parallax_Map</id>
		<title>Parallax Map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Parallax_Map"/>
				<updated>2014-12-01T13:01:23Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* How To Create */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Parallax Map =&lt;br /&gt;
Parallax mapping is a technique for real-time approximation of displacement mapping, sometimes called &amp;quot;virtual displacement mapping.&amp;quot; Each pixel's texture coordinates are adjusted at render-time to create an illusion of depth as the viewer's eye moves across a scene.&lt;br /&gt;
&lt;br /&gt;
The virtue of parallax mapping is efficiency. It is the cheapest real-time technique for displacement mapping. The drawback is image quality. Parallax mapping doesn't look as nice as more expensive techniques such as &amp;quot;parallax occlusion mapping&amp;quot; and &amp;quot;relief mapping&amp;quot;, see [[#Methods|Methods]] below. Those techniques are similar to parallax mapping, but provide better image quality at a cost of additional texture lookups.&lt;br /&gt;
&lt;br /&gt;
Parallax mapping uses a grayscale heightmap. Exactly where it goes will depend on your specific game engine, but it's pretty common to put it in the alpha channel of the normal map. Check the documentation for your engine to make sure.&lt;br /&gt;
&lt;br /&gt;
See the Polycount thread [http://www.polycount.com/forum/showthread.php?t=53229 The ultimate be-all end-all Parallax mapping thread]. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Methods&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
There are more than a half-dozen versions of parallax mapping:&lt;br /&gt;
&lt;br /&gt;
* Offset, and offset with limiting (both are your basic parallax)&lt;br /&gt;
* Parallax occlusion&lt;br /&gt;
* Relief&lt;br /&gt;
* Cone step&lt;br /&gt;
* Steep parallax&lt;br /&gt;
* Pyramidal displacement&lt;br /&gt;
* Iterative parallax&lt;br /&gt;
* etc.&lt;br /&gt;
&lt;br /&gt;
All except offset and iterative use more advanced rendering calls, only now becoming feasible on current-gen hardware.&lt;br /&gt;
&lt;br /&gt;
If anyone is looking for a good rendering cost/visual effect tradeoff, look at iterative parallax, it is probably your best bet. Newer versions of parallax occlusion and cone mapping provide the best visual fidelity. And for the cheapest, parallax mapping is a couple extra instructions and a texture channel, almost negligible nowadays.&lt;br /&gt;
&lt;br /&gt;
The [[#UsageExamples|staircases in Mass Effect]] probably have a specific parallax shader written for them; a generic parallax mapping solution would probably not give as believable an effect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;#!wiki dotted&lt;br /&gt;
[[http://www.brunoevangelista.com/projects/|Detailed Surfaces Viewer]] by Bruno Evangelista is a demo application that shows multiple methods:&lt;br /&gt;
&lt;br /&gt;
 1. Displacement Mapping&lt;br /&gt;
 1. Normal Mapping&lt;br /&gt;
 1. Offset Parallax Mapping&lt;br /&gt;
 1. Relief Mapping&lt;br /&gt;
 1. Parallax Occlusion Mapping&lt;br /&gt;
 1. Cone Step Mapping&lt;br /&gt;
 1. Multi-Layer Cone Step Mapping&lt;br /&gt;
 1. Sphere Tracing (Per-Pixel Displacement Mapping with Distance Functions)&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Uses&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Uses ==&lt;br /&gt;
As a rule, parallax mapping looks good on walls and floors. Any mesh with a relatively large surface viewed from non-oblique angles could be a decent candidate for parallax mapping. Parallax works well for smooth curves, like rocks and carvings. It's not good for steep edges, because of the distortion.&lt;br /&gt;
&lt;br /&gt;
In your heightmap, try to avoid sharp/steep edges and tall high-frequency details. Those can cause texture-stretching and rendering artifacts.&lt;br /&gt;
&lt;br /&gt;
Use sparingly on any surface that is not relatively large. Be especially careful where the edges of a mesh are visible. Parallax mapping doesn't extend past the visible edges of a mesh. That can look weird. You may want to augment your parallax map with actual geometry at visible edges. (eg. bricks on the corner of a building might use actual geometry while the other bricks can be created by parallax mapping.)&lt;br /&gt;
&lt;br /&gt;
Mass Effect uses parallax in an interesting way, to create stairs as a parallax indentation on what is basically just a flat plane.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:masseffect_20070301_screen005.jpg|thumb|400px|none]]&lt;br /&gt;
|[[image:oblivion_parallax_06B.jpg|thumb|400px|none]]&lt;br /&gt;
|-&lt;br /&gt;
|A parallax-mapped staircase in Mass Effect.&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;Image by [http://www.bioware.com/ BioWare]&amp;lt;/span&amp;gt;&lt;br /&gt;
|Parallax-mapped walls in The Elder Scrolls IV: Oblivion.&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;Image by [http://www.bethsoft.com/ Bethesda Softworks]&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[[image:crysis_parallax_occlusion_mapping.jpg|thumb|400px|none]]&lt;br /&gt;
|[[image:steep-parallax_stalker.jpg|thumb|400px|none]]&lt;br /&gt;
|-&lt;br /&gt;
|Parallax occlusion mapping in Crysis&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;Image by [http://www.crytek.com/ Crytek]&amp;lt;/span&amp;gt; &lt;br /&gt;
|Steep parallax mapping in S.T.A.L.K.E.R.&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;Image by [http://www.gsc-game.com/GSC Game World]&amp;lt;/span&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How To Create ==&lt;br /&gt;
=== CrazyBump ===&lt;br /&gt;
Using [http://www.crazybump.com CrazyBump] to generate a parallax map from a normal map:&lt;br /&gt;
&lt;br /&gt;
# If necessary, grab the CrazyBump demo from www.crazybump.com&lt;br /&gt;
# Make sure that CrazyBump's axis orientation preferences are set correctly for your normal map.&lt;br /&gt;
# Open your normal map in CrazyBump.&lt;br /&gt;
# Make sure that &amp;quot;parallax displacement&amp;quot; is turned on in CrazyBump's preview window.&lt;br /&gt;
# Select the &amp;quot;displacement&amp;quot; tab from CrazyBump's user interface.&lt;br /&gt;
# Adjust the &amp;quot;displacement map&amp;quot; sliders until your model has the desired appearance.&lt;br /&gt;
# If you notice shimmering artifacts, try increasing the &amp;quot;soften&amp;quot; slider.&lt;br /&gt;
# You're all done! Save the displacement map, and use it for parallax in your game engine.&lt;br /&gt;
# If your engine expects height in the alpha channel of the normal map, CrazyBump has a toggle for that on the preferences page. Just turn on the setting, open your normal map, and re-save it.&lt;br /&gt;
&lt;br /&gt;
CrazyBump can also generate a parallax map from a photograph.&lt;br /&gt;
&lt;br /&gt;
=== 3ds Max ===&lt;br /&gt;
Use 3ds Max ''Render To Texture'' to bake from high-poly geometry.&lt;br /&gt;
&lt;br /&gt;
# Setup the projection for the low-poly model as usual.&lt;br /&gt;
# In the NormalsMap element in the render to texture dialog activate the checkbox &amp;quot;render height map to alpha channel&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Shader FX ===&lt;br /&gt;
[http://www.lumonix.net/shaderfx.html Shader FX] supports relief mapping [http://www.lumonix.net/Media/ShaderFX_ReliefMappingDemo.html real-time in the 3ds Max viewport].&lt;br /&gt;
&lt;br /&gt;
=== Unreal Development Kit ===&lt;br /&gt;
[http://aaronjclifford.com/images/tutorials/prallaxBakingDemonstration.jpg Parallax Baking Demonstration]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Texturing]] [[Category:TextureTypes]] [[Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Parallax_Map</id>
		<title>Parallax Map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Parallax_Map"/>
				<updated>2014-12-01T13:00:01Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Uses */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Parallax Map =&lt;br /&gt;
Parallax mapping is a technique for real-time approximation of displacement mapping, sometimes called &amp;quot;virtual displacement mapping.&amp;quot; Each pixel's texture coordinates are adjusted at render-time to create an illusion of depth as the viewer's eye moves across a scene.&lt;br /&gt;
&lt;br /&gt;
The virtue of parallax mapping is efficiency. It is the cheapest real-time technique for displacement mapping. The drawback is image quality. Parallax mapping doesn't look as nice as more expensive techniques such as &amp;quot;parallax occlusion mapping&amp;quot; and &amp;quot;relief mapping&amp;quot;, see [[#Methods|Methods]] below. Those techniques are similar to parallax mapping, but provide better image quality at a cost of additional texture lookups.&lt;br /&gt;
&lt;br /&gt;
Parallax mapping uses a grayscale heightmap. Exactly where it goes will depend on your specific game engine, but it's pretty common to put it in the alpha channel of the normal map. Check the documentation for your engine to make sure.&lt;br /&gt;
&lt;br /&gt;
See the Polycount thread [http://www.polycount.com/forum/showthread.php?t=53229 The ultimate be-all end-all Parallax mapping thread]. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Methods&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
There are more than a half-dozen versions of parallax mapping:&lt;br /&gt;
&lt;br /&gt;
* Offset, and offset with limiting (both are your basic parallax)&lt;br /&gt;
* Parallax occlusion&lt;br /&gt;
* Relief&lt;br /&gt;
* Cone step&lt;br /&gt;
* Steep parallax&lt;br /&gt;
* Pyramidal displacement&lt;br /&gt;
* Iterative parallax&lt;br /&gt;
* etc.&lt;br /&gt;
&lt;br /&gt;
All except offset and iterative use more advanced rendering calls, only now becoming feasible on current-gen hardware.&lt;br /&gt;
&lt;br /&gt;
If anyone is looking for a good rendering cost/visual effect tradeoff, look at iterative parallax, it is probably your best bet. Newer versions of parallax occlusion and cone mapping provide the best visual fidelity. And for the cheapest, parallax mapping is a couple extra instructions and a texture channel, almost negligible nowadays.&lt;br /&gt;
&lt;br /&gt;
The [[#UsageExamples|staircases in Mass Effect]] probably have a specific parallax shader written for them; a generic parallax mapping solution would probably not give as believable an effect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;#!wiki dotted&lt;br /&gt;
[[http://www.brunoevangelista.com/projects/|Detailed Surfaces Viewer]] by Bruno Evangelista is a demo application that shows multiple methods:&lt;br /&gt;
&lt;br /&gt;
 1. Displacement Mapping&lt;br /&gt;
 1. Normal Mapping&lt;br /&gt;
 1. Offset Parallax Mapping&lt;br /&gt;
 1. Relief Mapping&lt;br /&gt;
 1. Parallax Occlusion Mapping&lt;br /&gt;
 1. Cone Step Mapping&lt;br /&gt;
 1. Multi-Layer Cone Step Mapping&lt;br /&gt;
 1. Sphere Tracing (Per-Pixel Displacement Mapping with Distance Functions)&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Uses&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Uses ==&lt;br /&gt;
As a rule, parallax mapping looks good on walls and floors. Any mesh with a relatively large surface viewed from non-oblique angles could be a decent candidate for parallax mapping. Parallax works well for smooth curves, like rocks and carvings. It's not good for steep edges, because of the distortion.&lt;br /&gt;
&lt;br /&gt;
In your heightmap, try to avoid sharp/steep edges and tall high-frequency details. Those can cause texture-stretching and rendering artifacts.&lt;br /&gt;
&lt;br /&gt;
Use sparingly on any surface that is not relatively large. Be especially careful where the edges of a mesh are visible. Parallax mapping doesn't extend past the visible edges of a mesh. That can look weird. You may want to augment your parallax map with actual geometry at visible edges. (eg. bricks on the corner of a building might use actual geometry while the other bricks can be created by parallax mapping.)&lt;br /&gt;
&lt;br /&gt;
Mass Effect uses parallax in an interesting way, to create stairs as a parallax indentation on what is basically just a flat plane.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:masseffect_20070301_screen005.jpg|thumb|400px|none]]&lt;br /&gt;
|[[image:oblivion_parallax_06B.jpg|thumb|400px|none]]&lt;br /&gt;
|-&lt;br /&gt;
|A parallax-mapped staircase in Mass Effect.&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;Image by [http://www.bioware.com/ BioWare]&amp;lt;/span&amp;gt;&lt;br /&gt;
|Parallax-mapped walls in The Elder Scrolls IV: Oblivion.&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;Image by [http://www.bethsoft.com/ Bethesda Softworks]&amp;lt;/span&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|[[image:crysis_parallax_occlusion_mapping.jpg|thumb|400px|none]]&lt;br /&gt;
|[[image:steep-parallax_stalker.jpg|thumb|400px|none]]&lt;br /&gt;
|-&lt;br /&gt;
|Parallax occlusion mapping in Crysis&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;Image by [http://www.crytek.com/ Crytek]&amp;lt;/span&amp;gt; &lt;br /&gt;
|Steep parallax mapping in S.T.A.L.K.E.R.&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;Image by [http://www.gsc-game.com/GSC Game World]&amp;lt;/span&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How To Create ==&lt;br /&gt;
=== [[CrazyBump]] ===&lt;br /&gt;
Using [http://www.crazybump.com CrazyBump] to generate a parallax map from a normal map:&lt;br /&gt;
&lt;br /&gt;
# If necessary, grab the CrazyBump demo from www.crazybump.com&lt;br /&gt;
# Make sure that CrazyBump's axis orientation preferences are set correctly for your normal map.&lt;br /&gt;
# Open your normal map in CrazyBump.&lt;br /&gt;
# Make sure that &amp;quot;parallax displacement&amp;quot; is turned on in CrazyBump's preview window.&lt;br /&gt;
# Select the &amp;quot;displacement&amp;quot; tab from CrazyBump's user interface.&lt;br /&gt;
# Adjust the &amp;quot;displacement map&amp;quot; sliders until your model has the desired appearance.&lt;br /&gt;
# If you notice shimmering artifacts, try increasing the &amp;quot;soften&amp;quot; slider.&lt;br /&gt;
# You're all done! Save the displacement map, and use it for parallax in your game engine.&lt;br /&gt;
# If your engine expects height in the alpha channel of the normal map, CrazyBump has a toggle for that on the preferences page. Just turn on the setting, open your normal map, and re-save it.&lt;br /&gt;
&lt;br /&gt;
CrazyBump can also generate a parallax map from a photograph.&lt;br /&gt;
&lt;br /&gt;
=== 3ds Max ===&lt;br /&gt;
Use 3ds Max ''Render To Texture'' to bake from high-poly geometry.&lt;br /&gt;
&lt;br /&gt;
# Setup the projection for the low-poly model as usual.&lt;br /&gt;
# In the NormalsMap element in the render to texture dialog activate the checkbox &amp;quot;render height map to alpha channel&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Shader FX ===&lt;br /&gt;
[http://www.lumonix.net/shaderfx.html Shader FX] supports relief mapping [http://www.lumonix.net/Media/ShaderFX_ReliefMappingDemo.html real-time in the 3ds Max viewport].&lt;br /&gt;
&lt;br /&gt;
=== Unreal Development Kit ===&lt;br /&gt;
[http://aaronjclifford.com/images/tutorials/prallaxBakingDemonstration.jpg Parallax Baking Demonstration]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Texturing]] [[Category:TextureTypes]] [[Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-12-01T12:49:46Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* 3ds Max Shaders */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_modo_ohare.jpg|frame|none| When quads are triangulated in [http://www.luxology.com/modo/ Modo], the internal edges are sometimes flipped, which causes shading differences.&amp;lt;br&amp;gt;Image by [http://www.farfarer.com/|James &amp;quot;Talon&amp;quot; O'Hare]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_spec_tychovii.jpg|frame|none| The specular highlight is affected by triangulation. Flip edges to fix skewing. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66651 Skewed Specular Highlight?] for pictures and more info.&amp;lt;br&amp;gt; Image by [http://robertkreps.com Robert &amp;quot;TychoVII&amp;quot; Kreps]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_127seam.jpg|thumb|600px|none| Mirrored normal maps show a seam when (127,127,255) is used for the flat color; 128 is better.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:nrmlmap_blending_methods_Maps.png]]&lt;br /&gt;
|[[image:nrmlmap_blending_methods_RTTNormalMapFX.png]]&lt;br /&gt;
|-&lt;br /&gt;
|The blended normal maps.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|Screenshot of the 3dsmax viewport, using the RTTNormalMap.fx shader.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
&lt;br /&gt;
[[image:normalize_only.jpg|frame|none|The re-normalize option in the NVIDIA filter.&amp;lt;br&amp;gt;Image by [http://hirezstudios.com/ Scott Warren]]]&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[:Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
[[image:nrmlmap_ao.jpg|frame|none| AO can be baked into a normal map, shortening the normals (lower left model).&amp;lt;br&amp;gt;Model by [http://www.3dartisan.net/~kuman/ James Ku]]]&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:tree_front.jpg]]||[[image:tree_back.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Tree simulating subsurface scattering (front view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|Tree simulating subsurface scattering (back view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|[[image:tree_maps.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|The maps used for the leaves. The 2nd diffuse was simply color-inverted, hue-shifted 180°, and saturated.&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[image:nmtest_uv-splits_thumb.jpg|thumb|600px|none|Comparison of map baking methods in Maya and Max, and Ben Cloward's custom FX code.&amp;lt;br&amp;gt;Image by [http://www.bencloward.com/ Ben Cloward] and [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
[[image:normalmapfix_3pointstudios_thumb.jpg|frame|none|3 Point Studios' normal map display fix for 3ds Max.&amp;lt;br&amp;gt;image by [http://www.3pointstudios.com 3 Point Studios]]]&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:max2010_normalmap_workarounds.png|thumb|400px|none|]]&lt;br /&gt;
|[[image:max2010_normalmap_compare.png|thumb|400px|none|]]&lt;br /&gt;
|-&lt;br /&gt;
|Viewport methods in 3ds Max 2010.&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick] &lt;br /&gt;
|More baking methods in 3ds Max 2010.&amp;lt;br&amp;gt; Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
see; [[Normal Map Compression]]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[:Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[:Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated!&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:TextureTypes]] [[Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Parallax_Map</id>
		<title>Parallax Map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Parallax_Map"/>
				<updated>2014-11-30T13:31:37Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Uses */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Parallax Map =&lt;br /&gt;
Parallax mapping is a technique for real-time approximation of displacement mapping, sometimes called &amp;quot;virtual displacement mapping.&amp;quot; Each pixel's texture coordinates are adjusted at render-time to create an illusion of depth as the viewer's eye moves across a scene.&lt;br /&gt;
&lt;br /&gt;
The virtue of parallax mapping is efficiency. It is the cheapest real-time technique for displacement mapping. The drawback is image quality. Parallax mapping doesn't look as nice as more expensive techniques such as &amp;quot;parallax occlusion mapping&amp;quot; and &amp;quot;relief mapping&amp;quot;, see [[#Methods|Methods]] below. Those techniques are similar to parallax mapping, but provide better image quality at a cost of additional texture lookups.&lt;br /&gt;
&lt;br /&gt;
Parallax mapping uses a grayscale heightmap. Exactly where it goes will depend on your specific game engine, but it's pretty common to put it in the alpha channel of the normal map. Check the documentation for your engine to make sure.&lt;br /&gt;
&lt;br /&gt;
See the Polycount thread [http://www.polycount.com/forum/showthread.php?t=53229 The ultimate be-all end-all Parallax mapping thread]. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Methods&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Methods ==&lt;br /&gt;
There are more than a half-dozen versions of parallax mapping:&lt;br /&gt;
&lt;br /&gt;
* Offset, and offset with limiting (both are your basic parallax)&lt;br /&gt;
* Parallax occlusion&lt;br /&gt;
* Relief&lt;br /&gt;
* Cone step&lt;br /&gt;
* Steep parallax&lt;br /&gt;
* Pyramidal displacement&lt;br /&gt;
* Iterative parallax&lt;br /&gt;
* etc.&lt;br /&gt;
&lt;br /&gt;
All except offset and iterative use more advanced rendering calls, only now becoming feasible on current-gen hardware.&lt;br /&gt;
&lt;br /&gt;
If anyone is looking for a good rendering cost/visual effect tradeoff, look at iterative parallax, it is probably your best bet. Newer versions of parallax occlusion and cone mapping provide the best visual fidelity. And for the cheapest, parallax mapping is a couple extra instructions and a texture channel, almost negligible nowadays.&lt;br /&gt;
&lt;br /&gt;
The [[#UsageExamples|staircases in Mass Effect]] probably have a specific parallax shader written for them; a generic parallax mapping solution would probably not give as believable an effect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;#!wiki dotted&lt;br /&gt;
[[http://www.brunoevangelista.com/projects/|Detailed Surfaces Viewer]] by Bruno Evangelista is a demo application that shows multiple methods:&lt;br /&gt;
&lt;br /&gt;
 1. Displacement Mapping&lt;br /&gt;
 1. Normal Mapping&lt;br /&gt;
 1. Offset Parallax Mapping&lt;br /&gt;
 1. Relief Mapping&lt;br /&gt;
 1. Parallax Occlusion Mapping&lt;br /&gt;
 1. Cone Step Mapping&lt;br /&gt;
 1. Multi-Layer Cone Step Mapping&lt;br /&gt;
 1. Sphere Tracing (Per-Pixel Displacement Mapping with Distance Functions)&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Uses&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Uses ==&lt;br /&gt;
As a rule, parallax mapping looks good on walls and floors. Any mesh with a relatively large surface viewed from non-oblique angles could be a decent candidate for parallax mapping. Parallax works well for smooth curves, like rocks and carvings. It's not good for steep edges, because of the distortion.&lt;br /&gt;
&lt;br /&gt;
In your heightmap, try to avoid sharp/steep edges and tall high-frequency details. Those can cause texture-stretching and rendering artifacts.&lt;br /&gt;
&lt;br /&gt;
Use sparingly on any surface that is not relatively large. Be especially careful where the edges of a mesh are visible. Parallax mapping doesn't extend past the visible edges of a mesh. That can look weird. You may want to augment your parallax map with actual geometry at visible edges. (eg. bricks on the corner of a building might use actual geometry while the other bricks can be created by parallax mapping.)&lt;br /&gt;
&lt;br /&gt;
Mass Effect uses parallax in an interesting way, to create stairs as a parallax indentation on what is basically just a flat plane.&lt;br /&gt;
&lt;br /&gt;
{| class &amp;quot;wikitable&amp;quot;&lt;br /&gt;
| [[image:masseffect_20070301_screen005.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
| A parallax-mapped staircase in Mass Effect.&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;Image by [http://www.bioware.com/ BioWare]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class &amp;quot;wikitable&amp;quot;&lt;br /&gt;
| [[attachment:crysis_parallax_occlusion_mapping.jpg|Media:ParallaxMap/attachments/crysis_parallax_occlusion_mapping.jpg|attachment:crysis_parallax_occlusion_mapping.jpg|width=&amp;quot;600&amp;quot;}}&lt;br /&gt;
|-&lt;br /&gt;
| Parallax occlusion mapping in Crysis&amp;lt;br&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;Image by [http://www.crytek.com/ Crytek]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== How To Create ==&lt;br /&gt;
=== [[CrazyBump]] ===&lt;br /&gt;
Using [http://www.crazybump.com CrazyBump] to generate a parallax map from a normal map:&lt;br /&gt;
&lt;br /&gt;
# If necessary, grab the CrazyBump demo from www.crazybump.com&lt;br /&gt;
# Make sure that CrazyBump's axis orientation preferences are set correctly for your normal map.&lt;br /&gt;
# Open your normal map in CrazyBump.&lt;br /&gt;
# Make sure that &amp;quot;parallax displacement&amp;quot; is turned on in CrazyBump's preview window.&lt;br /&gt;
# Select the &amp;quot;displacement&amp;quot; tab from CrazyBump's user interface.&lt;br /&gt;
# Adjust the &amp;quot;displacement map&amp;quot; sliders until your model has the desired appearance.&lt;br /&gt;
# If you notice shimmering artifacts, try increasing the &amp;quot;soften&amp;quot; slider.&lt;br /&gt;
# You're all done! Save the displacement map, and use it for parallax in your game engine.&lt;br /&gt;
# If your engine expects height in the alpha channel of the normal map, CrazyBump has a toggle for that on the preferences page. Just turn on the setting, open your normal map, and re-save it.&lt;br /&gt;
&lt;br /&gt;
CrazyBump can also generate a parallax map from a photograph.&lt;br /&gt;
&lt;br /&gt;
=== 3ds Max ===&lt;br /&gt;
Use 3ds Max ''Render To Texture'' to bake from high-poly geometry.&lt;br /&gt;
&lt;br /&gt;
# Setup the projection for the low-poly model as usual.&lt;br /&gt;
# In the NormalsMap element in the render to texture dialog activate the checkbox &amp;quot;render height map to alpha channel&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== Shader FX ===&lt;br /&gt;
[http://www.lumonix.net/shaderfx.html Shader FX] supports relief mapping [http://www.lumonix.net/Media/ShaderFX_ReliefMappingDemo.html real-time in the 3ds Max viewport].&lt;br /&gt;
&lt;br /&gt;
=== Unreal Development Kit ===&lt;br /&gt;
[http://aaronjclifford.com/images/tutorials/prallaxBakingDemonstration.jpg Parallax Baking Demonstration]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Texturing]] [[Category:TextureTypes]] [[Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Vector_displacement_map</id>
		<title>Vector displacement map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Vector_displacement_map"/>
				<updated>2014-11-30T13:21:17Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Vector Displacement Map */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Vector Displacement Map =&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Traditional grayscale [[Displacement map|displacement mapping]] encodes the difference between the high-resolution model and the low-resolution model, using the low-res model's UV coordinates. Vector displacement uses a similar process, except it also uses the high-res model's UV coordinates, creating a correspondence between the two UVs.&lt;br /&gt;
&lt;br /&gt;
This correspondence allows the map to encode not only how far away one vertex is from the nearest vertex on the other mesh, but also to move the vertex across all three axes in space. This allows the map to encode complex undercuts, for example under a mushroom cap or behind an ear.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Related Pages ==&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Texturing]] [[Category:TextureTypes]] [[Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Vector_displacement_map</id>
		<title>Vector displacement map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Vector_displacement_map"/>
				<updated>2014-11-30T13:20:47Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Related Pages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Vector Displacement Map =&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Traditional grayscale [[Displacement map|displacement mapping]] encodes the difference between the high-resolution model and the low-resolution model, using the low-res model's UV coordinates. Vector displacement uses a similar process, except it also uses the high-res model's UV coordinates, creating a correspondence between the two UVs.&lt;br /&gt;
&lt;br /&gt;
This correspondence allows the map to encode not only how far away one vertex is from the nearest vertex on the other mesh, but also to move the vertex across all three axes in space. This allows the map to encode complex undercuts, for example under a mushroom cap or behind an ear.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Related Pages ==&lt;br /&gt;
* [[Curvature_map| Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Texturing]] [[Category:TextureTypes]] [[Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-29T17:06:31Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Re-normalizing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_modo_ohare.jpg|frame|none| When quads are triangulated in [http://www.luxology.com/modo/ Modo], the internal edges are sometimes flipped, which causes shading differences.&amp;lt;br&amp;gt;Image by [http://www.farfarer.com/|James &amp;quot;Talon&amp;quot; O'Hare]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_spec_tychovii.jpg|frame|none| The specular highlight is affected by triangulation. Flip edges to fix skewing. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66651 Skewed Specular Highlight?] for pictures and more info.&amp;lt;br&amp;gt; Image by [http://robertkreps.com Robert &amp;quot;TychoVII&amp;quot; Kreps]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_127seam.jpg|thumb|600px|none| Mirrored normal maps show a seam when (127,127,255) is used for the flat color; 128 is better.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:nrmlmap_blending_methods_Maps.png]]&lt;br /&gt;
|[[image:nrmlmap_blending_methods_RTTNormalMapFX.png]]&lt;br /&gt;
|-&lt;br /&gt;
|The blended normal maps.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|Screenshot of the 3dsmax viewport, using the RTTNormalMap.fx shader.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
&lt;br /&gt;
[[image:normalize_only.jpg|frame|none|The re-normalize option in the NVIDIA filter.&amp;lt;br&amp;gt;Image by [http://hirezstudios.com/ Scott Warren]]]&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
[[image:nrmlmap_ao.jpg|frame|none| AO can be baked into a normal map, shortening the normals (lower left model).&amp;lt;br&amp;gt;Model by [http://www.3dartisan.net/~kuman/ James Ku]]]&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:tree_front.jpg]]||[[image:tree_back.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Tree simulating subsurface scattering (front view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|Tree simulating subsurface scattering (back view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|[[image:tree_maps.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|The maps used for the leaves. The 2nd diffuse was simply color-inverted, hue-shifted 180°, and saturated.&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[image:nmtest_uv-splits_thumb.jpg|thumb|600px|none|Comparison of map baking methods in Maya and Max, and Ben Cloward's custom FX code.&amp;lt;br&amp;gt;Image by [http://www.bencloward.com/ Ben Cloward] and [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
[[image:normalmapfix_3pointstudios_thumb.jpg|frame|none|3 Point Studios' normal map display fix for 3ds Max.&amp;lt;br&amp;gt;image by [http://www.3pointstudios.com 3 Point Studios]]]&lt;br /&gt;
&lt;br /&gt;
{|class &amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:max2010_normalmap_workarounds.png|thumb|400px|none|]]&lt;br /&gt;
|[[image:max2010_normalmap_compare.png|thumb|400px|none|]]&lt;br /&gt;
|-&lt;br /&gt;
|Viewport methods in 3ds Max 2010.&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick] &lt;br /&gt;
|More baking methods in 3ds Max 2010.&amp;lt;br&amp;gt; Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
see; [[Normal Map Compression]]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated!&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[:Category:Texturing]] [[:Category:TextureTypes]] [[:Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-29T14:27:51Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* 3ds Max Shaders */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_modo_ohare.jpg|frame|none| When quads are triangulated in [http://www.luxology.com/modo/ Modo], the internal edges are sometimes flipped, which causes shading differences.&amp;lt;br&amp;gt;Image by [http://www.farfarer.com/|James &amp;quot;Talon&amp;quot; O'Hare]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_spec_tychovii.jpg|frame|none| The specular highlight is affected by triangulation. Flip edges to fix skewing. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66651 Skewed Specular Highlight?] for pictures and more info.&amp;lt;br&amp;gt; Image by [http://robertkreps.com Robert &amp;quot;TychoVII&amp;quot; Kreps]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_127seam.jpg|thumb|600px|none| Mirrored normal maps show a seam when (127,127,255) is used for the flat color; 128 is better.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:nrmlmap_blending_methods_Maps.png]]&lt;br /&gt;
|[[image:nrmlmap_blending_methods_RTTNormalMapFX.png]]&lt;br /&gt;
|-&lt;br /&gt;
|The blended normal maps.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|Screenshot of the 3dsmax viewport, using the RTTNormalMap.fx shader.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
&lt;br /&gt;
[[image:normalize_only.jpg|frame|none|The re-normalize option in the NVIDIA filter.&amp;lt;br&amp;gt;Image by[http://hirezstudios.com/ Scott Warren]]]&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
[[image:nrmlmap_ao.jpg|frame|none| AO can be baked into a normal map, shortening the normals (lower left model).&amp;lt;br&amp;gt;Model by [http://www.3dartisan.net/~kuman/ James Ku]]]&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:tree_front.jpg]]||[[image:tree_back.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Tree simulating subsurface scattering (front view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|Tree simulating subsurface scattering (back view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|[[image:tree_maps.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|The maps used for the leaves. The 2nd diffuse was simply color-inverted, hue-shifted 180°, and saturated.&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[image:nmtest_uv-splits_thumb.jpg|thumb|600px|none|Comparison of map baking methods in Maya and Max, and Ben Cloward's custom FX code.&amp;lt;br&amp;gt;Image by [http://www.bencloward.com/ Ben Cloward] and [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
[[image:normalmapfix_3pointstudios_thumb.jpg|frame|none|3 Point Studios' normal map display fix for 3ds Max.&amp;lt;br&amp;gt;image by [http://www.3pointstudios.com 3 Point Studios]]]&lt;br /&gt;
&lt;br /&gt;
{|class &amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:max2010_normalmap_workarounds.png|thumb|400px|none|]]&lt;br /&gt;
|[[image:max2010_normalmap_compare.png|thumb|400px|none|]]&lt;br /&gt;
|-&lt;br /&gt;
|Viewport methods in 3ds Max 2010.&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick] &lt;br /&gt;
|More baking methods in 3ds Max 2010.&amp;lt;br&amp;gt; Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
see; [[Normal Map Compression]]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated!&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[:Category:Texturing]] [[:Category:TextureTypes]] [[:Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-29T14:17:56Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* 3ds Max Shaders */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_modo_ohare.jpg|frame|none| When quads are triangulated in [http://www.luxology.com/modo/ Modo], the internal edges are sometimes flipped, which causes shading differences.&amp;lt;br&amp;gt;Image by [http://www.farfarer.com/|James &amp;quot;Talon&amp;quot; O'Hare]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_spec_tychovii.jpg|frame|none| The specular highlight is affected by triangulation. Flip edges to fix skewing. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66651 Skewed Specular Highlight?] for pictures and more info.&amp;lt;br&amp;gt; Image by [http://robertkreps.com Robert &amp;quot;TychoVII&amp;quot; Kreps]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_127seam.jpg|thumb|600px|none| Mirrored normal maps show a seam when (127,127,255) is used for the flat color; 128 is better.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:nrmlmap_blending_methods_Maps.png]]&lt;br /&gt;
|[[image:nrmlmap_blending_methods_RTTNormalMapFX.png]]&lt;br /&gt;
|-&lt;br /&gt;
|The blended normal maps.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|Screenshot of the 3dsmax viewport, using the RTTNormalMap.fx shader.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
&lt;br /&gt;
[[image:normalize_only.jpg|frame|none|The re-normalize option in the NVIDIA filter.&amp;lt;br&amp;gt;Image by[http://hirezstudios.com/ Scott Warren]]]&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
[[image:nrmlmap_ao.jpg|frame|none| AO can be baked into a normal map, shortening the normals (lower left model).&amp;lt;br&amp;gt;Model by [http://www.3dartisan.net/~kuman/ James Ku]]]&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:tree_front.jpg]]||[[image:tree_back.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Tree simulating subsurface scattering (front view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|Tree simulating subsurface scattering (back view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|[[image:tree_maps.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|The maps used for the leaves. The 2nd diffuse was simply color-inverted, hue-shifted 180°, and saturated.&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[image:nmtest_uv-splits_thumb.jpg|thumb|600px|none|Comparison of map baking methods in Maya and Max, and Ben Cloward's custom FX code.&amp;lt;br&amp;gt;Image by [http://www.bencloward.com/ Ben Cloward] and [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
|| {{attachment:normalmapfix_3pointstudios_thumb.jpg}} ||&lt;br /&gt;
||3 Point Studios' normal map display fix for 3ds Max.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;[[attachment:normalmapfix_3pointstudios.png|Actual size]]&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;~-image by [[http://www.3pointstudios.com|3 Point Studios]]-~ ||&lt;br /&gt;
&lt;br /&gt;
|| {{attachment:max2010_normalmap_workarounds_thumb.png}} || {{attachment:max2010_normalmap_compare_thumb.png}} ||&lt;br /&gt;
||Viewport methods in 3ds Max 2010.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;[[attachment:max2010_normalmap_workarounds.png|Actual size]]&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;~-image by [[http://www.linkedin.com/in/ericchadwick|Eric Chadwick]]-~ ||More baking methods in 3ds Max 2010.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;[[attachment:max2010_normalmap_compare.png|Actual size]]&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;~-image by [[http://www.linkedin.com/in/ericchadwick|Eric Chadwick]]-~ ||&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
see; [[Normal Map Compression]]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated!&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[:Category:Texturing]] [[:Category:TextureTypes]] [[:Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-29T14:10:15Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Discussion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_modo_ohare.jpg|frame|none| When quads are triangulated in [http://www.luxology.com/modo/ Modo], the internal edges are sometimes flipped, which causes shading differences.&amp;lt;br&amp;gt;Image by [http://www.farfarer.com/|James &amp;quot;Talon&amp;quot; O'Hare]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_spec_tychovii.jpg|frame|none| The specular highlight is affected by triangulation. Flip edges to fix skewing. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66651 Skewed Specular Highlight?] for pictures and more info.&amp;lt;br&amp;gt; Image by [http://robertkreps.com Robert &amp;quot;TychoVII&amp;quot; Kreps]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_127seam.jpg|thumb|600px|none| Mirrored normal maps show a seam when (127,127,255) is used for the flat color; 128 is better.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:nrmlmap_blending_methods_Maps.png]]&lt;br /&gt;
|[[image:nrmlmap_blending_methods_RTTNormalMapFX.png]]&lt;br /&gt;
|-&lt;br /&gt;
|The blended normal maps.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|Screenshot of the 3dsmax viewport, using the RTTNormalMap.fx shader.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
&lt;br /&gt;
[[image:normalize_only.jpg|frame|none|The re-normalize option in the NVIDIA filter.&amp;lt;br&amp;gt;Image by[http://hirezstudios.com/ Scott Warren]]]&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
[[image:nrmlmap_ao.jpg|frame|none| AO can be baked into a normal map, shortening the normals (lower left model).&amp;lt;br&amp;gt;Model by [http://www.3dartisan.net/~kuman/ James Ku]]]&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:tree_front.jpg]]||[[image:tree_back.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Tree simulating subsurface scattering (front view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|Tree simulating subsurface scattering (back view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|[[image:tree_maps.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|The maps used for the leaves. The 2nd diffuse was simply color-inverted, hue-shifted 180°, and saturated.&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
[[Image:max2010_normalmap_workarounds.png|thumb|Viewport methods in 3ds Max 2010. &amp;lt;BR&amp;gt; image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
see; [[Normal Map Compression]]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated!&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[:Category:Texturing]] [[:Category:TextureTypes]] [[:Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-29T14:06:16Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Baking Transparency */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_modo_ohare.jpg|frame|none| When quads are triangulated in [http://www.luxology.com/modo/ Modo], the internal edges are sometimes flipped, which causes shading differences.&amp;lt;br&amp;gt;Image by [http://www.farfarer.com/|James &amp;quot;Talon&amp;quot; O'Hare]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_spec_tychovii.jpg|frame|none| The specular highlight is affected by triangulation. Flip edges to fix skewing. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66651 Skewed Specular Highlight?] for pictures and more info.&amp;lt;br&amp;gt; Image by [http://robertkreps.com Robert &amp;quot;TychoVII&amp;quot; Kreps]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_127seam.jpg|thumb|600px|none| Mirrored normal maps show a seam when (127,127,255) is used for the flat color; 128 is better.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:nrmlmap_blending_methods_Maps.png]]&lt;br /&gt;
|[[image:nrmlmap_blending_methods_RTTNormalMapFX.png]]&lt;br /&gt;
|-&lt;br /&gt;
|The blended normal maps.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|Screenshot of the 3dsmax viewport, using the RTTNormalMap.fx shader.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
&lt;br /&gt;
[[image:normalize_only.jpg|frame|none|The re-normalize option in the NVIDIA filter.&amp;lt;br&amp;gt;Image by[http://hirezstudios.com/ Scott Warren]]]&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
[[image:nrmlmap_ao.jpg|frame|none| AO can be baked into a normal map, shortening the normals (lower left model).&amp;lt;br&amp;gt;Model by [http://www.3dartisan.net/~kuman/ James Ku]]]&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:tree_front.jpg]]||[[image:tree_back.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Tree simulating subsurface scattering (front view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|Tree simulating subsurface scattering (back view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|[[image:tree_maps.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|The maps used for the leaves. The 2nd diffuse was simply color-inverted, hue-shifted 180°, and saturated.&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
[[Image:max2010_normalmap_workarounds.png|thumb|Viewport methods in 3ds Max 2010. &amp;lt;BR&amp;gt; image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
see; [[Normal Map Compression]]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[:Category:Texturing]] [[:Category:TextureTypes]] [[:Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-29T14:06:02Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Working with Cages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_modo_ohare.jpg|frame|none| When quads are triangulated in [http://www.luxology.com/modo/ Modo], the internal edges are sometimes flipped, which causes shading differences.&amp;lt;br&amp;gt;Image by [http://www.farfarer.com/|James &amp;quot;Talon&amp;quot; O'Hare]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_spec_tychovii.jpg|frame|none| The specular highlight is affected by triangulation. Flip edges to fix skewing. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66651 Skewed Specular Highlight?] for pictures and more info.&amp;lt;br&amp;gt; Image by [http://robertkreps.com Robert &amp;quot;TychoVII&amp;quot; Kreps]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_127seam.jpg|thumb|600px|none| Mirrored normal maps show a seam when (127,127,255) is used for the flat color; 128 is better.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:nrmlmap_blending_methods_Maps.png]]&lt;br /&gt;
|[[image:nrmlmap_blending_methods_RTTNormalMapFX.png]]&lt;br /&gt;
|-&lt;br /&gt;
|The blended normal maps.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|Screenshot of the 3dsmax viewport, using the RTTNormalMap.fx shader.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
&lt;br /&gt;
[[image:normalize_only.jpg|frame|none|The re-normalize option in the NVIDIA filter.&amp;lt;br&amp;gt;Image by[http://hirezstudios.com/ Scott Warren]]]&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
[[image:nrmlmap_ao.jpg|frame|none| AO can be baked into a normal map, shortening the normals (lower left model).&amp;lt;br&amp;gt;Model by [http://www.3dartisan.net/~kuman/ James Ku]]]&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:tree_front.jpg]]||[[image:tree_back.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Tree simulating subsurface scattering (front view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|Tree simulating subsurface scattering (back view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|[[image:tree_maps.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|The maps used for the leaves. The 2nd diffuse was simply color-inverted, hue-shifted 180°, and saturated.&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
[[Image:max2010_normalmap_workarounds.png|thumb|Viewport methods in 3ds Max 2010. &amp;lt;BR&amp;gt; image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
see; [[Normal Map Compression]]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[:Category:Texturing]] [[:Category:TextureTypes]] [[:Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-29T14:05:50Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Blending Normal Maps Together */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_modo_ohare.jpg|frame|none| When quads are triangulated in [http://www.luxology.com/modo/ Modo], the internal edges are sometimes flipped, which causes shading differences.&amp;lt;br&amp;gt;Image by [http://www.farfarer.com/|James &amp;quot;Talon&amp;quot; O'Hare]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_spec_tychovii.jpg|frame|none| The specular highlight is affected by triangulation. Flip edges to fix skewing. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66651 Skewed Specular Highlight?] for pictures and more info.&amp;lt;br&amp;gt; Image by [http://robertkreps.com Robert &amp;quot;TychoVII&amp;quot; Kreps]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_127seam.jpg|thumb|600px|none| Mirrored normal maps show a seam when (127,127,255) is used for the flat color; 128 is better.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:nrmlmap_blending_methods_Maps.png]]&lt;br /&gt;
|[[image:nrmlmap_blending_methods_RTTNormalMapFX.png]]&lt;br /&gt;
|-&lt;br /&gt;
|The blended normal maps.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|Screenshot of the 3dsmax viewport, using the RTTNormalMap.fx shader.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
&lt;br /&gt;
[[image:normalize_only.jpg|frame|none|The re-normalize option in the NVIDIA filter.&amp;lt;br&amp;gt;Image by[http://hirezstudios.com/ Scott Warren]]]&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
[[image:nrmlmap_ao.jpg|frame|none| AO can be baked into a normal map, shortening the normals (lower left model).&amp;lt;br&amp;gt;Model by [http://www.3dartisan.net/~kuman/ James Ku]]]&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:tree_front.jpg]]||[[image:tree_back.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Tree simulating subsurface scattering (front view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|Tree simulating subsurface scattering (back view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|[[image:tree_maps.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|The maps used for the leaves. The 2nd diffuse was simply color-inverted, hue-shifted 180°, and saturated.&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
[[Image:max2010_normalmap_workarounds.png|thumb|Viewport methods in 3ds Max 2010. &amp;lt;BR&amp;gt; image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
see; [[Normal Map Compression]]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[:Category:Texturing]] [[:Category:TextureTypes]] [[:Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-29T14:05:29Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Back Lighting Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_modo_ohare.jpg|frame|none| When quads are triangulated in [http://www.luxology.com/modo/ Modo], the internal edges are sometimes flipped, which causes shading differences.&amp;lt;br&amp;gt;Image by [http://www.farfarer.com/|James &amp;quot;Talon&amp;quot; O'Hare]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_spec_tychovii.jpg|frame|none| The specular highlight is affected by triangulation. Flip edges to fix skewing. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66651 Skewed Specular Highlight?] for pictures and more info.&amp;lt;br&amp;gt; Image by [http://robertkreps.com Robert &amp;quot;TychoVII&amp;quot; Kreps]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_127seam.jpg|thumb|600px|none| Mirrored normal maps show a seam when (127,127,255) is used for the flat color; 128 is better.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:nrmlmap_blending_methods_Maps.png]]&lt;br /&gt;
|[[image:nrmlmap_blending_methods_RTTNormalMapFX.png]]&lt;br /&gt;
|-&lt;br /&gt;
|The blended normal maps.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|Screenshot of the 3dsmax viewport, using the RTTNormalMap.fx shader.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
&lt;br /&gt;
[[image:normalize_only.jpg|frame|none|The re-normalize option in the NVIDIA filter.&amp;lt;br&amp;gt;Image by[http://hirezstudios.com/ Scott Warren]]]&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
[[image:nrmlmap_ao.jpg|frame|none| AO can be baked into a normal map, shortening the normals (lower left model).&amp;lt;br&amp;gt;Model by [http://www.3dartisan.net/~kuman/ James Ku]]]&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|[[image:tree_front.jpg]]||[[image:tree_back.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Tree simulating subsurface scattering (front view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|Tree simulating subsurface scattering (back view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|[[image:tree_maps.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|The maps used for the leaves. The 2nd diffuse was simply color-inverted, hue-shifted 180°, and saturated.&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
[[Image:max2010_normalmap_workarounds.png|thumb|Viewport methods in 3ds Max 2010. &amp;lt;BR&amp;gt; image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
see; [[Normal Map Compression]]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[:Category:Texturing]] [[:Category:TextureTypes]] [[:Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-29T14:02:03Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Back Lighting Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_modo_ohare.jpg|frame|none| When quads are triangulated in [http://www.luxology.com/modo/ Modo], the internal edges are sometimes flipped, which causes shading differences.&amp;lt;br&amp;gt;Image by [http://www.farfarer.com/|James &amp;quot;Talon&amp;quot; O'Hare]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_spec_tychovii.jpg|frame|none| The specular highlight is affected by triangulation. Flip edges to fix skewing. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66651 Skewed Specular Highlight?] for pictures and more info.&amp;lt;br&amp;gt; Image by [http://robertkreps.com Robert &amp;quot;TychoVII&amp;quot; Kreps]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_127seam.jpg|thumb|600px|none| Mirrored normal maps show a seam when (127,127,255) is used for the flat color; 128 is better.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:nrmlmap_blending_methods_Maps.png]]&lt;br /&gt;
|[[image:nrmlmap_blending_methods_RTTNormalMapFX.png]]&lt;br /&gt;
|-&lt;br /&gt;
|The blended normal maps.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|Screenshot of the 3dsmax viewport, using the RTTNormalMap.fx shader.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
&lt;br /&gt;
[[image:normalize_only.jpg|frame|none|The re-normalize option in the NVIDIA filter.&amp;lt;br&amp;gt;Image by[http://hirezstudios.com/ Scott Warren]]]&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
[[image:nrmlmap_ao.jpg|frame|none| AO can be baked into a normal map, shortening the normals (lower left model).&amp;lt;br&amp;gt;Model by [http://www.3dartisan.net/~kuman/ James Ku]]]&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:tree_front.jpg]]||[[image:tree_back.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Tree simulating subsurface scattering (front view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|Tree simulating subsurface scattering (back view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|[[image:tree_maps.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|The maps used for the leaves. The 2nd diffuse was simply color-inverted, hue-shifted 180°, and saturated.&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
[[Image:max2010_normalmap_workarounds.png|thumb|Viewport methods in 3ds Max 2010. &amp;lt;BR&amp;gt; image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
see; [[Normal Map Compression]]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[:Category:Texturing]] [[:Category:TextureTypes]] [[:Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-29T14:01:18Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Back Lighting Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_modo_ohare.jpg|frame|none| When quads are triangulated in [http://www.luxology.com/modo/ Modo], the internal edges are sometimes flipped, which causes shading differences.&amp;lt;br&amp;gt;Image by [http://www.farfarer.com/|James &amp;quot;Talon&amp;quot; O'Hare]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_spec_tychovii.jpg|frame|none| The specular highlight is affected by triangulation. Flip edges to fix skewing. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66651 Skewed Specular Highlight?] for pictures and more info.&amp;lt;br&amp;gt; Image by [http://robertkreps.com Robert &amp;quot;TychoVII&amp;quot; Kreps]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_127seam.jpg|thumb|600px|none| Mirrored normal maps show a seam when (127,127,255) is used for the flat color; 128 is better.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:nrmlmap_blending_methods_Maps.png]]&lt;br /&gt;
|[[image:nrmlmap_blending_methods_RTTNormalMapFX.png]]&lt;br /&gt;
|-&lt;br /&gt;
|The blended normal maps.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|Screenshot of the 3dsmax viewport, using the RTTNormalMap.fx shader.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
&lt;br /&gt;
[[image:normalize_only.jpg|frame|none|The re-normalize option in the NVIDIA filter.&amp;lt;br&amp;gt;Image by[http://hirezstudios.com/ Scott Warren]]]&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
[[image:nrmlmap_ao.jpg|frame|none| AO can be baked into a normal map, shortening the normals (lower left model).&amp;lt;br&amp;gt;Model by [http://www.3dartisan.net/~kuman/ James Ku]]]&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:tree_front.jpg]]&lt;br /&gt;
|[[image:tree_back.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Tree simulating subsurface scattering (front view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|Tree simulating subsurface scattering (back view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|[[image:tree_maps.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|The maps used for the leaves. The 2nd diffuse was simply color-inverted, hue-shifted 180°, and saturated.&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
[[Image:max2010_normalmap_workarounds.png|thumb|Viewport methods in 3ds Max 2010. &amp;lt;BR&amp;gt; image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
see; [[Normal Map Compression]]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[:Category:Texturing]] [[:Category:TextureTypes]] [[:Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-29T13:54:24Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* 3ds Max Shaders */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_modo_ohare.jpg|frame|none| When quads are triangulated in [http://www.luxology.com/modo/ Modo], the internal edges are sometimes flipped, which causes shading differences.&amp;lt;br&amp;gt;Image by [http://www.farfarer.com/|James &amp;quot;Talon&amp;quot; O'Hare]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_spec_tychovii.jpg|frame|none| The specular highlight is affected by triangulation. Flip edges to fix skewing. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66651 Skewed Specular Highlight?] for pictures and more info.&amp;lt;br&amp;gt; Image by [http://robertkreps.com Robert &amp;quot;TychoVII&amp;quot; Kreps]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_127seam.jpg|thumb|600px|none| Mirrored normal maps show a seam when (127,127,255) is used for the flat color; 128 is better.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:nrmlmap_blending_methods_Maps.png]]&lt;br /&gt;
|[[image:nrmlmap_blending_methods_RTTNormalMapFX.png]]&lt;br /&gt;
|-&lt;br /&gt;
|The blended normal maps.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|Screenshot of the 3dsmax viewport, using the RTTNormalMap.fx shader.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
&lt;br /&gt;
[[image:normalize_only.jpg|frame|none|The re-normalize option in the NVIDIA filter.&amp;lt;br&amp;gt;Image by[http://hirezstudios.com/ Scott Warren]]]&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
[[image:nrmlmap_ao.jpg|frame|none| AO can be baked into a normal map, shortening the normals (lower left model).&amp;lt;br&amp;gt;Model by [http://www.3dartisan.net/~kuman/ James Ku]]]&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:tree_front.jpg]]&lt;br /&gt;
|[[image:tree_back.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Tree simulating subsurface scattering (front view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|Tree simulating subsurface scattering (back view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|-&lt;br /&gt;
|[[image:tree_maps.jpg|colspan=&amp;quot;2&amp;quot;|]]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|The maps used for the leaves. The 2nd diffuse was simply color-inverted, hue-shifted 180°, and saturated.&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
[[Image:max2010_normalmap_workarounds.png|thumb|Viewport methods in 3ds Max 2010. &amp;lt;BR&amp;gt; image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
see; [[Normal Map Compression]]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[:Category:Texturing]] [[:Category:TextureTypes]] [[:Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-29T13:53:52Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Maya Shaders */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_modo_ohare.jpg|frame|none| When quads are triangulated in [http://www.luxology.com/modo/ Modo], the internal edges are sometimes flipped, which causes shading differences.&amp;lt;br&amp;gt;Image by [http://www.farfarer.com/|James &amp;quot;Talon&amp;quot; O'Hare]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_spec_tychovii.jpg|frame|none| The specular highlight is affected by triangulation. Flip edges to fix skewing. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66651 Skewed Specular Highlight?] for pictures and more info.&amp;lt;br&amp;gt; Image by [http://robertkreps.com Robert &amp;quot;TychoVII&amp;quot; Kreps]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_127seam.jpg|thumb|600px|none| Mirrored normal maps show a seam when (127,127,255) is used for the flat color; 128 is better.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:nrmlmap_blending_methods_Maps.png]]&lt;br /&gt;
|[[image:nrmlmap_blending_methods_RTTNormalMapFX.png]]&lt;br /&gt;
|-&lt;br /&gt;
|The blended normal maps.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|Screenshot of the 3dsmax viewport, using the RTTNormalMap.fx shader.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
&lt;br /&gt;
[[image:normalize_only.jpg|frame|none|The re-normalize option in the NVIDIA filter.&amp;lt;br&amp;gt;Image by[http://hirezstudios.com/ Scott Warren]]]&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
[[image:nrmlmap_ao.jpg|frame|none| AO can be baked into a normal map, shortening the normals (lower left model).&amp;lt;br&amp;gt;Model by [http://www.3dartisan.net/~kuman/ James Ku]]]&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:tree_front.jpg]]&lt;br /&gt;
|[[image:tree_back.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Tree simulating subsurface scattering (front view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|Tree simulating subsurface scattering (back view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|-&lt;br /&gt;
|[[image:tree_maps.jpg|colspan=&amp;quot;2&amp;quot;|]]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|The maps used for the leaves. The 2nd diffuse was simply color-inverted, hue-shifted 180°, and saturated.&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
[[Image:max2010_normalmap_workarounds.png|thumb|Viewport methods in 3ds Max 2010. &amp;lt;BR&amp;gt; image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
see; [[Normal Map Compression]]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[:Category:Texturing]] [[:Category:TextureTypes]] [[:Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-29T13:53:31Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Back Lighting Example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_modo_ohare.jpg|frame|none| When quads are triangulated in [http://www.luxology.com/modo/ Modo], the internal edges are sometimes flipped, which causes shading differences.&amp;lt;br&amp;gt;Image by [http://www.farfarer.com/|James &amp;quot;Talon&amp;quot; O'Hare]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_spec_tychovii.jpg|frame|none| The specular highlight is affected by triangulation. Flip edges to fix skewing. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66651 Skewed Specular Highlight?] for pictures and more info.&amp;lt;br&amp;gt; Image by [http://robertkreps.com Robert &amp;quot;TychoVII&amp;quot; Kreps]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_127seam.jpg|thumb|600px|none| Mirrored normal maps show a seam when (127,127,255) is used for the flat color; 128 is better.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:nrmlmap_blending_methods_Maps.png]]&lt;br /&gt;
|[[image:nrmlmap_blending_methods_RTTNormalMapFX.png]]&lt;br /&gt;
|-&lt;br /&gt;
|The blended normal maps.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|Screenshot of the 3dsmax viewport, using the RTTNormalMap.fx shader.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
&lt;br /&gt;
[[image:normalize_only.jpg|frame|none|The re-normalize option in the NVIDIA filter.&amp;lt;br&amp;gt;Image by[http://hirezstudios.com/ Scott Warren]]]&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
[[image:nrmlmap_ao.jpg|frame|none| AO can be baked into a normal map, shortening the normals (lower left model).&amp;lt;br&amp;gt;Model by [http://www.3dartisan.net/~kuman/ James Ku]]]&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:tree_front.jpg]]&lt;br /&gt;
|[[image:tree_back.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Tree simulating subsurface scattering (front view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|Tree simulating subsurface scattering (back view).&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|-&lt;br /&gt;
|[[image:tree_maps.jpg|colspan=&amp;quot;2&amp;quot;|]]&lt;br /&gt;
|-&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|The maps used for the leaves. The 2nd diffuse was simply color-inverted, hue-shifted 180°, and saturated.&amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
[[Image:max2010_normalmap_workarounds.png|thumb|Viewport methods in 3ds Max 2010. &amp;lt;BR&amp;gt; image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[NormalMapCompression]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
see; [[Normal Map Compression]]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[:Category:Texturing]] [[:Category:TextureTypes]] [[:Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-29T13:41:25Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Ambient Occlusion into a Normal Map */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_modo_ohare.jpg|frame|none| When quads are triangulated in [http://www.luxology.com/modo/ Modo], the internal edges are sometimes flipped, which causes shading differences.&amp;lt;br&amp;gt;Image by [http://www.farfarer.com/|James &amp;quot;Talon&amp;quot; O'Hare]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_spec_tychovii.jpg|frame|none| The specular highlight is affected by triangulation. Flip edges to fix skewing. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66651 Skewed Specular Highlight?] for pictures and more info.&amp;lt;br&amp;gt; Image by [http://robertkreps.com Robert &amp;quot;TychoVII&amp;quot; Kreps]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_127seam.jpg|thumb|600px|none| Mirrored normal maps show a seam when (127,127,255) is used for the flat color; 128 is better.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:nrmlmap_blending_methods_Maps.png]]&lt;br /&gt;
|[[image:nrmlmap_blending_methods_RTTNormalMapFX.png]]&lt;br /&gt;
|-&lt;br /&gt;
|The blended normal maps.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|Screenshot of the 3dsmax viewport, using the RTTNormalMap.fx shader.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
&lt;br /&gt;
[[image:normalize_only.jpg|frame|none|The re-normalize option in the NVIDIA filter.&amp;lt;br&amp;gt;Image by[http://hirezstudios.com/ Scott Warren]]]&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
[[image:nrmlmap_ao.jpg|frame|none| AO can be baked into a normal map, shortening the normals (lower left model).&amp;lt;br&amp;gt;Model by [http://www.3dartisan.net/~kuman/ James Ku]]]&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
[[Image:tree_front.jpg|thumb|Tree simulating subsurface scattering. &amp;lt;BR&amp;gt;image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick].]]&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[ShadersAndSeams]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
[[Image:max2010_normalmap_workarounds.png|thumb|Viewport methods in 3ds Max 2010. &amp;lt;BR&amp;gt; image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[NormalMapCompression]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
see; [[Normal Map Compression]]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[:Category:Texturing]] [[:Category:TextureTypes]] [[:Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-29T13:38:44Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Re-normalizing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_modo_ohare.jpg|frame|none| When quads are triangulated in [http://www.luxology.com/modo/ Modo], the internal edges are sometimes flipped, which causes shading differences.&amp;lt;br&amp;gt;Image by [http://www.farfarer.com/|James &amp;quot;Talon&amp;quot; O'Hare]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_spec_tychovii.jpg|frame|none| The specular highlight is affected by triangulation. Flip edges to fix skewing. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66651 Skewed Specular Highlight?] for pictures and more info.&amp;lt;br&amp;gt; Image by [http://robertkreps.com Robert &amp;quot;TychoVII&amp;quot; Kreps]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_127seam.jpg|thumb|600px|none| Mirrored normal maps show a seam when (127,127,255) is used for the flat color; 128 is better.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:nrmlmap_blending_methods_Maps.png]]&lt;br /&gt;
|[[image:nrmlmap_blending_methods_RTTNormalMapFX.png]]&lt;br /&gt;
|-&lt;br /&gt;
|The blended normal maps.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|Screenshot of the 3dsmax viewport, using the RTTNormalMap.fx shader.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
&lt;br /&gt;
[[image:normalize_only.jpg|frame|none|The re-normalize option in the NVIDIA filter.&amp;lt;br&amp;gt;Image by[http://hirezstudios.com/ Scott Warren]]]&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
[[Image:tree_front.jpg|thumb|Tree simulating subsurface scattering. &amp;lt;BR&amp;gt;image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick].]]&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[ShadersAndSeams]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
[[Image:max2010_normalmap_workarounds.png|thumb|Viewport methods in 3ds Max 2010. &amp;lt;BR&amp;gt; image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[NormalMapCompression]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
see; [[Normal Map Compression]]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[:Category:Texturing]] [[:Category:TextureTypes]] [[:Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-29T12:49:44Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Blending Normal Maps Together */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_modo_ohare.jpg|frame|none| When quads are triangulated in [http://www.luxology.com/modo/ Modo], the internal edges are sometimes flipped, which causes shading differences.&amp;lt;br&amp;gt;Image by [http://www.farfarer.com/|James &amp;quot;Talon&amp;quot; O'Hare]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_spec_tychovii.jpg|frame|none| The specular highlight is affected by triangulation. Flip edges to fix skewing. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66651 Skewed Specular Highlight?] for pictures and more info.&amp;lt;br&amp;gt; Image by [http://robertkreps.com Robert &amp;quot;TychoVII&amp;quot; Kreps]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_127seam.jpg|thumb|600px|none| Mirrored normal maps show a seam when (127,127,255) is used for the flat color; 128 is better.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:nrmlmap_blending_methods_Maps.png]]&lt;br /&gt;
|[[image:nrmlmap_blending_methods_RTTNormalMapFX.png]]&lt;br /&gt;
|-&lt;br /&gt;
|The blended normal maps.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|Screenshot of the 3dsmax viewport, using the RTTNormalMap.fx shader.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
[[Image:tree_front.jpg|thumb|Tree simulating subsurface scattering. &amp;lt;BR&amp;gt;image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick].]]&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[ShadersAndSeams]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
[[Image:max2010_normalmap_workarounds.png|thumb|Viewport methods in 3ds Max 2010. &amp;lt;BR&amp;gt; image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[NormalMapCompression]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
see; [[Normal Map Compression]]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[:Category:Texturing]] [[:Category:TextureTypes]] [[:Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-29T12:44:33Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Ambient Occlusion into a Normal Map */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_modo_ohare.jpg|frame|none| When quads are triangulated in [http://www.luxology.com/modo/ Modo], the internal edges are sometimes flipped, which causes shading differences.&amp;lt;br&amp;gt;Image by [http://www.farfarer.com/|James &amp;quot;Talon&amp;quot; O'Hare]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_spec_tychovii.jpg|frame|none| The specular highlight is affected by triangulation. Flip edges to fix skewing. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66651 Skewed Specular Highlight?] for pictures and more info.&amp;lt;br&amp;gt; Image by [http://robertkreps.com Robert &amp;quot;TychoVII&amp;quot; Kreps]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_127seam.jpg|thumb|600px|none| Mirrored normal maps show a seam when (127,127,255) is used for the flat color; 128 is better.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
&lt;br /&gt;
[[Image:nrmlmap_blending_methods_Maps.png|frame|none|The blended normal maps.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
[[Image:tree_front.jpg|thumb|Tree simulating subsurface scattering. &amp;lt;BR&amp;gt;image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick].]]&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[ShadersAndSeams]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
[[Image:max2010_normalmap_workarounds.png|thumb|Viewport methods in 3ds Max 2010. &amp;lt;BR&amp;gt; image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[NormalMapCompression]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
see; [[Normal Map Compression]]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[:Category:Texturing]] [[:Category:TextureTypes]] [[:Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-29T12:21:51Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Blending Normal Maps Together */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_modo_ohare.jpg|frame|none| When quads are triangulated in [http://www.luxology.com/modo/ Modo], the internal edges are sometimes flipped, which causes shading differences.&amp;lt;br&amp;gt;Image by [http://www.farfarer.com/|James &amp;quot;Talon&amp;quot; O'Hare]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_spec_tychovii.jpg|frame|none| The specular highlight is affected by triangulation. Flip edges to fix skewing. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66651 Skewed Specular Highlight?] for pictures and more info.&amp;lt;br&amp;gt; Image by [http://robertkreps.com Robert &amp;quot;TychoVII&amp;quot; Kreps]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_127seam.jpg|thumb|600px|none| Mirrored normal maps show a seam when (127,127,255) is used for the flat color; 128 is better.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
&lt;br /&gt;
[[Image:nrmlmap_blending_methods_Maps.png|frame|none|The blended normal maps.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[BacklightingExample]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
[[Image:tree_front.jpg|thumb|Tree simulating subsurface scattering. &amp;lt;BR&amp;gt;image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick].]]&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[ShadersAndSeams]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
[[Image:max2010_normalmap_workarounds.png|thumb|Viewport methods in 3ds Max 2010. &amp;lt;BR&amp;gt; image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[NormalMapCompression]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
see; [[Normal Map Compression]]&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[:Category:Texturing]] [[:Category:TextureTypes]] [[:Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-28T13:06:38Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Flat Color */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_modo_ohare.jpg|frame|none| When quads are triangulated in [http://www.luxology.com/modo/ Modo], the internal edges are sometimes flipped, which causes shading differences.&amp;lt;br&amp;gt;Image by [http://www.farfarer.com/|James &amp;quot;Talon&amp;quot; O'Hare]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_spec_tychovii.jpg|frame|none| The specular highlight is affected by triangulation. Flip edges to fix skewing. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66651 Skewed Specular Highlight?] for pictures and more info.&amp;lt;br&amp;gt; Image by [http://robertkreps.com Robert &amp;quot;TychoVII&amp;quot; Kreps]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_127seam.jpg|thumb|600px|none| Mirrored normal maps show a seam when (127,127,255) is used for the flat color; 128 is better.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| [[Image:NormalMap$nrmlmap_blending_methods_Maps.png}}&lt;br /&gt;
|-&lt;br /&gt;
| The blended normal maps.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by[http://www.ericchadwick.com Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[BacklightingExample]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|  [[Image:NormalMap$tree_front.jpg]] &lt;br /&gt;
|-&lt;br /&gt;
| Tree simulating subsurface scattering (front view).&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by[http://www.linkedin.com/in/ericchadwick Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[ShadersAndSeams]])&amp;gt;&amp;gt;&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|  [[Image:NormalMap$max2010_normalmap_workarounds_thumb.png]] &lt;br /&gt;
|-&lt;br /&gt;
| Viewport methods in 3ds Max 2010.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;[[attachment:max2010_normalmap_workarounds.png|Actual size]]&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[NormalMapCompression]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
Normal maps can take up a lot of memory. Compression can reduce the size of a map to 1/4 of what it was uncompressed, which means you can either increase the resolution or you can use more maps.&lt;br /&gt;
&lt;br /&gt;
Usually the compression method is to throw away the Blue channel, because this can be re-computing at minimal cost in the shader code. Then the bitmap only has to store two color channels, instead of four (red, green, blue, and alpha).&lt;br /&gt;
&lt;br /&gt;
* The article [http://developer.download.nvidia.com/whitepapers/2008/real-time-normal-map-dxt-compression.pdf Real-Time Normal Map DXT Compression] (PDF) from [http://www.idsoftware.com/ id software] and [http://developer.nvidia.com NVIDIA] is an excellent introduction to compression.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;DXT5C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== DXT5nm Compression ===&lt;br /&gt;
DXT5nm is the same file format as DXT5 except before compression the red channel is moved into the alpha channel, the green channel is left as-is, and the red and blue channels are blanked with the same solid color. This re-arranging of the normal map axes is called ''swizzling''.&lt;br /&gt;
&lt;br /&gt;
The Green and Alpha channels are used because in the DXT format they are compressed using somewhat higher bit depths than the Red and Blue channels. Red and Blue have to be filled with the same solid color because DXT uses a compression system that compares differences between the three color channels. If you try to store some kind of texture in Red and/or Blue (specular power, height map, etc.) then the compressor will create more compression artifacts because it has to compare all three channels.&lt;br /&gt;
&lt;br /&gt;
There are some options in the NVIDIA DXT compressor that help reduce the artifacts if you want to add texture to the Red or Blue channels. The artifacts will be greater than if you keep Red and Blue empty, but it might be a tradeoff worth making. Some notes about this on the [http://developer.nvidia.com/forums/index.php?showtopic=1366 NVIDIA Developer Forums].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;DXT1C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== DXT1 Compression ===&lt;br /&gt;
DXT1 is also used sometimes for tangent-space normal maps, because it is half the size of a DXT5. The downside though is that it causes many more compression artifacts, so much so that most people end up not using it. &lt;br /&gt;
&lt;br /&gt;
* The blog post [http://realtimecollisiondetection.net/blog/?p=28#more-28 I like spilled beans!] by [http://realtimecollisiondetection.net/blog/?page_id=2 Christer Ericson] has a section about Capcom's clever use of DXT1 and DXT5.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DCC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3Dc Compression ===&lt;br /&gt;
3Dc compression is also known as BC5 in DirectX 10. It works similar to DXT5nm, because it only stores the X and Y channels. The difference is it stores both the same way as the DXT5 Alpha channel, which is a slightly higher bit depth than DXT5nm's Green channel. 3Dc yields the best results of any listed algorithm for tangent space normal map compression, and requires no extra processing time or unique hardware. See [[3Dc]] for more information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;A8L8C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== [[A8L8]] Compression ===&lt;br /&gt;
The DDS format !A8L8 isn't actually compressed, it's just two 8bit grayscale channels (256 grays each). It does save you from having to store all three color channels. Your shader has to recompute the blue channel for it to work. However, !A8L8 does not actually save any space in texture memory, it is typically converted to a four-channel 32bit texture when it's sent to the card. This format really only helps save disk space.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;L&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Texturing]] [[Category:TextureTypes]] [[Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-28T13:03:46Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Flat Color */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_modo_ohare.jpg|frame|none| When quads are triangulated in [http://www.luxology.com/modo/ Modo], the internal edges are sometimes flipped, which causes shading differences.&amp;lt;br&amp;gt;Image by [http://www.farfarer.com/|James &amp;quot;Talon&amp;quot; O'Hare]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_spec_tychovii.jpg|frame|none| The specular highlight is affected by triangulation. Flip edges to fix skewing. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66651 Skewed Specular Highlight?] for pictures and more info.&amp;lt;br&amp;gt; Image by [http://robertkreps.com Robert &amp;quot;TychoVII&amp;quot; Kreps]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_127seam.jpg|frame|none|600px| Mirrored normal maps show a seam when (127,127,255) is used for the flat color; 128 is better.&amp;lt;br&amp;gt;Image by [http://www.ericchadwick.com Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| [[Image:NormalMap$nrmlmap_blending_methods_Maps.png}}&lt;br /&gt;
|-&lt;br /&gt;
| The blended normal maps.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by[http://www.ericchadwick.com Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[BacklightingExample]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|  [[Image:NormalMap$tree_front.jpg]] &lt;br /&gt;
|-&lt;br /&gt;
| Tree simulating subsurface scattering (front view).&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by[http://www.linkedin.com/in/ericchadwick Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[ShadersAndSeams]])&amp;gt;&amp;gt;&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|  [[Image:NormalMap$max2010_normalmap_workarounds_thumb.png]] &lt;br /&gt;
|-&lt;br /&gt;
| Viewport methods in 3ds Max 2010.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;[[attachment:max2010_normalmap_workarounds.png|Actual size]]&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[NormalMapCompression]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
Normal maps can take up a lot of memory. Compression can reduce the size of a map to 1/4 of what it was uncompressed, which means you can either increase the resolution or you can use more maps.&lt;br /&gt;
&lt;br /&gt;
Usually the compression method is to throw away the Blue channel, because this can be re-computing at minimal cost in the shader code. Then the bitmap only has to store two color channels, instead of four (red, green, blue, and alpha).&lt;br /&gt;
&lt;br /&gt;
* The article [http://developer.download.nvidia.com/whitepapers/2008/real-time-normal-map-dxt-compression.pdf Real-Time Normal Map DXT Compression] (PDF) from [http://www.idsoftware.com/ id software] and [http://developer.nvidia.com NVIDIA] is an excellent introduction to compression.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;DXT5C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== DXT5nm Compression ===&lt;br /&gt;
DXT5nm is the same file format as DXT5 except before compression the red channel is moved into the alpha channel, the green channel is left as-is, and the red and blue channels are blanked with the same solid color. This re-arranging of the normal map axes is called ''swizzling''.&lt;br /&gt;
&lt;br /&gt;
The Green and Alpha channels are used because in the DXT format they are compressed using somewhat higher bit depths than the Red and Blue channels. Red and Blue have to be filled with the same solid color because DXT uses a compression system that compares differences between the three color channels. If you try to store some kind of texture in Red and/or Blue (specular power, height map, etc.) then the compressor will create more compression artifacts because it has to compare all three channels.&lt;br /&gt;
&lt;br /&gt;
There are some options in the NVIDIA DXT compressor that help reduce the artifacts if you want to add texture to the Red or Blue channels. The artifacts will be greater than if you keep Red and Blue empty, but it might be a tradeoff worth making. Some notes about this on the [http://developer.nvidia.com/forums/index.php?showtopic=1366 NVIDIA Developer Forums].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;DXT1C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== DXT1 Compression ===&lt;br /&gt;
DXT1 is also used sometimes for tangent-space normal maps, because it is half the size of a DXT5. The downside though is that it causes many more compression artifacts, so much so that most people end up not using it. &lt;br /&gt;
&lt;br /&gt;
* The blog post [http://realtimecollisiondetection.net/blog/?p=28#more-28 I like spilled beans!] by [http://realtimecollisiondetection.net/blog/?page_id=2 Christer Ericson] has a section about Capcom's clever use of DXT1 and DXT5.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DCC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3Dc Compression ===&lt;br /&gt;
3Dc compression is also known as BC5 in DirectX 10. It works similar to DXT5nm, because it only stores the X and Y channels. The difference is it stores both the same way as the DXT5 Alpha channel, which is a slightly higher bit depth than DXT5nm's Green channel. 3Dc yields the best results of any listed algorithm for tangent space normal map compression, and requires no extra processing time or unique hardware. See [[3Dc]] for more information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;A8L8C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== [[A8L8]] Compression ===&lt;br /&gt;
The DDS format !A8L8 isn't actually compressed, it's just two 8bit grayscale channels (256 grays each). It does save you from having to store all three color channels. Your shader has to recompute the blue channel for it to work. However, !A8L8 does not actually save any space in texture memory, it is typically converted to a four-channel 32bit texture when it's sent to the card. This format really only helps save disk space.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;L&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Texturing]] [[Category:TextureTypes]] [[Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-28T12:58:04Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Triangulating */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_modo_ohare.jpg|frame|none| When quads are triangulated in [http://www.luxology.com/modo/ Modo], the internal edges are sometimes flipped, which causes shading differences.&amp;lt;br&amp;gt;Image by [http://www.farfarer.com/|James &amp;quot;Talon&amp;quot; O'Hare]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_spec_tychovii.jpg|frame|none| The specular highlight is affected by triangulation. Flip edges to fix skewing. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66651 Skewed Specular Highlight?] for pictures and more info.&amp;lt;br&amp;gt; Image by [http://robertkreps.com Robert &amp;quot;TychoVII&amp;quot; Kreps]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| [[attachment:normalmap_127seam.jpg|Media:NormalMap/attachments/normalmap_127seam.jpg&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[BlendingNormalMapsTogether]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| [[Image:NormalMap$nrmlmap_blending_methods_Maps.png}}&lt;br /&gt;
|-&lt;br /&gt;
| The blended normal maps.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by[http://www.ericchadwick.com Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[BacklightingExample]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|  [[Image:NormalMap$tree_front.jpg]] &lt;br /&gt;
|-&lt;br /&gt;
| Tree simulating subsurface scattering (front view).&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by[http://www.linkedin.com/in/ericchadwick Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[ShadersAndSeams]])&amp;gt;&amp;gt;&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|  [[Image:NormalMap$max2010_normalmap_workarounds_thumb.png]] &lt;br /&gt;
|-&lt;br /&gt;
| Viewport methods in 3ds Max 2010.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;[[attachment:max2010_normalmap_workarounds.png|Actual size]]&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[NormalMapCompression]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
Normal maps can take up a lot of memory. Compression can reduce the size of a map to 1/4 of what it was uncompressed, which means you can either increase the resolution or you can use more maps.&lt;br /&gt;
&lt;br /&gt;
Usually the compression method is to throw away the Blue channel, because this can be re-computing at minimal cost in the shader code. Then the bitmap only has to store two color channels, instead of four (red, green, blue, and alpha).&lt;br /&gt;
&lt;br /&gt;
* The article [http://developer.download.nvidia.com/whitepapers/2008/real-time-normal-map-dxt-compression.pdf Real-Time Normal Map DXT Compression] (PDF) from [http://www.idsoftware.com/ id software] and [http://developer.nvidia.com NVIDIA] is an excellent introduction to compression.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;DXT5C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== DXT5nm Compression ===&lt;br /&gt;
DXT5nm is the same file format as DXT5 except before compression the red channel is moved into the alpha channel, the green channel is left as-is, and the red and blue channels are blanked with the same solid color. This re-arranging of the normal map axes is called ''swizzling''.&lt;br /&gt;
&lt;br /&gt;
The Green and Alpha channels are used because in the DXT format they are compressed using somewhat higher bit depths than the Red and Blue channels. Red and Blue have to be filled with the same solid color because DXT uses a compression system that compares differences between the three color channels. If you try to store some kind of texture in Red and/or Blue (specular power, height map, etc.) then the compressor will create more compression artifacts because it has to compare all three channels.&lt;br /&gt;
&lt;br /&gt;
There are some options in the NVIDIA DXT compressor that help reduce the artifacts if you want to add texture to the Red or Blue channels. The artifacts will be greater than if you keep Red and Blue empty, but it might be a tradeoff worth making. Some notes about this on the [http://developer.nvidia.com/forums/index.php?showtopic=1366 NVIDIA Developer Forums].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;DXT1C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== DXT1 Compression ===&lt;br /&gt;
DXT1 is also used sometimes for tangent-space normal maps, because it is half the size of a DXT5. The downside though is that it causes many more compression artifacts, so much so that most people end up not using it. &lt;br /&gt;
&lt;br /&gt;
* The blog post [http://realtimecollisiondetection.net/blog/?p=28#more-28 I like spilled beans!] by [http://realtimecollisiondetection.net/blog/?page_id=2 Christer Ericson] has a section about Capcom's clever use of DXT1 and DXT5.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DCC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3Dc Compression ===&lt;br /&gt;
3Dc compression is also known as BC5 in DirectX 10. It works similar to DXT5nm, because it only stores the X and Y channels. The difference is it stores both the same way as the DXT5 Alpha channel, which is a slightly higher bit depth than DXT5nm's Green channel. 3Dc yields the best results of any listed algorithm for tangent space normal map compression, and requires no extra processing time or unique hardware. See [[3Dc]] for more information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;A8L8C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== [[A8L8]] Compression ===&lt;br /&gt;
The DDS format !A8L8 isn't actually compressed, it's just two 8bit grayscale channels (256 grays each). It does save you from having to store all three color channels. Your shader has to recompute the blue channel for it to work. However, !A8L8 does not actually save any space in texture memory, it is typically converted to a four-channel 32bit texture when it's sent to the card. This format really only helps save disk space.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;L&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Texturing]] [[Category:TextureTypes]] [[Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-28T12:55:38Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Triangulating */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
[[image:triangulation_modo_ohare.jpg|frame|none| When quads are triangulated in [http://www.luxology.com/modo/ Modo], the internal edges are sometimes flipped, which causes shading differences.&amp;lt;br&amp;gt;Image by [http://www.farfarer.com/|James &amp;quot;Talon&amp;quot; O'Hare]]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| [[attachment:normalmap_127seam.jpg|Media:NormalMap/attachments/normalmap_127seam.jpg&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[BlendingNormalMapsTogether]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| [[Image:NormalMap$nrmlmap_blending_methods_Maps.png}}&lt;br /&gt;
|-&lt;br /&gt;
| The blended normal maps.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by[http://www.ericchadwick.com Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[BacklightingExample]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|  [[Image:NormalMap$tree_front.jpg]] &lt;br /&gt;
|-&lt;br /&gt;
| Tree simulating subsurface scattering (front view).&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by[http://www.linkedin.com/in/ericchadwick Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[ShadersAndSeams]])&amp;gt;&amp;gt;&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|  [[Image:NormalMap$max2010_normalmap_workarounds_thumb.png]] &lt;br /&gt;
|-&lt;br /&gt;
| Viewport methods in 3ds Max 2010.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;[[attachment:max2010_normalmap_workarounds.png|Actual size]]&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[NormalMapCompression]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
Normal maps can take up a lot of memory. Compression can reduce the size of a map to 1/4 of what it was uncompressed, which means you can either increase the resolution or you can use more maps.&lt;br /&gt;
&lt;br /&gt;
Usually the compression method is to throw away the Blue channel, because this can be re-computing at minimal cost in the shader code. Then the bitmap only has to store two color channels, instead of four (red, green, blue, and alpha).&lt;br /&gt;
&lt;br /&gt;
* The article [http://developer.download.nvidia.com/whitepapers/2008/real-time-normal-map-dxt-compression.pdf Real-Time Normal Map DXT Compression] (PDF) from [http://www.idsoftware.com/ id software] and [http://developer.nvidia.com NVIDIA] is an excellent introduction to compression.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;DXT5C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== DXT5nm Compression ===&lt;br /&gt;
DXT5nm is the same file format as DXT5 except before compression the red channel is moved into the alpha channel, the green channel is left as-is, and the red and blue channels are blanked with the same solid color. This re-arranging of the normal map axes is called ''swizzling''.&lt;br /&gt;
&lt;br /&gt;
The Green and Alpha channels are used because in the DXT format they are compressed using somewhat higher bit depths than the Red and Blue channels. Red and Blue have to be filled with the same solid color because DXT uses a compression system that compares differences between the three color channels. If you try to store some kind of texture in Red and/or Blue (specular power, height map, etc.) then the compressor will create more compression artifacts because it has to compare all three channels.&lt;br /&gt;
&lt;br /&gt;
There are some options in the NVIDIA DXT compressor that help reduce the artifacts if you want to add texture to the Red or Blue channels. The artifacts will be greater than if you keep Red and Blue empty, but it might be a tradeoff worth making. Some notes about this on the [http://developer.nvidia.com/forums/index.php?showtopic=1366 NVIDIA Developer Forums].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;DXT1C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== DXT1 Compression ===&lt;br /&gt;
DXT1 is also used sometimes for tangent-space normal maps, because it is half the size of a DXT5. The downside though is that it causes many more compression artifacts, so much so that most people end up not using it. &lt;br /&gt;
&lt;br /&gt;
* The blog post [http://realtimecollisiondetection.net/blog/?p=28#more-28 I like spilled beans!] by [http://realtimecollisiondetection.net/blog/?page_id=2 Christer Ericson] has a section about Capcom's clever use of DXT1 and DXT5.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DCC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3Dc Compression ===&lt;br /&gt;
3Dc compression is also known as BC5 in DirectX 10. It works similar to DXT5nm, because it only stores the X and Y channels. The difference is it stores both the same way as the DXT5 Alpha channel, which is a slightly higher bit depth than DXT5nm's Green channel. 3Dc yields the best results of any listed algorithm for tangent space normal map compression, and requires no extra processing time or unique hardware. See [[3Dc]] for more information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;A8L8C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== [[A8L8]] Compression ===&lt;br /&gt;
The DDS format !A8L8 isn't actually compressed, it's just two 8bit grayscale channels (256 grays each). It does save you from having to store all three color channels. Your shader has to recompute the blue channel for it to work. However, !A8L8 does not actually save any space in texture memory, it is typically converted to a four-channel 32bit texture when it's sent to the card. This format really only helps save disk space.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;L&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Texturing]] [[Category:TextureTypes]] [[Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-28T12:53:51Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Solving Wavy Lines */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
[[image:timothy_evison_normalmap_projections.jpg|frame|none|Adjusting the shape of the cage to remove distortion. &amp;lt;br&amp;gt;Image by [http://users.cybercity.dk/~dsl11905/resume/resume.html Timothy &amp;quot;tpe&amp;quot; Evison]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| [[attachment:normalmap_127seam.jpg|Media:NormalMap/attachments/normalmap_127seam.jpg&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[BlendingNormalMapsTogether]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| [[Image:NormalMap$nrmlmap_blending_methods_Maps.png}}&lt;br /&gt;
|-&lt;br /&gt;
| The blended normal maps.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by[http://www.ericchadwick.com Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[BacklightingExample]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|  [[Image:NormalMap$tree_front.jpg]] &lt;br /&gt;
|-&lt;br /&gt;
| Tree simulating subsurface scattering (front view).&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by[http://www.linkedin.com/in/ericchadwick Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[ShadersAndSeams]])&amp;gt;&amp;gt;&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|  [[Image:NormalMap$max2010_normalmap_workarounds_thumb.png]] &lt;br /&gt;
|-&lt;br /&gt;
| Viewport methods in 3ds Max 2010.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;[[attachment:max2010_normalmap_workarounds.png|Actual size]]&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[NormalMapCompression]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
Normal maps can take up a lot of memory. Compression can reduce the size of a map to 1/4 of what it was uncompressed, which means you can either increase the resolution or you can use more maps.&lt;br /&gt;
&lt;br /&gt;
Usually the compression method is to throw away the Blue channel, because this can be re-computing at minimal cost in the shader code. Then the bitmap only has to store two color channels, instead of four (red, green, blue, and alpha).&lt;br /&gt;
&lt;br /&gt;
* The article [http://developer.download.nvidia.com/whitepapers/2008/real-time-normal-map-dxt-compression.pdf Real-Time Normal Map DXT Compression] (PDF) from [http://www.idsoftware.com/ id software] and [http://developer.nvidia.com NVIDIA] is an excellent introduction to compression.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;DXT5C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== DXT5nm Compression ===&lt;br /&gt;
DXT5nm is the same file format as DXT5 except before compression the red channel is moved into the alpha channel, the green channel is left as-is, and the red and blue channels are blanked with the same solid color. This re-arranging of the normal map axes is called ''swizzling''.&lt;br /&gt;
&lt;br /&gt;
The Green and Alpha channels are used because in the DXT format they are compressed using somewhat higher bit depths than the Red and Blue channels. Red and Blue have to be filled with the same solid color because DXT uses a compression system that compares differences between the three color channels. If you try to store some kind of texture in Red and/or Blue (specular power, height map, etc.) then the compressor will create more compression artifacts because it has to compare all three channels.&lt;br /&gt;
&lt;br /&gt;
There are some options in the NVIDIA DXT compressor that help reduce the artifacts if you want to add texture to the Red or Blue channels. The artifacts will be greater than if you keep Red and Blue empty, but it might be a tradeoff worth making. Some notes about this on the [http://developer.nvidia.com/forums/index.php?showtopic=1366 NVIDIA Developer Forums].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;DXT1C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== DXT1 Compression ===&lt;br /&gt;
DXT1 is also used sometimes for tangent-space normal maps, because it is half the size of a DXT5. The downside though is that it causes many more compression artifacts, so much so that most people end up not using it. &lt;br /&gt;
&lt;br /&gt;
* The blog post [http://realtimecollisiondetection.net/blog/?p=28#more-28 I like spilled beans!] by [http://realtimecollisiondetection.net/blog/?page_id=2 Christer Ericson] has a section about Capcom's clever use of DXT1 and DXT5.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DCC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3Dc Compression ===&lt;br /&gt;
3Dc compression is also known as BC5 in DirectX 10. It works similar to DXT5nm, because it only stores the X and Y channels. The difference is it stores both the same way as the DXT5 Alpha channel, which is a slightly higher bit depth than DXT5nm's Green channel. 3Dc yields the best results of any listed algorithm for tangent space normal map compression, and requires no extra processing time or unique hardware. See [[3Dc]] for more information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;A8L8C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== [[A8L8]] Compression ===&lt;br /&gt;
The DDS format !A8L8 isn't actually compressed, it's just two 8bit grayscale channels (256 grays each). It does save you from having to store all three color channels. Your shader has to recompute the blue channel for it to work. However, !A8L8 does not actually save any space in texture memory, it is typically converted to a four-channel 32bit texture when it's sent to the card. This format really only helps save disk space.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;L&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Texturing]] [[Category:TextureTypes]] [[Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-27T23:50:23Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Baking */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| [[attachment:normalmap_127seam.jpg|Media:NormalMap/attachments/normalmap_127seam.jpg&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[BlendingNormalMapsTogether]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| [[Image:NormalMap$nrmlmap_blending_methods_Maps.png}}&lt;br /&gt;
|-&lt;br /&gt;
| The blended normal maps.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by[http://www.ericchadwick.com Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[BacklightingExample]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|  [[Image:NormalMap$tree_front.jpg]] &lt;br /&gt;
|-&lt;br /&gt;
| Tree simulating subsurface scattering (front view).&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by[http://www.linkedin.com/in/ericchadwick Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[ShadersAndSeams]])&amp;gt;&amp;gt;&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|  [[Image:NormalMap$max2010_normalmap_workarounds_thumb.png]] &lt;br /&gt;
|-&lt;br /&gt;
| Viewport methods in 3ds Max 2010.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;[[attachment:max2010_normalmap_workarounds.png|Actual size]]&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[NormalMapCompression]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
Normal maps can take up a lot of memory. Compression can reduce the size of a map to 1/4 of what it was uncompressed, which means you can either increase the resolution or you can use more maps.&lt;br /&gt;
&lt;br /&gt;
Usually the compression method is to throw away the Blue channel, because this can be re-computing at minimal cost in the shader code. Then the bitmap only has to store two color channels, instead of four (red, green, blue, and alpha).&lt;br /&gt;
&lt;br /&gt;
* The article [http://developer.download.nvidia.com/whitepapers/2008/real-time-normal-map-dxt-compression.pdf Real-Time Normal Map DXT Compression] (PDF) from [http://www.idsoftware.com/ id software] and [http://developer.nvidia.com NVIDIA] is an excellent introduction to compression.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;DXT5C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== DXT5nm Compression ===&lt;br /&gt;
DXT5nm is the same file format as DXT5 except before compression the red channel is moved into the alpha channel, the green channel is left as-is, and the red and blue channels are blanked with the same solid color. This re-arranging of the normal map axes is called ''swizzling''.&lt;br /&gt;
&lt;br /&gt;
The Green and Alpha channels are used because in the DXT format they are compressed using somewhat higher bit depths than the Red and Blue channels. Red and Blue have to be filled with the same solid color because DXT uses a compression system that compares differences between the three color channels. If you try to store some kind of texture in Red and/or Blue (specular power, height map, etc.) then the compressor will create more compression artifacts because it has to compare all three channels.&lt;br /&gt;
&lt;br /&gt;
There are some options in the NVIDIA DXT compressor that help reduce the artifacts if you want to add texture to the Red or Blue channels. The artifacts will be greater than if you keep Red and Blue empty, but it might be a tradeoff worth making. Some notes about this on the [http://developer.nvidia.com/forums/index.php?showtopic=1366 NVIDIA Developer Forums].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;DXT1C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== DXT1 Compression ===&lt;br /&gt;
DXT1 is also used sometimes for tangent-space normal maps, because it is half the size of a DXT5. The downside though is that it causes many more compression artifacts, so much so that most people end up not using it. &lt;br /&gt;
&lt;br /&gt;
* The blog post [http://realtimecollisiondetection.net/blog/?p=28#more-28 I like spilled beans!] by [http://realtimecollisiondetection.net/blog/?page_id=2 Christer Ericson] has a section about Capcom's clever use of DXT1 and DXT5.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DCC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3Dc Compression ===&lt;br /&gt;
3Dc compression is also known as BC5 in DirectX 10. It works similar to DXT5nm, because it only stores the X and Y channels. The difference is it stores both the same way as the DXT5 Alpha channel, which is a slightly higher bit depth than DXT5nm's Green channel. 3Dc yields the best results of any listed algorithm for tangent space normal map compression, and requires no extra processing time or unique hardware. See [[3Dc]] for more information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;A8L8C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== [[A8L8]] Compression ===&lt;br /&gt;
The DDS format !A8L8 isn't actually compressed, it's just two 8bit grayscale channels (256 grays each). It does save you from having to store all three color channels. Your shader has to recompute the blue channel for it to work. However, !A8L8 does not actually save any space in texture memory, it is typically converted to a four-channel 32bit texture when it's sent to the card. This format really only helps save disk space.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;L&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Texturing]] [[Category:TextureTypes]] [[Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-27T22:38:48Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Solving Pixel Artifacts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[AntiAliasing]])&amp;gt;&amp;gt;&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| [[attachment:normalmap_127seam.jpg|Media:NormalMap/attachments/normalmap_127seam.jpg&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[BlendingNormalMapsTogether]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| [[Image:NormalMap$nrmlmap_blending_methods_Maps.png}}&lt;br /&gt;
|-&lt;br /&gt;
| The blended normal maps.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by[http://www.ericchadwick.com Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[BacklightingExample]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|  [[Image:NormalMap$tree_front.jpg]] &lt;br /&gt;
|-&lt;br /&gt;
| Tree simulating subsurface scattering (front view).&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by[http://www.linkedin.com/in/ericchadwick Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[ShadersAndSeams]])&amp;gt;&amp;gt;&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|  [[Image:NormalMap$max2010_normalmap_workarounds_thumb.png]] &lt;br /&gt;
|-&lt;br /&gt;
| Viewport methods in 3ds Max 2010.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;[[attachment:max2010_normalmap_workarounds.png|Actual size]]&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[NormalMapCompression]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
Normal maps can take up a lot of memory. Compression can reduce the size of a map to 1/4 of what it was uncompressed, which means you can either increase the resolution or you can use more maps.&lt;br /&gt;
&lt;br /&gt;
Usually the compression method is to throw away the Blue channel, because this can be re-computing at minimal cost in the shader code. Then the bitmap only has to store two color channels, instead of four (red, green, blue, and alpha).&lt;br /&gt;
&lt;br /&gt;
* The article [http://developer.download.nvidia.com/whitepapers/2008/real-time-normal-map-dxt-compression.pdf Real-Time Normal Map DXT Compression] (PDF) from [http://www.idsoftware.com/ id software] and [http://developer.nvidia.com NVIDIA] is an excellent introduction to compression.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;DXT5C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== DXT5nm Compression ===&lt;br /&gt;
DXT5nm is the same file format as DXT5 except before compression the red channel is moved into the alpha channel, the green channel is left as-is, and the red and blue channels are blanked with the same solid color. This re-arranging of the normal map axes is called ''swizzling''.&lt;br /&gt;
&lt;br /&gt;
The Green and Alpha channels are used because in the DXT format they are compressed using somewhat higher bit depths than the Red and Blue channels. Red and Blue have to be filled with the same solid color because DXT uses a compression system that compares differences between the three color channels. If you try to store some kind of texture in Red and/or Blue (specular power, height map, etc.) then the compressor will create more compression artifacts because it has to compare all three channels.&lt;br /&gt;
&lt;br /&gt;
There are some options in the NVIDIA DXT compressor that help reduce the artifacts if you want to add texture to the Red or Blue channels. The artifacts will be greater than if you keep Red and Blue empty, but it might be a tradeoff worth making. Some notes about this on the [http://developer.nvidia.com/forums/index.php?showtopic=1366 NVIDIA Developer Forums].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;DXT1C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== DXT1 Compression ===&lt;br /&gt;
DXT1 is also used sometimes for tangent-space normal maps, because it is half the size of a DXT5. The downside though is that it causes many more compression artifacts, so much so that most people end up not using it. &lt;br /&gt;
&lt;br /&gt;
* The blog post [http://realtimecollisiondetection.net/blog/?p=28#more-28 I like spilled beans!] by [http://realtimecollisiondetection.net/blog/?page_id=2 Christer Ericson] has a section about Capcom's clever use of DXT1 and DXT5.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DCC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3Dc Compression ===&lt;br /&gt;
3Dc compression is also known as BC5 in DirectX 10. It works similar to DXT5nm, because it only stores the X and Y channels. The difference is it stores both the same way as the DXT5 Alpha channel, which is a slightly higher bit depth than DXT5nm's Green channel. 3Dc yields the best results of any listed algorithm for tangent space normal map compression, and requires no extra processing time or unique hardware. See [[3Dc]] for more information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;A8L8C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== [[A8L8]] Compression ===&lt;br /&gt;
The DDS format !A8L8 isn't actually compressed, it's just two 8bit grayscale channels (256 grays each). It does save you from having to store all three color channels. Your shader has to recompute the blue channel for it to work. However, !A8L8 does not actually save any space in texture memory, it is typically converted to a four-channel 32bit texture when it's sent to the card. This format really only helps save disk space.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;L&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Texturing]] [[Category:TextureTypes]] [[Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-27T22:36:38Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Edge Padding */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[AntiAliasing]])&amp;gt;&amp;gt;&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[SolvingWavyLines]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| [[attachment:normalmap_127seam.jpg|Media:NormalMap/attachments/normalmap_127seam.jpg&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[BlendingNormalMapsTogether]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| [[Image:NormalMap$nrmlmap_blending_methods_Maps.png}}&lt;br /&gt;
|-&lt;br /&gt;
| The blended normal maps.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by[http://www.ericchadwick.com Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[BacklightingExample]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|  [[Image:NormalMap$tree_front.jpg]] &lt;br /&gt;
|-&lt;br /&gt;
| Tree simulating subsurface scattering (front view).&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by[http://www.linkedin.com/in/ericchadwick Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[ShadersAndSeams]])&amp;gt;&amp;gt;&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|  [[Image:NormalMap$max2010_normalmap_workarounds_thumb.png]] &lt;br /&gt;
|-&lt;br /&gt;
| Viewport methods in 3ds Max 2010.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;[[attachment:max2010_normalmap_workarounds.png|Actual size]]&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[NormalMapCompression]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
Normal maps can take up a lot of memory. Compression can reduce the size of a map to 1/4 of what it was uncompressed, which means you can either increase the resolution or you can use more maps.&lt;br /&gt;
&lt;br /&gt;
Usually the compression method is to throw away the Blue channel, because this can be re-computing at minimal cost in the shader code. Then the bitmap only has to store two color channels, instead of four (red, green, blue, and alpha).&lt;br /&gt;
&lt;br /&gt;
* The article [http://developer.download.nvidia.com/whitepapers/2008/real-time-normal-map-dxt-compression.pdf Real-Time Normal Map DXT Compression] (PDF) from [http://www.idsoftware.com/ id software] and [http://developer.nvidia.com NVIDIA] is an excellent introduction to compression.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;DXT5C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== DXT5nm Compression ===&lt;br /&gt;
DXT5nm is the same file format as DXT5 except before compression the red channel is moved into the alpha channel, the green channel is left as-is, and the red and blue channels are blanked with the same solid color. This re-arranging of the normal map axes is called ''swizzling''.&lt;br /&gt;
&lt;br /&gt;
The Green and Alpha channels are used because in the DXT format they are compressed using somewhat higher bit depths than the Red and Blue channels. Red and Blue have to be filled with the same solid color because DXT uses a compression system that compares differences between the three color channels. If you try to store some kind of texture in Red and/or Blue (specular power, height map, etc.) then the compressor will create more compression artifacts because it has to compare all three channels.&lt;br /&gt;
&lt;br /&gt;
There are some options in the NVIDIA DXT compressor that help reduce the artifacts if you want to add texture to the Red or Blue channels. The artifacts will be greater than if you keep Red and Blue empty, but it might be a tradeoff worth making. Some notes about this on the [http://developer.nvidia.com/forums/index.php?showtopic=1366 NVIDIA Developer Forums].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;DXT1C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== DXT1 Compression ===&lt;br /&gt;
DXT1 is also used sometimes for tangent-space normal maps, because it is half the size of a DXT5. The downside though is that it causes many more compression artifacts, so much so that most people end up not using it. &lt;br /&gt;
&lt;br /&gt;
* The blog post [http://realtimecollisiondetection.net/blog/?p=28#more-28 I like spilled beans!] by [http://realtimecollisiondetection.net/blog/?page_id=2 Christer Ericson] has a section about Capcom's clever use of DXT1 and DXT5.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DCC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3Dc Compression ===&lt;br /&gt;
3Dc compression is also known as BC5 in DirectX 10. It works similar to DXT5nm, because it only stores the X and Y channels. The difference is it stores both the same way as the DXT5 Alpha channel, which is a slightly higher bit depth than DXT5nm's Green channel. 3Dc yields the best results of any listed algorithm for tangent space normal map compression, and requires no extra processing time or unique hardware. See [[3Dc]] for more information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;A8L8C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== [[A8L8]] Compression ===&lt;br /&gt;
The DDS format !A8L8 isn't actually compressed, it's just two 8bit grayscale channels (256 grays each). It does save you from having to store all three color channels. Your shader has to recompute the blue channel for it to work. However, !A8L8 does not actually save any space in texture memory, it is typically converted to a four-channel 32bit texture when it's sent to the card. This format really only helps save disk space.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;L&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Texturing]] [[Category:TextureTypes]] [[Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-27T22:35:39Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Edge Padding */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[AntiAliasing]])&amp;gt;&amp;gt;&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[#Edge_padding |Edge Padding]], this will create shading seams on the UV borders.&lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[SolvingWavyLines]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| [[attachment:normalmap_127seam.jpg|Media:NormalMap/attachments/normalmap_127seam.jpg&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[BlendingNormalMapsTogether]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| [[Image:NormalMap$nrmlmap_blending_methods_Maps.png}}&lt;br /&gt;
|-&lt;br /&gt;
| The blended normal maps.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by[http://www.ericchadwick.com Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[BacklightingExample]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|  [[Image:NormalMap$tree_front.jpg]] &lt;br /&gt;
|-&lt;br /&gt;
| Tree simulating subsurface scattering (front view).&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by[http://www.linkedin.com/in/ericchadwick Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[ShadersAndSeams]])&amp;gt;&amp;gt;&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|  [[Image:NormalMap$max2010_normalmap_workarounds_thumb.png]] &lt;br /&gt;
|-&lt;br /&gt;
| Viewport methods in 3ds Max 2010.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;[[attachment:max2010_normalmap_workarounds.png|Actual size]]&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[NormalMapCompression]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
Normal maps can take up a lot of memory. Compression can reduce the size of a map to 1/4 of what it was uncompressed, which means you can either increase the resolution or you can use more maps.&lt;br /&gt;
&lt;br /&gt;
Usually the compression method is to throw away the Blue channel, because this can be re-computing at minimal cost in the shader code. Then the bitmap only has to store two color channels, instead of four (red, green, blue, and alpha).&lt;br /&gt;
&lt;br /&gt;
* The article [http://developer.download.nvidia.com/whitepapers/2008/real-time-normal-map-dxt-compression.pdf Real-Time Normal Map DXT Compression] (PDF) from [http://www.idsoftware.com/ id software] and [http://developer.nvidia.com NVIDIA] is an excellent introduction to compression.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;DXT5C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== DXT5nm Compression ===&lt;br /&gt;
DXT5nm is the same file format as DXT5 except before compression the red channel is moved into the alpha channel, the green channel is left as-is, and the red and blue channels are blanked with the same solid color. This re-arranging of the normal map axes is called ''swizzling''.&lt;br /&gt;
&lt;br /&gt;
The Green and Alpha channels are used because in the DXT format they are compressed using somewhat higher bit depths than the Red and Blue channels. Red and Blue have to be filled with the same solid color because DXT uses a compression system that compares differences between the three color channels. If you try to store some kind of texture in Red and/or Blue (specular power, height map, etc.) then the compressor will create more compression artifacts because it has to compare all three channels.&lt;br /&gt;
&lt;br /&gt;
There are some options in the NVIDIA DXT compressor that help reduce the artifacts if you want to add texture to the Red or Blue channels. The artifacts will be greater than if you keep Red and Blue empty, but it might be a tradeoff worth making. Some notes about this on the [http://developer.nvidia.com/forums/index.php?showtopic=1366 NVIDIA Developer Forums].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;DXT1C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== DXT1 Compression ===&lt;br /&gt;
DXT1 is also used sometimes for tangent-space normal maps, because it is half the size of a DXT5. The downside though is that it causes many more compression artifacts, so much so that most people end up not using it. &lt;br /&gt;
&lt;br /&gt;
* The blog post [http://realtimecollisiondetection.net/blog/?p=28#more-28 I like spilled beans!] by [http://realtimecollisiondetection.net/blog/?page_id=2 Christer Ericson] has a section about Capcom's clever use of DXT1 and DXT5.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DCC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3Dc Compression ===&lt;br /&gt;
3Dc compression is also known as BC5 in DirectX 10. It works similar to DXT5nm, because it only stores the X and Y channels. The difference is it stores both the same way as the DXT5 Alpha channel, which is a slightly higher bit depth than DXT5nm's Green channel. 3Dc yields the best results of any listed algorithm for tangent space normal map compression, and requires no extra processing time or unique hardware. See [[3Dc]] for more information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;A8L8C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== [[A8L8]] Compression ===&lt;br /&gt;
The DDS format !A8L8 isn't actually compressed, it's just two 8bit grayscale channels (256 grays each). It does save you from having to store all three color channels. Your shader has to recompute the blue channel for it to work. However, !A8L8 does not actually save any space in texture memory, it is typically converted to a four-channel 32bit texture when it's sent to the card. This format really only helps save disk space.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;L&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Texturing]] [[Category:TextureTypes]] [[Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-27T22:34:06Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Reset Transforms */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[AntiAliasing]])&amp;gt;&amp;gt;&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge Padding]], this will create shading seams on the UV borders. &lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[SolvingWavyLines]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| [[attachment:normalmap_127seam.jpg|Media:NormalMap/attachments/normalmap_127seam.jpg&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[BlendingNormalMapsTogether]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| [[Image:NormalMap$nrmlmap_blending_methods_Maps.png}}&lt;br /&gt;
|-&lt;br /&gt;
| The blended normal maps.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by[http://www.ericchadwick.com Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[BacklightingExample]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|  [[Image:NormalMap$tree_front.jpg]] &lt;br /&gt;
|-&lt;br /&gt;
| Tree simulating subsurface scattering (front view).&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by[http://www.linkedin.com/in/ericchadwick Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[ShadersAndSeams]])&amp;gt;&amp;gt;&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|  [[Image:NormalMap$max2010_normalmap_workarounds_thumb.png]] &lt;br /&gt;
|-&lt;br /&gt;
| Viewport methods in 3ds Max 2010.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;[[attachment:max2010_normalmap_workarounds.png|Actual size]]&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[NormalMapCompression]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
Normal maps can take up a lot of memory. Compression can reduce the size of a map to 1/4 of what it was uncompressed, which means you can either increase the resolution or you can use more maps.&lt;br /&gt;
&lt;br /&gt;
Usually the compression method is to throw away the Blue channel, because this can be re-computing at minimal cost in the shader code. Then the bitmap only has to store two color channels, instead of four (red, green, blue, and alpha).&lt;br /&gt;
&lt;br /&gt;
* The article [http://developer.download.nvidia.com/whitepapers/2008/real-time-normal-map-dxt-compression.pdf Real-Time Normal Map DXT Compression] (PDF) from [http://www.idsoftware.com/ id software] and [http://developer.nvidia.com NVIDIA] is an excellent introduction to compression.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;DXT5C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== DXT5nm Compression ===&lt;br /&gt;
DXT5nm is the same file format as DXT5 except before compression the red channel is moved into the alpha channel, the green channel is left as-is, and the red and blue channels are blanked with the same solid color. This re-arranging of the normal map axes is called ''swizzling''.&lt;br /&gt;
&lt;br /&gt;
The Green and Alpha channels are used because in the DXT format they are compressed using somewhat higher bit depths than the Red and Blue channels. Red and Blue have to be filled with the same solid color because DXT uses a compression system that compares differences between the three color channels. If you try to store some kind of texture in Red and/or Blue (specular power, height map, etc.) then the compressor will create more compression artifacts because it has to compare all three channels.&lt;br /&gt;
&lt;br /&gt;
There are some options in the NVIDIA DXT compressor that help reduce the artifacts if you want to add texture to the Red or Blue channels. The artifacts will be greater than if you keep Red and Blue empty, but it might be a tradeoff worth making. Some notes about this on the [http://developer.nvidia.com/forums/index.php?showtopic=1366 NVIDIA Developer Forums].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;DXT1C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== DXT1 Compression ===&lt;br /&gt;
DXT1 is also used sometimes for tangent-space normal maps, because it is half the size of a DXT5. The downside though is that it causes many more compression artifacts, so much so that most people end up not using it. &lt;br /&gt;
&lt;br /&gt;
* The blog post [http://realtimecollisiondetection.net/blog/?p=28#more-28 I like spilled beans!] by [http://realtimecollisiondetection.net/blog/?page_id=2 Christer Ericson] has a section about Capcom's clever use of DXT1 and DXT5.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DCC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3Dc Compression ===&lt;br /&gt;
3Dc compression is also known as BC5 in DirectX 10. It works similar to DXT5nm, because it only stores the X and Y channels. The difference is it stores both the same way as the DXT5 Alpha channel, which is a slightly higher bit depth than DXT5nm's Green channel. 3Dc yields the best results of any listed algorithm for tangent space normal map compression, and requires no extra processing time or unique hardware. See [[3Dc]] for more information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;A8L8C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== [[A8L8]] Compression ===&lt;br /&gt;
The DDS format !A8L8 isn't actually compressed, it's just two 8bit grayscale channels (256 grays each). It does save you from having to store all three color channels. Your shader has to recompute the blue channel for it to work. However, !A8L8 does not actually save any space in texture memory, it is typically converted to a four-channel 32bit texture when it's sent to the card. This format really only helps save disk space.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;L&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Texturing]] [[Category:TextureTypes]] [[Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-27T22:33:43Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Solving Pixel Artifacts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[AntiAliasing]])&amp;gt;&amp;gt;&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge Padding]], this will create shading seams on the UV borders. &lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[SolvingIntersections]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
[[image:filterMaps_artifact.jpg|frame|none|Random pixel artifacts in the bake. &amp;lt;br&amp;gt;Image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]]]&lt;br /&gt;
&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[SolvingWavyLines]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| [[attachment:normalmap_127seam.jpg|Media:NormalMap/attachments/normalmap_127seam.jpg&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[BlendingNormalMapsTogether]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| [[Image:NormalMap$nrmlmap_blending_methods_Maps.png}}&lt;br /&gt;
|-&lt;br /&gt;
| The blended normal maps.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by[http://www.ericchadwick.com Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[BacklightingExample]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|  [[Image:NormalMap$tree_front.jpg]] &lt;br /&gt;
|-&lt;br /&gt;
| Tree simulating subsurface scattering (front view).&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by[http://www.linkedin.com/in/ericchadwick Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[ShadersAndSeams]])&amp;gt;&amp;gt;&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|  [[Image:NormalMap$max2010_normalmap_workarounds_thumb.png]] &lt;br /&gt;
|-&lt;br /&gt;
| Viewport methods in 3ds Max 2010.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;[[attachment:max2010_normalmap_workarounds.png|Actual size]]&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[NormalMapCompression]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
Normal maps can take up a lot of memory. Compression can reduce the size of a map to 1/4 of what it was uncompressed, which means you can either increase the resolution or you can use more maps.&lt;br /&gt;
&lt;br /&gt;
Usually the compression method is to throw away the Blue channel, because this can be re-computing at minimal cost in the shader code. Then the bitmap only has to store two color channels, instead of four (red, green, blue, and alpha).&lt;br /&gt;
&lt;br /&gt;
* The article [http://developer.download.nvidia.com/whitepapers/2008/real-time-normal-map-dxt-compression.pdf Real-Time Normal Map DXT Compression] (PDF) from [http://www.idsoftware.com/ id software] and [http://developer.nvidia.com NVIDIA] is an excellent introduction to compression.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;DXT5C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== DXT5nm Compression ===&lt;br /&gt;
DXT5nm is the same file format as DXT5 except before compression the red channel is moved into the alpha channel, the green channel is left as-is, and the red and blue channels are blanked with the same solid color. This re-arranging of the normal map axes is called ''swizzling''.&lt;br /&gt;
&lt;br /&gt;
The Green and Alpha channels are used because in the DXT format they are compressed using somewhat higher bit depths than the Red and Blue channels. Red and Blue have to be filled with the same solid color because DXT uses a compression system that compares differences between the three color channels. If you try to store some kind of texture in Red and/or Blue (specular power, height map, etc.) then the compressor will create more compression artifacts because it has to compare all three channels.&lt;br /&gt;
&lt;br /&gt;
There are some options in the NVIDIA DXT compressor that help reduce the artifacts if you want to add texture to the Red or Blue channels. The artifacts will be greater than if you keep Red and Blue empty, but it might be a tradeoff worth making. Some notes about this on the [http://developer.nvidia.com/forums/index.php?showtopic=1366 NVIDIA Developer Forums].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;DXT1C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== DXT1 Compression ===&lt;br /&gt;
DXT1 is also used sometimes for tangent-space normal maps, because it is half the size of a DXT5. The downside though is that it causes many more compression artifacts, so much so that most people end up not using it. &lt;br /&gt;
&lt;br /&gt;
* The blog post [http://realtimecollisiondetection.net/blog/?p=28#more-28 I like spilled beans!] by [http://realtimecollisiondetection.net/blog/?page_id=2 Christer Ericson] has a section about Capcom's clever use of DXT1 and DXT5.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DCC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3Dc Compression ===&lt;br /&gt;
3Dc compression is also known as BC5 in DirectX 10. It works similar to DXT5nm, because it only stores the X and Y channels. The difference is it stores both the same way as the DXT5 Alpha channel, which is a slightly higher bit depth than DXT5nm's Green channel. 3Dc yields the best results of any listed algorithm for tangent space normal map compression, and requires no extra processing time or unique hardware. See [[3Dc]] for more information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;A8L8C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== [[A8L8]] Compression ===&lt;br /&gt;
The DDS format !A8L8 isn't actually compressed, it's just two 8bit grayscale channels (256 grays each). It does save you from having to store all three color channels. Your shader has to recompute the blue channel for it to work. However, !A8L8 does not actually save any space in texture memory, it is typically converted to a four-channel 32bit texture when it's sent to the card. This format really only helps save disk space.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;L&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Texturing]] [[Category:TextureTypes]] [[Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-27T22:32:43Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Solving Intersections */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[AntiAliasing]])&amp;gt;&amp;gt;&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge Padding]], this will create shading seams on the UV borders. &lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[SolvingIntersections]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[SolvingWavyLines]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| [[attachment:normalmap_127seam.jpg|Media:NormalMap/attachments/normalmap_127seam.jpg&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[BlendingNormalMapsTogether]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| [[Image:NormalMap$nrmlmap_blending_methods_Maps.png}}&lt;br /&gt;
|-&lt;br /&gt;
| The blended normal maps.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by[http://www.ericchadwick.com Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[BacklightingExample]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|  [[Image:NormalMap$tree_front.jpg]] &lt;br /&gt;
|-&lt;br /&gt;
| Tree simulating subsurface scattering (front view).&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by[http://www.linkedin.com/in/ericchadwick Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[ShadersAndSeams]])&amp;gt;&amp;gt;&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|  [[Image:NormalMap$max2010_normalmap_workarounds_thumb.png]] &lt;br /&gt;
|-&lt;br /&gt;
| Viewport methods in 3ds Max 2010.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;[[attachment:max2010_normalmap_workarounds.png|Actual size]]&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[NormalMapCompression]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
Normal maps can take up a lot of memory. Compression can reduce the size of a map to 1/4 of what it was uncompressed, which means you can either increase the resolution or you can use more maps.&lt;br /&gt;
&lt;br /&gt;
Usually the compression method is to throw away the Blue channel, because this can be re-computing at minimal cost in the shader code. Then the bitmap only has to store two color channels, instead of four (red, green, blue, and alpha).&lt;br /&gt;
&lt;br /&gt;
* The article [http://developer.download.nvidia.com/whitepapers/2008/real-time-normal-map-dxt-compression.pdf Real-Time Normal Map DXT Compression] (PDF) from [http://www.idsoftware.com/ id software] and [http://developer.nvidia.com NVIDIA] is an excellent introduction to compression.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;DXT5C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== DXT5nm Compression ===&lt;br /&gt;
DXT5nm is the same file format as DXT5 except before compression the red channel is moved into the alpha channel, the green channel is left as-is, and the red and blue channels are blanked with the same solid color. This re-arranging of the normal map axes is called ''swizzling''.&lt;br /&gt;
&lt;br /&gt;
The Green and Alpha channels are used because in the DXT format they are compressed using somewhat higher bit depths than the Red and Blue channels. Red and Blue have to be filled with the same solid color because DXT uses a compression system that compares differences between the three color channels. If you try to store some kind of texture in Red and/or Blue (specular power, height map, etc.) then the compressor will create more compression artifacts because it has to compare all three channels.&lt;br /&gt;
&lt;br /&gt;
There are some options in the NVIDIA DXT compressor that help reduce the artifacts if you want to add texture to the Red or Blue channels. The artifacts will be greater than if you keep Red and Blue empty, but it might be a tradeoff worth making. Some notes about this on the [http://developer.nvidia.com/forums/index.php?showtopic=1366 NVIDIA Developer Forums].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;DXT1C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== DXT1 Compression ===&lt;br /&gt;
DXT1 is also used sometimes for tangent-space normal maps, because it is half the size of a DXT5. The downside though is that it causes many more compression artifacts, so much so that most people end up not using it. &lt;br /&gt;
&lt;br /&gt;
* The blog post [http://realtimecollisiondetection.net/blog/?p=28#more-28 I like spilled beans!] by [http://realtimecollisiondetection.net/blog/?page_id=2 Christer Ericson] has a section about Capcom's clever use of DXT1 and DXT5.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DCC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3Dc Compression ===&lt;br /&gt;
3Dc compression is also known as BC5 in DirectX 10. It works similar to DXT5nm, because it only stores the X and Y channels. The difference is it stores both the same way as the DXT5 Alpha channel, which is a slightly higher bit depth than DXT5nm's Green channel. 3Dc yields the best results of any listed algorithm for tangent space normal map compression, and requires no extra processing time or unique hardware. See [[3Dc]] for more information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;A8L8C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== [[A8L8]] Compression ===&lt;br /&gt;
The DDS format !A8L8 isn't actually compressed, it's just two 8bit grayscale channels (256 grays each). It does save you from having to store all three color channels. Your shader has to recompute the blue channel for it to work. However, !A8L8 does not actually save any space in texture memory, it is typically converted to a four-channel 32bit texture when it's sent to the card. This format really only helps save disk space.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;L&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Texturing]] [[Category:TextureTypes]] [[Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	<entry>
		<id>http://wiki.polycount.com/wiki/Normal_map</id>
		<title>Normal map</title>
		<link rel="alternate" type="text/html" href="http://wiki.polycount.com/wiki/Normal_map"/>
				<updated>2014-11-27T22:30:23Z</updated>
		
		<summary type="html">&lt;p&gt;Noors: /* Baking Transparency */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- ## page was renamed from Normal Map --&amp;gt;&lt;br /&gt;
= Normal Map =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WhatIsANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;WIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== What is a Normal Map? ==&lt;br /&gt;
A Normal Map is usually used to fake high-res geometry detail when it's mapped onto a low-res mesh. The pixels of the normal map each store a ''normal'', a vector that describes the surface slope of the original high-res mesh at that point. The red, green, and blue channels of the normal map are used to control the direction of each pixel's normal. &lt;br /&gt;
&lt;br /&gt;
When a normal map is applied to a low-poly mesh, the texture pixels control the direction each of the pixels on the low-poly mesh will be facing in 3D space, creating the illusion of more surface detail or better curvature. However, the silhouette of the model doesn't change. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;&amp;gt;&lt;br /&gt;
Whatif_normalmap_mapped2.jpg|A model with a normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_low.jpg|The model without its normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
Whatif_normalmap_high.jpg|The high-resolution model used to create the normal map.&amp;lt;br&amp;gt;Image by [http://www.jameskuart.com/ James Ku].&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Tangent-Space vs. Object-Space==&lt;br /&gt;
&lt;br /&gt;
Normal maps can be made in either of two basic flavors: tangent-space or object-space. Object-space is also called local-space or model-space, same thing. World-space is basically the same as object-space, except it requires the model to remain in its original orientation, neither rotating nor deforming, so it's almost never used.&lt;br /&gt;
&lt;br /&gt;
===Tangent-space normal map===&lt;br /&gt;
[[image:normalmap_tangentspace.jpg|frame|none|A tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Predominantly-blue colors. Object can rotate and deform. Good for deforming meshes, like characters, animals, flags, etc.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Maps can be reused easily, like on differently-shaped meshes.&lt;br /&gt;
* Maps can be tiled and mirrored easily, though some games might not support mirroring very well.&lt;br /&gt;
* Easier to overlay painted details.&lt;br /&gt;
* Easier to use image compression.&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* More difficult to avoid smoothing problems from the low-poly vertex normals (see Smoothing Groups and Hard Edges).&lt;br /&gt;
* Slightly slower performance than an object-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
===Object-space normal map===&lt;br /&gt;
[[image:normalmap_worldspace.jpg|frame|none|An object-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
Rainbow colors. Objects can rotate, but usually shouldn't be deformed, unless the shader has been modified to support deformation.&lt;br /&gt;
&lt;br /&gt;
Pros:&lt;br /&gt;
* Easier to generate high-quality curvature because it completely ignores the crude smoothing of the low-poly vertex normals.&lt;br /&gt;
* Slightly better performance than a tangent-space map (but not by much).&lt;br /&gt;
&lt;br /&gt;
Cons:&lt;br /&gt;
* Can't easily reuse maps, different mesh shapes require unique maps.&lt;br /&gt;
* Difficult to tile properly, and mirroring requires specific shader support.&lt;br /&gt;
* Harder to overlay painted details because the base colors vary across the surface of the mesh. Painted details must be converted into Object Space to be combined properly with the OS map.&lt;br /&gt;
* They don't compress very well, since the blue channel can't be recreated in the shader like with tangent-space maps. Also the three color channels contain very different data which doesn't compress well, creating many artifacts. Using a half-resolution object-space map is one option. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;br clear=&amp;quot;all&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Converting Between Spaces ===&lt;br /&gt;
Normal maps can be converted between tangent space and object space, in order to use them with different blending tools and shaders, which require one type or the other.&lt;br /&gt;
&lt;br /&gt;
[http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] created a tool called [http://boards.polycount.net/showthread.php?p=1072599#post1072599 NSpace] that converts an object-space normal map into a tangent-space map, which then works seamlessly in the Max viewport. He converts the map by using the same tangent basis that 3ds Max uses for its hardware shader. To see the results, load the converted map via the ''Normal Bump'' map and enable &amp;quot;Show Hardware Map in Viewport&amp;quot;. [http://gameartist.nl/ Osman &amp;quot;osman&amp;quot; Tsjardiwal] created a GUI for NSpace, you can [http://boards.polycount.net/showthread.php?p=1075143#post1075143 download it here], just put it in the same folder as the NSpace exe and run it. Diogo has further [http://boards.polycount.net/showthread.php?p=1074160#post1074160 plans for the tool] as well.&lt;br /&gt;
&lt;br /&gt;
[[File:NSpace_Gui_osman.png|frame|none|NSpace interface. &amp;lt;br&amp;gt;Image by [http://diogo.codingcorner.net Diogo &amp;quot;fozi&amp;quot; Teixeira] and [http://gameartist.nl Osman &amp;quot;osman&amp;quot; Tsjardiwal]]]&lt;br /&gt;
&lt;br /&gt;
[http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson] said: &amp;quot;[8Monkey Labs has] a tool that lets you load up your reference mesh and object space map. Then load up your tangent normals, and adjust some sliders for things like tile and amount. We need to load up a mesh to know how to correctly orient the tangent normals or else things will come out upside down or reverse etc. It mostly works, but it tends to &amp;quot;bend&amp;quot; the resulting normals, so you gotta split the mesh up into some smoothing groups before you run it, and then I usually will just composite this &amp;quot;combo&amp;quot; texture over my orig map in Photoshop.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RGBC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;RGBChannels&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== RGB Channels ==&lt;br /&gt;
Shaders can use different techniques to render tangent-space normal maps, but the normal map directions are usually consistent within a game. Usually the red channel of a tangent-space normal map stores the X axis (pointing the normals predominantly leftwards or rightwards), the green channel stores the Y axis (pointing the normals predominantly upwards or downwards), and the blue channel stores the Z axis (pointing the normals outwards away from the surface).&lt;br /&gt;
&lt;br /&gt;
[[image:tangentspace_rgb.jpg|frame|none|The red, green, and blue channels of a tangent-space normal map. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you see lighting coming from the wrong angle when you're looking at your normal-mapped model, and the model is using a tangent-space normal map, the normal map shader might be expecting the red or green channel (or both) to point in the opposite direction. To fix this either change the shader, or simply invert the appropriate color channels in an image editor, so that the black pixels become white and the white pixels become black.&lt;br /&gt;
&lt;br /&gt;
Some shaders expect the color channels to be swapped or re-arranged to work with a particular [[#NormalMapCompression|compression format]]. For example the DXT5_nm format usually expects the X axis to be in the alpha channel, the Y axis to be in the green channel, and the red and blue channels to be empty.&lt;br /&gt;
&lt;br /&gt;
== Tangent Basis ==&lt;br /&gt;
[[#TangentSpaceVsObjectSpace|Tangent-space]] normal maps use a special kind of vertex data called the ''tangent basis''. This is similar to UV coordinates except it provides directionality across the surface, it forms a surface-relative coordinate system for the per-pixel normals stored in the normal map. &lt;br /&gt;
&lt;br /&gt;
Light rays are in world space, but the normals stored in the normal map are in tangent space. When a normal-mapped model is being rendered, the light rays must be converted from world space into tangent space, using the tangent basis to get there. At that point the incoming light rays are compared against the directions of the normals in the normal map, and this determines how much each pixel of the mesh is going to be lit. Alternatively, instead of converting the light rays some shaders will convert the normals in the normal map from tangent space into world space. Then those world-space normals are compared against the light rays, and the model is lit appropriately. The method depends on who wrote the shader, but the end result is the same.&lt;br /&gt;
&lt;br /&gt;
Unfortunately for artists, there are many different ways to calculate the tangent basis: [http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping 3ds Max], [http://download.autodesk.com/us/maya/2011help/index.html?url=./files/Appendix_A_Tangent_and_binormal_vectors.htm,topicNumber=d0e227193 Maya], [http://www.codesampler.com/dx9src/dx9src_4.htm#dx9_dot3_bump_mapping DirectX 9], [http://developer.nvidia.com/object/NVMeshMender.html NVMeshMender], [http://www.terathon.com/code/tangent.html Eric Lengyel], a custom solution, etc. This means a normal map baked in one application probably won't shade correctly in another. Artists must do some testing with different [[#T|baking tools]] to find which works best with their output. When the renderer (or game engine) renders your game model, [[#ShadersAndSeams|the shader]] must use the same tangent basis as the normal map baker, otherwise you'll get incorrect lighting, especially across the seams between UV shells.&lt;br /&gt;
&lt;br /&gt;
The [http://www.xnormal.net/ xNormal] SDK supports custom tangent basis methods. When a programmer uses it to implement their renderer's own tangent basis, artists can then use Xnormal to bake normal maps that will match their renderer perfectly.&lt;br /&gt;
&lt;br /&gt;
The [[#UVC|UVs]] and the [[#SGAHE|vertex normals]] on the low-res mesh directly influence the coloring of a [[#TSNM|tangent-space]] normal map when it is baked. Each tangent basis vertex is a combination of three things: the mesh vertex's normal (influenced by smoothing), the vertex's tangent (usually derived from the V texture coordinate), and the vertex's bitangent (derived in code, also called the binormal). These three vectors create an axis for each vertex, giving it a specific orientation in the tangent space. These axes are used to properly transform the incoming lighting from world space into tangent space, so your normal-mapped model will be lit correctly.&lt;br /&gt;
&lt;br /&gt;
When a triangle's vertex normals are pointing straight out, and a pixel in the normal map is neutral blue (128,128,255) this means that pixel's normal will be pointing straight out from the surface of the low-poly mesh. When that pixel normal is tilted towards the left or the right in the tangent coordinate space, it will get either more or less red color, depending on whether the normal map is set to store the X axis as either a positive or a negative value. Same goes for when the normal is tilted up or down in tangent space, it will either get more or less green color. If the vertex normals aren't exactly perpendicular to the triangle, the normal map pixels will be tinted away from neutral blue as well. The vertex normals and the pixel normals in the normal map are combined together to create the final per-pixel surface normals.&lt;br /&gt;
&lt;br /&gt;
[[#SAS|Shaders]] are written to use a particular direction or &amp;quot;handedness&amp;quot; for the X and Y axes in a normal map. Most apps tend to prefer +X (red facing right) and +Y (green facing up), while others like 3ds Max prefer +X and -Y. This is why you often need to invert the green channel of a normal map to get it to render correctly in this or that app... the shader is expecting a particular handedness.&lt;br /&gt;
&lt;br /&gt;
[[image:tangentseams.jpg|frame|none|When shared edges are at different angles in UV space, different colors will show up&lt;br /&gt;
along the seam. The tangent basis uses these colors to light the model properly. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
When you look at a tangent-space normal map for a character, you typically see different colors along the UV seams. This is because the UV shells are often oriented at different angles on the mesh, a necessary evil when translating the 3D mesh into 2D textures. The body might be mapped with a vertical shell, and the arm mapped with a horizontal one. This requires the normals in the normal map to be twisted for the different orientations of those UV shells. The UVs are twisted, so the normals must be twisted in order to compensate. The tangent basis helps reorient (twist) the lighting as it comes into the surface's local space, so the lighting will then look uniform across the normal mapped mesh.&lt;br /&gt;
&lt;br /&gt;
When an artist tiles a tangent-space normal map across an arbitrary mesh, like a landscape, this tends to shade correctly because the mesh has a uniform direction in tangent space. If the mesh has discontinuous UV coordinates (UV seams), or the normal map has large directional gradients across it, the tangent space won't be uniform anymore so the surface will probably have shading seams.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTLPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling the Low-Poly Mesh ==&lt;br /&gt;
The in-game mesh usually needs to be carefully optimized to create a good silhouette, define edge-loops for better deformation, and minimize extreme changes between the vertex normals for better shading (see [[#SmoothingGroupsAndHardEdges|Smoothing Groups &amp;amp; Hard Edges]]).&lt;br /&gt;
&lt;br /&gt;
In order to create an optimized in-game mesh including a good silhouette and loops for deforming in animation, you can start with the 2nd subdivision level of your [[DigitalSculpting|digital sculpt]], or in some cases with the base mesh itself. Then you can just collapse edge loops or cut in new edges to add/remove detail as necessary. Or you can [[DigitalSculpting#OART|re-toplogize]] from scratch if that works better for you.&lt;br /&gt;
&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts] on the Polycount forum.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UVC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;UVCoordinates&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== UV Coordinates ===&lt;br /&gt;
Normal map baking tools only capture normals within the 0-1 UV square, any UV bits outside this area are ignored. &lt;br /&gt;
&lt;br /&gt;
Only one copy of the forward-facing UVs should remain in the 0-1 UV square at baking time. If the mesh uses overlapping UVs, this will likely cause artifacts to appear in the baked map, since the baker will try render each UV shell into the map. Before baking, it's best to move all the overlaps and mirrored bits outside the 0-1 square. &lt;br /&gt;
&lt;br /&gt;
[[image:Normalmap_uvcoord_offset.jpg|frame|none|The mirrored UVs (in red) are offset 1 unit before baking. &amp;lt;br&amp;gt;Image by [http://ericchadwick.com Eric Chadwick].]]&lt;br /&gt;
&lt;br /&gt;
If you move all the overlaps and mirrored bits exactly 1 UV unit (any whole number will do), then you can leave them there after the bake and they will still be mapped correctly. You can move them back if you want, it doesn't matter to most game engines. Be aware that ZBrush does use UV offsets to manage mesh visibility, however this usually doesn't matter because the ZBrush cage mesh is often a different mesh than the in-game mesh used for baking.&lt;br /&gt;
&lt;br /&gt;
You should avoid changing the UVs after baking the normal map, because rotating or mirroring UVs after baking will cause the normal map not to match the [[#TB|tangent basis]] anymore, which will likely cause lighting problems. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, W is a third texture coordinate. It's used for 3D procedural textures and for storing vertex color in UV channels (you need 3 axes for RGB, so UVW can store vertex color). Bake problems can be avoided by moving any overlapping UVs to -1 on the W axis, with the same results as moving them 1 unit on the U or V axes. The tool Render To Texture will always bake whatever UVs are the highest along the W axis. However using W can be messy... it's generally hidden unless you purposefully look for it (bad for team work), doesn't get preserved on export to other apps, and high W values can prevent selecting and/or welding UVs. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;M&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Mirroring&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mirroring ===&lt;br /&gt;
Normal maps can be mirrored across a model to create symmetrical details, and save UV space, which allows more detail in the normal map since the texture pixels are smaller on the model. &lt;br /&gt;
&lt;br /&gt;
With [[#OSNM|object-space]] maps, mirroring requires [http://boards.polycount.net/showthread.php?t=53986 specific shader support]. For [[#TSNM|tangent-space]] maps, mirroring typically creates a shading seam, but this can be reduced or hidden altogether, depending on the method used.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TMW&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Typical Mirroring Workflow ====&lt;br /&gt;
# Delete the mesh half that will be mirrored. &lt;br /&gt;
# Arrange the UVs for the remaining model, filling the UV square.&lt;br /&gt;
# Mirror the model to create a &amp;quot;whole&amp;quot; mesh, welding the mesh vertices along the seam. &lt;br /&gt;
# Move the mirrored UVs exactly 1 unit (or any whole number) out of the 0-1 UV square.&lt;br /&gt;
# Bake the normal map.&lt;br /&gt;
&lt;br /&gt;
Sometimes an artist will decide to delete half of a symmetrical model before baking. &lt;br /&gt;
&lt;br /&gt;
This is a mistake however because often the vertex normals along the hole will bend towards the hole a bit; there are no faces on the other side to average the normals with. This will create a strong lighting seam in the normal map. &lt;br /&gt;
&lt;br /&gt;
It's typically best to use the complete mirrored model to bake the normal map, not just the unique half. &lt;br /&gt;
&lt;br /&gt;
To prevent the mirrored UVs from causing overlaps or baking errors, move the mirrored [[#UVC|UVs]] out of the 0-1 UV space, so only one copy of the non-mirrored UVs is left within the 0-1 square.&lt;br /&gt;
&lt;br /&gt;
To avoid texel &amp;quot;leaks&amp;quot; between the UV shells, make sure there's enough [[#Edge_padding|Edge Padding]] around each shell, including along the edges of the normal map. None of the UV shells should be touching the edge of the 0-1 UV square, unless they're meant to tile with the other side of the map.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;CM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Center Mirroring ====&lt;br /&gt;
If the mirror seam runs along the surface of a continuous mesh, like down the center of a human face for example, then it will probably create a lighting seam. &lt;br /&gt;
&lt;br /&gt;
In Epic Games' [http://www.unrealtechnology.com/technology.php Unreal Engine 3] (UE3) their symmetrical models commonly use centered mirroring. Epic uses materials that mix a [[DetailMap]] with the normal maps; these seem to scatter the diffuse/specular lighting and help minimize the obviousness of the mirror seams. For their [[Light Map]]ped models they use [http://udn.epicgames.com/Three/LightMapUnwrapping.html a technique] that can almost completely hide the mirror seam.&lt;br /&gt;
&lt;br /&gt;
[[image:Epic_MirroringCicada.jpg|frame|none| In UE3 a center mirror seam is reduced by using a detail normal map. &amp;lt;br&amp;gt; Image by &amp;quot;[http://epicgames.com Epic Games]&amp;quot;]]&lt;br /&gt;
&lt;br /&gt;
'''''[http://www.zbrushcentral.com/showpost.php?p=573108&amp;amp;postcount=28 GOW2 normal map seams], [http://utforums.epicgames.com/showthread.php?p=27166791#post27166791 UDK normal map seams]'''''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;OM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Offset Mirroring ====&lt;br /&gt;
Offset mirroring is a method where you move the mirror seam off to one side of the model, so the seam doesn't run exactly down the center. For example with a character's head, the UV seam can go down along the side of the head in front of the ear. The UV shell for the nearest ear can then be mirrored to use the area on the other side of the head. &lt;br /&gt;
&lt;br /&gt;
This avoids the &amp;quot;Rorschach&amp;quot; effect and allows non-symmetrical details, but it still saves texture space because the two sides of the head can be mirrored (they're never seen at the same time anyhow).&lt;br /&gt;
&lt;br /&gt;
Offset mirroring doesn't get rid of the seam, but it does move it off to a place where it can either be less obvious, or where it can be hidden in a natural seam on the model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;FCM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Flat Color Mirroring ====&lt;br /&gt;
[http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] solves seams by painting a flat set of normals along the seam, using neutral blue (128,128,255). However it only works along horizontal or vertical UV seams, not across any angled UVs. It also removes any details along the mirror seam, creating blank areas. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Element Mirroring ====&lt;br /&gt;
The mirror seam can be avoided completely when it doesn't run directly through any mesh. For example if there's a detached mesh element that runs down the center of the model, this can be uniquely mapped, while the meshes on either side can be mirrors of each other. Whenever the mirrored parts don't share any vertex normals with the non-mirrored parts, there won't be any seams. &lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_mirrored-binocs-racer445.jpg|frame|none|The middle part (highlighted in red) uses unique non-mirrored UVs, allowing the mesh on the right to be mirrored without any seams. &amp;lt;br&amp;gt;Image by [http://http://racer445.com/ &amp;quot;racer445&amp;quot;]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SGAHE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Smoothing Groups &amp;amp; Hard Edges ===&lt;br /&gt;
Each vertex in a mesh has at least one vertex normal. Vertex normals are used to control the direction a triangle will be lit from; if the normal is facing the light the triangle will be fully lit, if facing away from the light the triangle won't be lit. &lt;br /&gt;
&lt;br /&gt;
Each vertex however can have more than one vertex normal. When two triangles have different vertex normals along their shared edge, this creates a shading seam, called a ''hard edge'' in most modeling tools. 3ds Max uses ''Smoothing Groups'' to create hard/soft edges, Maya uses ''Harden Edge'' and ''Soften Edge''. These tools create hard and soft edges by splitting and combining the vertex normals.&lt;br /&gt;
&lt;br /&gt;
[[image:BenMathis_SmoothingGroups_Excerpt.gif|frame|none|Hard edges occur where the vertices have multiple normals. &amp;lt;br&amp;gt;Image by [http://poopinmymouth.com Ben 'poopinmymouth' Mathis] ([http://poopinmymouth.com/process/tips/smoothing_groups.jpg tutorial here])]]&lt;br /&gt;
&lt;br /&gt;
When a mesh uses all soft normals (a single smoothing group) the lighting has to be interpolated across the extreme differences between the vertex normals. If your renderer doesn't support the same [[#TangentBasis|tangent basis]] that the baker uses, this can produce extreme shading differences across the model, which creates shading artifacts. It is generally best to reduce these extremes when you can because a mismatched renderer can only do so much to counteract it.&lt;br /&gt;
&lt;br /&gt;
Hard edges are usually best where the model already has a natural seam. For example, you can add a hard edge along the rim of a car's wheel well, to prevent the inside of the wheel well from distorting the shading for the outside of the car body. Mechanical models usually need hard edges where ever the surface bends more than about 45 degrees. &lt;br /&gt;
&lt;br /&gt;
For most meshes, the best results usually come from adding hard edges where ever there are UV seams. There are no hard rules however, you must experiment with different approaches to find what works best in your game.&lt;br /&gt;
&lt;br /&gt;
When you use object-space normal maps the vertex normal problem goes away since you're no longer relying on the crude vertex normals of the mesh. An object-space normal map completely ignores vertex normals. Object-space mapping allows you to use all soft edges and no bevels on the low-res mesh, without showing lighting errors.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;HEDAT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Hard Edge Discussions &amp;amp; Tutorials ====&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?p=2090450#post2090450 Maya MEL Script help needed (UV border edges)]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=107196 You're making me hard. Making sense of hard edges, uvs, normal maps and vertex counts]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73593 Normal Maps: Can Somone Explain This &amp;quot;Black Edge&amp;quot; issue]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=73566 Normal Maps: Can someone explain normals, tangents and split UVs?]&lt;br /&gt;
* [http://www.polycount.com/forum/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68173 Why you should NOT trust 3ds Max's viewport normal-map display!]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/10503-xsi-normal-mapped-cube-looks-bad.html XSI - normal mapped cube looks bad]&lt;br /&gt;
* [http://www.game-artist.net/forums/support-tech-discussion/11924-weird-maya-normal-map-seam-artifact-problem-am-i-making-simple-mistake.html Weird Maya normal map seam/artifact problem]&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?p=1080600 Seams in Normals when Creating Tiling Environment Trims and other Tiles]&lt;br /&gt;
* The tutorial [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing can affect the normal map.&lt;br /&gt;
* The tutorial: [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] shows how smoothing affects raycasting.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses the breaking of normals and smoothing groups in general terms.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in the game, not the triangle count.&lt;br /&gt;
* The Crysis documentation [http://doc.crymod.com/AssetCreation/PolyBumpReference.html PolyBump Reference] has a section towards the bottom that shows how smoothing affects their baked normal maps.&lt;br /&gt;
* The polycount thread [http://boards.polycount.net/showthread.php?t=60694 Toying around with normal map approaches] has a great discussion of how best to use smoothing groups and bevels for better shading.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;UB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Using Bevels ====&lt;br /&gt;
Bevels/chamfers generally improve the silhouette of the model, and can also help reflect specular highlights better. &lt;br /&gt;
&lt;br /&gt;
However bevels tend to produce long thin triangles, which slow down the in-game rendering of your model. Real-time renderers have trouble rendering long thin triangles because they create a lot of sub-pixel areas to render. &lt;br /&gt;
&lt;br /&gt;
Bevels also balloon the vertex count, which can increase the transform cost and memory usage. Hard edges increase the vertex count too, but not when  the edge also shares a seam in UV space. For a good explanation of the vertex count issue, see [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly].&lt;br /&gt;
&lt;br /&gt;
Using hard edges with matching UV shells tends to give better performance and better cosmetic results than using bevels. However there are differing opinions on this, see the Polycount thread &amp;quot;[http://boards.polycount.net/showthread.php?t=71760 Maya transfer maps help]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EVN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
==== Edited Vertex Normals ====&lt;br /&gt;
If you use bevels the shading will be improved by editing the vertex normals so the larger flat surfaces have perpendicular normals. The vertex normals are then forced to blend across the smaller bevel faces, instead of across the larger faces. See the Polycount thread [http://boards.polycount.net/showthread.php?t=66139 Superspecular soft edges tutorial chapter 1].&lt;br /&gt;
&lt;br /&gt;
[[image:oliverio_bevel_normals.gif|frame|none|Bending normals on bevelled models. &amp;lt;br&amp;gt;From the tutorial [http://deadlineproof.com/model-shading-techniques-soft-edge-superspecular/ Shading techniques Superspecular soft edges]&amp;lt;br&amp;gt;Image by [http://deadlineproof.com/ Paolo Oliverio]]]&lt;br /&gt;
&lt;br /&gt;
== Level of Detail Models ==&lt;br /&gt;
See [http://www.polycount.com/forum/showthread.php?p=1216945#post1216945 Problem if you're using 3point-style normals with an LOD].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MTHPM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Modeling The High-Poly Mesh ==&lt;br /&gt;
[[Subdivision Surface Modeling]] and [[DigitalSculpting]] are the techniques most often used for modeling a normal map. &lt;br /&gt;
&lt;br /&gt;
Some artists prefer to model the in-game mesh first, other artists prefer to model the high-res mesh first, and others start somewhere in the middle. The modeling order is ultimately a personal choice though, all three methods can produce excellent results:&lt;br /&gt;
* Build the in-game model, then up-res it and sculpt it.&lt;br /&gt;
* Build and sculpt a high resolution model, then build a new in-game model around that.&lt;br /&gt;
* Build a basemesh model, up-res and sculpt it, then step down a few levels of detail and use that as a base for building a better in-game mesh.&lt;br /&gt;
If the in-game mesh is started from one of the subdivision levels of the basemesh sculpt, various edge loops can be collapsed or new edges can be cut to add/remove detail as necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Sloped Extrusions ===&lt;br /&gt;
[[image:normal_slopes_hatred.jpg|frame|none|Extrusions on the high-poly model should be sloped to make a better normal map. &amp;lt;br&amp;gt;Image by [http://www.hatred.gameartisans.org/ Krzysztof &amp;quot;Hatred&amp;quot; Dolas].]]&lt;br /&gt;
&lt;br /&gt;
=== Floating Geometry ===&lt;br /&gt;
[[image:FloatingGeo.jpg|frame|none|Normal map stores the direction the surface is facing rather than real depth information, thus allowing to save time using floating geometry. &amp;lt;br&amp;gt;To correctly bake AO with floating geo make it a separate object and turn off it's shadow casting. &amp;lt;br&amp;gt;Image by [http://artisaverb.info/ Andrew &amp;quot;d1ver&amp;quot; Maximov].]]&lt;br /&gt;
&lt;br /&gt;
See also [[3DTutorials/Modeling High-Low Poly Models for Next Gen Games|Modeling High/Low Poly Models for Next Gen Games]] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;ET&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Thickness ===&lt;br /&gt;
[[image:normal_edge_thickness.jpg|frame|none|When creating edges of the Highpoly, sometimes you'll need to make them rounded than in real life to &amp;lt;br&amp;gt;work better at the size they will be seen.&amp;lt;br&amp;gt;Image by [http://racer445.com/Evan &amp;quot;racer445&amp;quot; Herbert]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MRF&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;MRRCB&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mental ray Round Corners Bump ===&lt;br /&gt;
The mental ray renderer offers an automatic bevel rendering effect called Round Corners Bump that can be baked into a normal map. This is available in 3ds Max, Maya, and XSI. See [http://boards.polycount.net/showthread.php?t=71995 Zero Effort Beveling for normal maps] - by [http://boards.polycount.net/member.php?u=31662 Robert &amp;quot;r_fletch_r&amp;quot; Fletcher].&lt;br /&gt;
&lt;br /&gt;
[http://jeffpatton.net/ Jeff Patton] posted about [http://jeffpatton.cgsociety.org/blog/archive/2007/10/ how to expose Round Corners Bump] in 3ds Max so you can use it in other materials.&lt;br /&gt;
&lt;br /&gt;
[http://cryrid.com/art/ Michael &amp;quot;cryrid&amp;quot; Taylor] posted a tutorial about how to use [http://cryrid.com/images/temp/XSI/zeroeffort_bevels.jpg Round Corners in XSI].&lt;br /&gt;
&lt;br /&gt;
XSI is able to bake a good normal map with it, but 3ds Max seems to bake it incorrectly, and Maya isn't able to bake the effect at all. Maybe Max might be able to bake it correctly, if the .mi shader is edited to use the correct coordinate space?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;Baking&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;B&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Baking ==&lt;br /&gt;
The process of transferring normals from the high-res model to the in-game model is often called baking. The baking tool usually starts projecting a certain numerical distance out from the low-poly mesh, and sends rays inwards towards the high-poly mesh. When a ray intersects the high-poly mesh, it records the mesh's surface normal and saves it in the normal map.&lt;br /&gt;
&lt;br /&gt;
To get an understanding of how all the options affect your normal map, do some test bakes on simple meshes like boxes. They generate quickly so you can experiment with [[#UVCoordinates|UV mirroring]], [[#SGAHE|smoothing groups]], etc. This helps you learn the settings that really matter.&lt;br /&gt;
* The tutorial [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] has more examples of ray-casting, plus how to get better results from the bake.&lt;br /&gt;
&lt;br /&gt;
Baking sub-sections:&lt;br /&gt;
# [[#Anti-Aliasing|Anti-Aliasing]]&lt;br /&gt;
# [[#Baking_Transparency|Baking Transparency]]&lt;br /&gt;
# [[#Edge_Padding|Edge Padding]]&lt;br /&gt;
# [[#High_Poly_Materials|High Poly Materials]]&lt;br /&gt;
# [[#Reset_Transforms|Reset Transforms]]&lt;br /&gt;
# [[#Solving_Intersections|Solving Intersections]]&lt;br /&gt;
# [[#Solving_Pixel_Artifacts|Solving Pixel Artifacts]]&lt;br /&gt;
# [[#Solving_Wavy_Lines|Solving Wavy Lines]]&lt;br /&gt;
# [[#Triangulating|Triangulating]]&lt;br /&gt;
# [[#Working_with_Cages|Working with Cages]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[AntiAliasing]])&amp;gt;&amp;gt;&amp;lt;span id=&amp;quot;AA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Anti-Aliasing ===&lt;br /&gt;
Turning on super-sampling or anti-aliasing (or whatever multi-ray casting is called in your normal map baking tool) will help to fix any jagged edges where the high-res model overlaps itself within the UV borders of the low-poly mesh, or wherever the background shows through holes in the mesh. Unfortunately this tends to render much much slower, and takes more memory.&lt;br /&gt;
&lt;br /&gt;
[[image:normalmap_aliasing_knak47.jpg|frame|none|A bake without anti-aliasing shows artifacts where the high-poly mesh has overlaps. &amp;lt;br&amp;gt;Image by [http://www.polycount.com/forum/member.php?u=35938 'knak47']]]&lt;br /&gt;
&lt;br /&gt;
One trick to speed this up is to render 2x the intended image size then scale the normal map down 1/2 in a paint program like Photoshop. The reduction's pixel resampling will add anti-aliasing for you in a very quick process. After scaling, make sure to re-normalize the map if your game doesn't do that already, because the un-normalized pixels in your normalmap may cause pixelly artifacts in your specular highlights. Re-normalizing can be done with [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA's normal map filter] for Photoshop.&lt;br /&gt;
&lt;br /&gt;
3ds Max's supersampling doesn't work nicely with edge padding, it produces dark streaks in the padded pixels. If so then turn off padding and re-do the padding later, either by re-baking without supersampling or by using a Photoshop filter like the one that comes with [[#3DTools|Xnormal]].&lt;br /&gt;
&lt;br /&gt;
=== Baking Transparency ===&lt;br /&gt;
Sometimes you need to bake a normal map from an object that uses opacity maps, like a branch with opacity-mapped leaves. Unfortunately baking apps often completely ignore any transparency mapping on your high-poly mesh.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[image:JoeWilson_ivynormals_error.jpg]] &lt;br /&gt;
|[[image:JoeWilson_ivynormals_rendered.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|3ds Max's RTT baker causes transparency errors.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|The lighting method bakes perfect transparency.&amp;lt;br&amp;gt;image by [http://www.linkedin.com/in/earthquake Joe &amp;quot;EarthQuake&amp;quot; Wilson]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To solve this, render a Top view of the mesh. This only works if you're using a planar UV projection for your low-poly mesh and you're baking a tangent-space normal map.&lt;br /&gt;
&lt;br /&gt;
* Make sure the Top view matches the dimensions of the planar UV projection used by the low-poly mesh. It helps to use an orthographic camera for precise placement.&lt;br /&gt;
* On the high-poly mesh either use a specific lighting setup or a use special material shader:&lt;br /&gt;
* 1) The lighting setup is described in these tutorials:&lt;br /&gt;
* * [http://www.bencloward.com/tutorials_normal_maps11.shtml Creating A Normal Map Right In Your 3D App] by [http://www.bencloward.com/ Ben Cloward]&lt;br /&gt;
* *[http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy], Graphics Techniques Consultant, Xbox Content and Design Team&lt;br /&gt;
* 2) The material shader does the same thing, but doesn't require lights.&lt;br /&gt;
* * [http://www.scriptspot.com/3ds-max/normaltexmap NormalTexMap] scripted map for 3ds Max by [http://www.scriptspot.com/users/dave-locke Dave Locke].&lt;br /&gt;
* * [http://www.footools.com/3dsmax_plugins.html InfoTexture] map plugin for 3ds Max by [http://www.footools.com John Burnett]&lt;br /&gt;
&lt;br /&gt;
[[image:BenCloward_NormalMapLighting.gif|frame|none|The lighting setup for top-down rendering. &amp;lt;br&amp;gt;Image by [http://www.bencloward.com Ben Cloward]]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;EP&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Edge Padding ===&lt;br /&gt;
If a normal map doesn't have enough [[Edge Padding]], this will create shading seams on the UV borders. &lt;br /&gt;
&lt;br /&gt;
=== High Poly Materials ===&lt;br /&gt;
3ds Max will not bake a normal map properly if the high-res model has a mental ray Arch &amp;amp; Design material applied. If your normal map comes out mostly blank, either use a Standard material or none at all. For an example see the Polycount thread [http://www.polycount.com/forum/showthread.php?t=74792 Render to Texture &amp;gt;:O].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Reset Transforms ===&lt;br /&gt;
Before baking, make sure your low-poly model's transforms have been reset. '''''This is very important!''''' Often during the modeling process a model will be rotated and scaled, but these compounded transforms can create a messy local &amp;quot;space&amp;quot; for the model, which in turn often creates rendering errors for normal maps. &lt;br /&gt;
&lt;br /&gt;
In 3ds Max, use the Reset Xforms utility then Collapse the Modifier Stack. In Maya use Freeze Transformation. In XSI use the Freeze button.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[SolvingIntersections]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Solving Intersections ===&lt;br /&gt;
The projection process often causes problems like misses, or overlaps, or intersections. It can be difficult generating a clean normal map in areas where the high-poly mesh intersects or nearly intersects itself, like in between the fingers of a hand. Setting the ray distance too large will make the baker pick the other finger as the source normal, while setting the ray distance too small will lead to problems at other places on the mesh where the distances between in-game mesh and high-poly mesh are greater.&lt;br /&gt;
&lt;br /&gt;
Fortunately there are several methods for solving these problems.&lt;br /&gt;
&lt;br /&gt;
# Change the shape of the cage. Manually edit points on the projection cage to help solve tight bits like the gaps between fingers.&lt;br /&gt;
# Limit the projection to matching materials, or matching UVs.&lt;br /&gt;
# Explode the meshes. See the polycount thread [http://boards.polycount.net/showthread.php?t=62921 Explode script needed (for baking purposes)].&lt;br /&gt;
# Bake two or more times using different cage sizes, and combine them in Photoshop.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[SolvingPixelArtifacts]])&amp;gt;&amp;gt;&amp;lt;span id=&amp;quot;SPA&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Solving Pixel Artifacts ===&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
If you are using 3ds Max's ''Render To Texture'' to bake from one UV layout to another, you may see stray pixels scattered across the bake. This only happens if you are using a copy of the original mesh in the Projection, and that mesh is using a different UV channel than the original mesh.&lt;br /&gt;
&lt;br /&gt;
There are two solutions for this:&lt;br /&gt;
&lt;br /&gt;
* Add a Push modifier to the copied mesh, and set it to a low value like 0.01.&lt;br /&gt;
- or -&lt;br /&gt;
&lt;br /&gt;
* Turn off ''Filter Maps'' in the render settings (Rendering menu &amp;gt; Render Setup &amp;gt; Renderer tab &amp;gt; uncheck Filter Maps). To prevent aliasing you may want to enable the Global Supersampler in Render Setup.&lt;br /&gt;
&lt;br /&gt;
See also [[#Anti-Aliasing]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SWL&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[SolvingWavyLines]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Solving Wavy Lines ===&lt;br /&gt;
When capturing from a cylindrical shape, often the differences between the low-poly mesh and the high-poly mesh will create a wavy edge in the normal map. There are a couple ways to avoid this:&lt;br /&gt;
&lt;br /&gt;
# The best way... create your lowpoly model with better supporting edges. See the Polycount threads [http://www.polycount.com/forum/showthread.php?t=81154 Understanding averaged normals and ray projection/Who put waviness in my normal map?], [http://boards.polycount.net/showthread.php?t=55754 approach to techy stuff], [http://www.polycount.com/forum/showthread.php?t=72713 Any tips for normal mapping curved surface?].&lt;br /&gt;
# Adjust the shape of the cage to influence the directions the rays will be cast. Beware... this work will have to be re-done every time you edit the lowpoly mesh, as the cage will be invalidated. At the bottom of [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm this page of his normal map tutorial], [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to do this in 3ds Max. Same method can be seen in the image below.&lt;br /&gt;
# Subdivide the low-res mesh so it more closely matches the high-res mesh. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] has a [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa video tutorial] that shows how to do this in Maya.&lt;br /&gt;
# Paint out the wavy line.  Beware... this work will have to be re-done every time you re-bake the normal map. The [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
# Use a separate planar-projected mesh for the details that wrap around the barrel area, so the ray-casting is more even. Beware... this will cause the normal map not to match your lowpoly vertex normals, probably causing shading errors. For example to add tread around a tire, the tread can be baked from a tread model that is laid out flat, then that bake can layered onto the bake from the cylindrical tire mesh in a paint program.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;TRI&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Triangulating ===&lt;br /&gt;
Before baking, it is usually best to triangulate the low-poly model, converting it from polygons into pure triangles. This prevents the vertex normals from being changed later on, which can create specular artifacts.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Sometimes a baking tool or a mesh exporter/importer will re-triangulate the polygons. A quad polygon is actually treated as two triangles, and the internal edge between them is often switched diagonally during modeling operations. When the vertices of the quad are moved around in certain shapes, the software's algorithm for polygon models tries to keep the quad surface in a &amp;quot;rational&amp;quot; non-overlapping shape. It does this by switching the internal edge between its triangles.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;WWC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Working with Cages ===&lt;br /&gt;
''Cage'' has two meanings in the normal-mapping process: a low-poly base for [[subdivision surface modeling]] (usually called the [[DigitalSculpting#BM|basemesh]]), or a ray-casting mesh used for normal map baking. This section covers the ray-casting cage.&lt;br /&gt;
&lt;br /&gt;
Most normal map baking tools allow you to use a distance-based raycast. A ray is sent outwards along each vertex normal, then at the distance you set a ray is cast back inwards. Where ever that ray intersects the high poly mesh, it will sample the normals from it. &lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|[[Image:Normalmap_raycasting_1.jpg]] &lt;br /&gt;
|[[Image:Normalmap_raycasting_2.jpg]]&lt;br /&gt;
|-&lt;br /&gt;
|Hard edges and a distance-based raycast (gray areas) cause ray misses (yellow) and ray overlaps (cyan).&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño]&lt;br /&gt;
|The gray area shows that using all soft edges (or hard edges and a cage-based raycast) will avoid ray-casting errors from split normals.&amp;lt;br&amp;gt; Image by [http://www.mankua.com/ Diego Castaño] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Unfortunately with a distance-based raycast, [[#SGAHE|split vertex normals]] will cause the bake to miss parts of the high-res mesh, causing errors and seams. &lt;br /&gt;
&lt;br /&gt;
Some software allows you to use ''cage mesh'' option instead, which basically inflates a copy of the low-poly mesh, then raycasts inwards from each vertex. This ballooned-out mesh is the cage.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;tablebgcolor=&amp;quot;#ffaaaa&amp;quot;&amp;gt;| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In 3ds Max the cage controls both the distance and the direction of the raycasting. &lt;br /&gt;
&lt;br /&gt;
In Maya the cage only controls the distance; the ray direction matches the vertex normals (inverted).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;text-decoration: line-through&amp;quot;&amp;gt; This may have been fixed in the latest release...&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&lt;br /&gt;
In Xnormal the cage is split everywhere the model has [[#SGAHE|hard edges]], causing ray misses in the bake. You can fix the hard edge split problem but it involves an overly complex workflow. You must also repeat the whole process any time you change your mesh:&amp;lt;/span&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Load the 3d viewer.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Turn on the cage editing tools.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Select all of the vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Weld all vertices.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Expand the cage as you normally would.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Save out your mesh using the Xnormal format.&amp;lt;/s&amp;gt;&lt;br /&gt;
# &amp;lt;s&amp;gt; Make sure Xnormal is loading the correct mesh.&amp;lt;/s&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;P&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Painting&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Painting ==&lt;br /&gt;
Don't be afraid to edit normal maps in Photoshop. After all it is just a texture, so you can clone, blur, copy, blend all you want... as long as it looks good of course. Some understanding of [[#RGBChannels|the way colors work]] in normal maps will go a long way in helping you paint effectively.&lt;br /&gt;
&lt;br /&gt;
A normal map sampled from a high-poly mesh will nearly always be better than one sampled from a texture, since you're actually grabbing &amp;quot;proper&amp;quot; normals from an accurate, highly detailed surface. That means your normal map's pixels will basically be recreating the surface angles of your high-poly mesh, resulting in a very believable look.&lt;br /&gt;
&lt;br /&gt;
If you only convert an image into a normal-map, it can look very flat, and in some cases it can be completely wrong unless you're very careful about your value ranges. Most image conversion tools assume the input is a heightmap, where black is low and white is high. If you try to convert a diffuse texture that you've painted, the results are often very poor. Often the best results are obtained by baking the large and mid-level details from a high-poly mesh, and then combined with photo-sourced &amp;quot;fine detail&amp;quot; normals for surface details such as fabric weave, scratches and grain.&lt;br /&gt;
&lt;br /&gt;
Sometimes creating a high poly surface takes more time than your budget allows. For character or significant environment assets then that is the best route, but for less significant environment surfaces working from a heightmap-based texture will provide a good enough result for a much less commitment in time.&lt;br /&gt;
&lt;br /&gt;
* [http://crazybump.com/ CrazyBump] is a commercial normal map converter.&lt;br /&gt;
* [http://www.renderingsystems.com/support/showthread.php?tid=3 ShaderMap] is a commercial normal map converter.&lt;br /&gt;
* [http://www.pixplant.com/ PixPlant] is a commercial normal map converter.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=68860 NJob] is a free normal map converter.&lt;br /&gt;
* [http://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop NVIDIA normalmap filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://xnormal.net Xnormal height-to-normals filter for Photoshop] is a free normal map converter.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_3.htm Normal map process tutorial] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] includes an example of painting out wavy lines in a baked normal map.&lt;br /&gt;
&lt;br /&gt;
=== Flat Color ===&lt;br /&gt;
The color (128,128,255) creates normals that are completely perpendicular to the polygon, as long as the vertex normals are also perpendicular. Remember a normal map's per-pixel normals create ''offsets'' from the vertex normals. If you want an area in the normal map to be flat, so it creates no offsets from the vertex normals, then use the color (128,128,255). &lt;br /&gt;
&lt;br /&gt;
This becomes especially obvious when [[#Mirroring|mirroring a normal map]] and using a shader with a reflection ingredient. Reflection tends to accentuate the angles between the normals, so any errors become much more apparent.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| [[attachment:normalmap_127seam.jpg|Media:NormalMap/attachments/normalmap_127seam.jpg&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In a purely logical way, 127 seems like it would be the halfway point between 0 and 255. However 128 is the color that actually works in practice. When a test is done comparing (127,127,255) versus (128,128,255) it becomes obvious that 127 creates a slightly bent normal, and 128 creates a flat one.&lt;br /&gt;
&lt;br /&gt;
This is because most game pipelines use ''unsigned'' normal maps. For details see the Polycount forum thread [http://www.polycount.com/forum/showpost.php?p=771360&amp;amp;postcount=22 tutorial: fixing mirrored normal map seams].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BNMT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[BlendingNormalMapsTogether]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Blending Normal Maps Together ===&lt;br /&gt;
Blending normal maps together is a quick way to add high-frequency detail like wrinkles, cracks, and the like. Fine details can be painted as a height map, then it can be converted into a normal map using one of the normal map tools. Then this &amp;quot;details&amp;quot; normal map can be blended with a geometry-derived normal map using one of the methods below. &lt;br /&gt;
&lt;br /&gt;
Here is a comparison of four of the blending methods. Note that in these examples the default values were used for CrazyBump (Intensity 50, Strength 33, Strength 33), but the tool allows each layer's strength to be adjusted individually for stronger or milder results. Each of the normal maps below were [[#Renormalizing|re-normalized]] after blending.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
| [[Image:NormalMap$nrmlmap_blending_methods_Maps.png}}&lt;br /&gt;
|-&lt;br /&gt;
| The blended normal maps.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by[http://www.ericchadwick.com Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The four blending methods used above:&lt;br /&gt;
# [http://www.crazybump.com CrazyBump] by Ryan Clark blends normal maps together using calculations in 3D space rather than just in 2D. This does probably the best job at preserving details, and each layer's strength settings can be tweaked individually. &lt;br /&gt;
# [http://www.rodgreen.com/?p=4 Combining Normal Maps in Photoshop] by Rod Green blends normal maps together using Linear Dodge mode for the positive values and Difference mode for the negative values, along with a Photoshop Action to simplify the process. It's free, but the results may be less accurate than CrazyBump.&lt;br /&gt;
# [http://www.paultosca.com/makingofvarga.html Making of Varga] by [http://www.paultosca.com/ Paul &amp;quot;paultosca&amp;quot; Tosca] blends normal maps together using Overlay mode for the red and green channels and Multiply mode for the blue channel. This gives a slightly stronger bump than the Overlay-only method. [http://www.leocov.com/ Leo &amp;quot;chronic&amp;quot; Covarrubias] has a step-by-step tutorial for this method in [http://www.cgbootcamp.com/tutorials/2009/12/9/photoshop-combine-normal-maps.html CG Bootcamp Combine Normal Maps].&lt;br /&gt;
# [[3DTutorials/Normal Map Deepening|Normal Map Deepening]] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to blend normal maps together using Overlay mode. [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap CGTextures tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] also shows how to create normalmaps using multiple layers (Note: to work with the Overlay blend mode each layer's Output Level should be 128 instead of 255, you can use the Levels tool for this).&lt;br /&gt;
&lt;br /&gt;
The [http://boards.polycount.net/showthread.php?t=69615 Getting good height from Nvidia-filter normalizing grayscale height] thread on the Polycount forum has a discussion of different painting/blending options. Also see the [[#2DT|2D Tools]] section for painting and conversion tools.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;PCT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Pre-Created Templates ===&lt;br /&gt;
A library of shapes can be developed and stored for later use, to save creation time for future normal maps. Things like screws, ports, pipes, and other doo-dads. These shapes can be stored as bitmaps with transparency so they can be layered into baked normal maps.&lt;br /&gt;
&lt;br /&gt;
* [http://www.beautifulrobot.com/?p=69 Creating &amp;amp; Using NormalMap &amp;quot;Widgets&amp;quot;] - by ''[http://www.beautifulrobot.com Steev &amp;quot;kobra&amp;quot; Kelly]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt; How to set up and render template objects.&lt;br /&gt;
* [http://www.akramparvez.com/portfolio/scripts/normalmap-widget-for-3ds-max/ NormalMap Widget for 3ds Max] - by ''[http://www.akramparvez.com Akram Parvez]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;A script to automate the setup and rendering process.&lt;br /&gt;
* See the section [[#BT|Baking Transparency]] for more template-rendering tools and tutorials.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;RN&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Renormalizing&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Re-normalizing ===&lt;br /&gt;
Re-normalizing means resetting the length of each normal in the map to 1.&lt;br /&gt;
&lt;br /&gt;
A normal mapping shader takes the three color channels of a normal map and combines them to create the direction and length of each pixel's normal. These normals are then used to apply the scene lighting to the mesh. However if you edit normal maps by hand or if you blend multiple normal maps together this can cause those lengths to change. Most shaders expect the length of the normals to always be 1 (normalized), but some are written to re-normalize the normal map dynamically (for example, 3ds Max's Hardware Shaders do re-normalize).&lt;br /&gt;
&lt;br /&gt;
If the normals in your normal map are not normalized, and your shader doesn't re-normalize them either, then you may see artifacts on the shaded surface... the specular highlight may speckle like crazy, the surface may get patches of odd shadowing, etc. To help you avoid this NVIDIA's normal map filter for Photoshop provides an easy way to re-normalize a map after editing; just use the '''Normalize Only''' option. [http://xnormal.net Xnormal] also comes with a Normalize filter for Photoshop.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Some shaders use [[#NormalMapCompression|compressed normal maps]]. Usually this means the blue channel is thrown away completely, so it's recalculated on-the-fly in the shader. However the shader has to re-normalize in order to recreate that data, so any custom normal lengths that were edited into the map will be ignored completely. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;AOIANM&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;AmbientOcclusionIntoANormalMap&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Ambient Occlusion into a Normal Map ===&lt;br /&gt;
If the shader doesn't re-normalize the normal map, an [[Ambient Occlusion Map]] can actually be baked into the normal map. This will shorten the normals in the crevices of the surface, causing the surface to receive less light there. This works with both diffuse and specular, or any other pass that uses the normal map, like reflection.&lt;br /&gt;
&lt;br /&gt;
However it's usually best to keep the AO as a separate map (or in an alpha channel) and multiply it against the ambient lighting only. This is usually done with a custom [[Category:Shaders|shader]]. If you multiply it against the diffuse map or normal map then it also occludes diffuse lighting which can make the model look dirty. Ambient occlusion is best when it occludes ambient lighting only, for example a [[DiffuselyConvolvedCubeMap|diffusely convolved cubemap]].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
To bake the AO into a normal map, adjust the levels of the AO layer first so the darks only go as low as 128 gray, then set the AO layer to Darken mode. This will shorten the normals in the normalmap, causing the surface to receive less light in the darker areas. &lt;br /&gt;
&lt;br /&gt;
This trick doesn't work with any shaders that re-normalize, like 3ds Max's Hardware Shaders. The shader must be altered to actually use the lengths of your custom normals; most shaders just assume all normals are 1 in length because this makes the shader code simpler. Also this trick will not work with most of the common [[#NormalMapCompression|normal map compression formats]], which often discard the blue channel and recalculate it in the shader, which requires re-normalization.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;BLE&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[BacklightingExample]])&amp;gt;&amp;gt;&lt;br /&gt;
=== Back Lighting Example ===&lt;br /&gt;
You can customize normal maps for some interesting effects. If you invert the blue channel of a tangent-space map, the normals will be pointing to the opposite side of the surface, which can simulate backlighting.&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|  [[Image:NormalMap$tree_front.jpg]] &lt;br /&gt;
|-&lt;br /&gt;
| Tree simulating subsurface scattering (front view).&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by[http://www.linkedin.com/in/ericchadwick Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The tree leaves use a shader than adds together two diffuse maps, one using a regular tangent-space normal map, the other using the same normal map but with the blue channel inverted. This causes the diffuse map using the regular normal map to only get lit on the side facing the light (front view), while the diffuse map using the inverted normal map only gets lit on the opposite side of the leaves (back view). The leaf geometry is 2-sided but uses the same shader on both sides, so the effect works no matter the lighting angle. As an added bonus, because the tree is self-shadowing the leaves in shadow do not receive direct lighting, which means their backsides do not show the inverted normal map, so the fake subsurface scatter effect only appears where the light directly hits the leaves. This wouldn't work for a whole forest because of the computational cost of self-shadowing and double normal maps, but could be useful for a single &amp;quot;star&amp;quot; asset, or if LODs switched the distant trees to a model that uses a cheaper shader.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;SAS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;&amp;lt;Anchor([[ShadersAndSeams]])&amp;gt;&amp;gt;&lt;br /&gt;
== Shaders and Seams ==&lt;br /&gt;
You need to use the right kind of shader to avoid seeing seams where UV breaks occur. It must be written to use the same [[#TangentBasis|tangent basis]] that was used during baking. If the shader doesn't, the lighting will either be inconsistent across UV borders or it will show smoothing errors from the low-poly vertex normals.&lt;br /&gt;
&lt;br /&gt;
Xnormal generates accurate normals when displayed in Xnormal, and the SDK includes a method to write your own custom tangent space generator for the tool. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Shaders ===&lt;br /&gt;
The &amp;quot;Render To Texture&amp;quot; tool in 3ds Max 2011 and older generates [[#TSNM|tangent-space]] normal maps that render correctly in the offline renderer (scanline) but do not render correctly in the realtime viewport with the 3ds Max shaders. Max is using a different [[#TangentBasis|tangent basis]] for each. This is readily apparent when creating non-organic hard surface normalmaps; smoothing errors appear in the viewport that do not appear when rendered. &lt;br /&gt;
&lt;br /&gt;
The errors can be fixed by using &amp;quot;Render To Texture&amp;quot; to bake a [[#TSNM|tangent-space]] or [[#OSNM|object-space]] map, and using the free [http://www.3pointstudios.com/3pointshader_about.shtml &amp;quot;3Point Shader&amp;quot;] by Christoph '[[CrazyButcher]]' Kubisch and Per 'perna' Abrahamsen. The shader uses the same tangent basis as the baking tool, so it produces nearly flawless results. It also works with old bakes.&lt;br /&gt;
&lt;br /&gt;
You can get OK results in the Max viewport using a tangent-space map baked in Maya, loading it in a Standard material, and enabling &amp;quot;Show Hardware Map in Viewport&amp;quot;. Another method is to use Render To Texture to bake an [[#OSNM|object-space]] map then use [[#CBS|Nspace]] to convert it into a tangent-space map then load that in a DirectX material and use the RTTNormalMap.fx shader. &lt;br /&gt;
&lt;br /&gt;
Autodesk is aware of these issues, and plans to address them in an upcoming release. See these links for more information:&lt;br /&gt;
* Christoph &amp;quot;[[CrazyButcher]]&amp;quot; Kubisch and Per &amp;quot;perna&amp;quot; Abrahamsen designed a shader/modifier combination approach that fixes the viewport problem, see the Polycount forum post [http://boards.polycount.net/showthread.php?t=72861 3Point Shader Lite - Shader material editor and Quality Mode normalmaps for 3ds Max].&lt;br /&gt;
* Jean-Francois &amp;quot;jfyelle&amp;quot; Yelle, Autodesk Media &amp;amp; Entertainment Technical Product Manager, has [http://boards.polycount.net/showthread.php?p=1115812#post1115812 this post]. &lt;br /&gt;
* Ben Cloward posted [http://boards.polycount.net/showthread.php?p=1100270#post1100270 workarounds and FX code].&lt;br /&gt;
* Christopher &amp;quot;cdiggins&amp;quot; Diggins, SDK writer for 3ds Max, shares some of the SDK code in his blog posts &amp;quot;[http://area.autodesk.com/blogs/chris/how_the_3ds_max_scanline_renderer_computes_tangent_and_binormal_vectors_for_normal_mapping How the 3ds Max Scanline Renderer Computes Tangent and Binormal Vectors for Normal Mapping]&amp;quot; and &amp;quot;[http://area.autodesk.com/blogs/chris/3ds_max_normal_map_baking_and_face_angle_weighting_the_plot_thickens 3ds Max Normal Map Baking and Face Angle Weighting: The Plot Thickens]&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|  [[Image:NormalMap$max2010_normalmap_workarounds_thumb.png]] &lt;br /&gt;
|-&lt;br /&gt;
| Viewport methods in 3ds Max 2010.&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;[[attachment:max2010_normalmap_workarounds.png|Actual size]]&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;&amp;lt;span style=&amp;quot;font-size: smaller&amp;quot;&amp;gt;image by [http://www.linkedin.com/in/ericchadwick Eric Chadwick]&amp;lt;/span&amp;gt; &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3MENT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3ds Max Edit Normals Trick ===&lt;br /&gt;
After baking, if you add an Edit Normals modifier to your low-poly normalmapped model, this seems to &amp;quot;relax&amp;quot; the vertex normals for more accurate viewport shading. The modifier can be collapsed if desired.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;MS&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Maya Shaders ===&lt;br /&gt;
Maya seems to correctly generate normals to view in realtime, with the correct [[#TangentBasis|tangent basis]], with much less smoothing errors than 3ds Max. &lt;br /&gt;
* [http://www.mentalwarp.com/~brice/shader.php BRDF shader] by [http://www.mentalwarp.com/~brice/ Brice Vandemoortele] and [http://www.kjapi.com/ Cedric Caillaud] (more info in [http://boards.polycount.net/showthread.php?t=49920 this Polycount thread]) '''Update:''' [http://boards.polycount.net/showthread.php?p=821862#post821862 New version here] with many updates, including object-space normal maps, relief mapping, self-shadowing, etc. Make sure you enable cgFX shaders in the Maya plugin manager, then you can create them in the same way you create a Lambert, Phong etc. Switch OFF high quality rendering in the viewports to see them correctly too.&lt;br /&gt;
* If you want to use the software renderer, use mental ray instead of Maya's software renderer because mental ray correctly interprets tangent space normals. The Maya renderer treats the normal map as a grayscale bump map, giving nasty results. Mental ray supports Maya's Phong shader just fine (amongst others), although it won't recognise a gloss map plugged into the &amp;quot;cosine power&amp;quot; slot. The slider still works though, if you don't mind having a uniform value for gloss. Spec maps work fine though. Just use the same set up as you would for viewport rendering. You'll need to have your textures saved as TGAs or similar for mental ray to work though. - from [http://boards.polycount.net/member.php?u=14235 CheeseOnToast]&lt;br /&gt;
&amp;lt;&amp;lt;Anchor([[NormalMapCompression]])&amp;gt;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;NMC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Normal Map Compression ==&lt;br /&gt;
Normal maps can take up a lot of memory. Compression can reduce the size of a map to 1/4 of what it was uncompressed, which means you can either increase the resolution or you can use more maps.&lt;br /&gt;
&lt;br /&gt;
Usually the compression method is to throw away the Blue channel, because this can be re-computing at minimal cost in the shader code. Then the bitmap only has to store two color channels, instead of four (red, green, blue, and alpha).&lt;br /&gt;
&lt;br /&gt;
* The article [http://developer.download.nvidia.com/whitepapers/2008/real-time-normal-map-dxt-compression.pdf Real-Time Normal Map DXT Compression] (PDF) from [http://www.idsoftware.com/ id software] and [http://developer.nvidia.com NVIDIA] is an excellent introduction to compression.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;DXT5C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== DXT5nm Compression ===&lt;br /&gt;
DXT5nm is the same file format as DXT5 except before compression the red channel is moved into the alpha channel, the green channel is left as-is, and the red and blue channels are blanked with the same solid color. This re-arranging of the normal map axes is called ''swizzling''.&lt;br /&gt;
&lt;br /&gt;
The Green and Alpha channels are used because in the DXT format they are compressed using somewhat higher bit depths than the Red and Blue channels. Red and Blue have to be filled with the same solid color because DXT uses a compression system that compares differences between the three color channels. If you try to store some kind of texture in Red and/or Blue (specular power, height map, etc.) then the compressor will create more compression artifacts because it has to compare all three channels.&lt;br /&gt;
&lt;br /&gt;
There are some options in the NVIDIA DXT compressor that help reduce the artifacts if you want to add texture to the Red or Blue channels. The artifacts will be greater than if you keep Red and Blue empty, but it might be a tradeoff worth making. Some notes about this on the [http://developer.nvidia.com/forums/index.php?showtopic=1366 NVIDIA Developer Forums].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;DXT1C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== DXT1 Compression ===&lt;br /&gt;
DXT1 is also used sometimes for tangent-space normal maps, because it is half the size of a DXT5. The downside though is that it causes many more compression artifacts, so much so that most people end up not using it. &lt;br /&gt;
&lt;br /&gt;
* The blog post [http://realtimecollisiondetection.net/blog/?p=28#more-28 I like spilled beans!] by [http://realtimecollisiondetection.net/blog/?page_id=2 Christer Ericson] has a section about Capcom's clever use of DXT1 and DXT5.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DCC&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3Dc Compression ===&lt;br /&gt;
3Dc compression is also known as BC5 in DirectX 10. It works similar to DXT5nm, because it only stores the X and Y channels. The difference is it stores both the same way as the DXT5 Alpha channel, which is a slightly higher bit depth than DXT5nm's Green channel. 3Dc yields the best results of any listed algorithm for tangent space normal map compression, and requires no extra processing time or unique hardware. See [[3Dc]] for more information.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;A8L8C&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== [[A8L8]] Compression ===&lt;br /&gt;
The DDS format !A8L8 isn't actually compressed, it's just two 8bit grayscale channels (256 grays each). It does save you from having to store all three color channels. Your shader has to recompute the blue channel for it to work. However, !A8L8 does not actually save any space in texture memory, it is typically converted to a four-channel 32bit texture when it's sent to the card. This format really only helps save disk space.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;L&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Related Pages ===&lt;br /&gt;
* [[Curvature map]]&lt;br /&gt;
* [[DuDv map]]&lt;br /&gt;
* [[Flow map]]&lt;br /&gt;
* [[Normal map]]&lt;br /&gt;
* [[Radiosity normal map]]&lt;br /&gt;
* [[Vector displacement map]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;3DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;Tools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; &amp;lt;span id=&amp;quot;3DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 3D Tools ===&lt;br /&gt;
See [[Category:Tools#A3D_Normal_Map_Software|Category:Tools#3D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;2DT&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;2DTools&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== 2D Tools ===&lt;br /&gt;
See [[Category:Tools#A2D_Normal_Map_Software|Category:Tools#2D_Normal_Map_Software]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;T&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Tutorials&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Tutorials ===&lt;br /&gt;
* [http://area.autodesk.com/userdata/fckdata/239955/The%20Generation%20and%20Display%20of%20Normal%20Maps%20in%203ds%20Max.pdf The Generation and Display of Normal Maps in 3ds Max] (500kb PDF) &amp;lt;&amp;lt;BR&amp;gt;&amp;gt; Excellent whitepaper from Autodesk about normal mapping in 3ds Max and other apps.&lt;br /&gt;
* [http://www.katsbits.com/htm/tutorials/blender-baking-normal-maps-from-models.htm Renderbump and baking normal maps from high poly models using Blender 3D] by ''[http://www.katsbits.com/htm/about.htm &amp;quot;katsbits&amp;quot;]''&amp;lt;&amp;lt;BR&amp;gt;&amp;gt;Baking normal maps in Blender.&lt;br /&gt;
* [http://udn.epicgames.com/Three/CreatingNormalMaps.html Techniques for Creating Normal Maps] in the Unreal Developer Network's [http://udn.epicgames.com/Three/WebHome.html Unreal Engine 3 section] contains advice from [http://www.epicgames.com/ Epic Games] artists on creating normal maps for UE3. The [http://udn.epicgames.com/Three/DesignWorkflow.html#Creating%20normal%20maps%20from%20meshes Design Workflow page] has a summary.&lt;br /&gt;
* [http://www.iddevnet.com/quake4/ArtReference_CreatingModels#head-3400c230e92ff7d57424b2a68f6e0ea75dee4afa Creating Models in Quake 4] by [http://www.ravensoft.com/ Raven Software] is a comprehensive guide to creating Quake 4 characters.&lt;br /&gt;
* [http://www.svartberg.com/tutorials/article_normalmaps/normalmaps.html Normalmaps for the Technical Game Modeler] by [http://www.svartberg.com Ariel Chai] shows how low-poly smoothing and UVs can affect normal maps in Doom 3.&lt;br /&gt;
* [http://wiki.polycount.net/3D_Tutorials/Modeling_High-Low_Poly_Models_for_Next_Gen_Games Modeling High/Low Poly Models for Next Gen Games] by [http://www.acetylenegames.com/artbymasa/ João &amp;quot;Masakari&amp;quot; Costa] is an overview of modeling for normal maps.&lt;br /&gt;
* The [http://tech-artists.org/wiki/Beveling Beveling section on the Tech-Artists.Org Wiki] discusses how smoothing groups and bevels affect the topology of the low-poly model.&lt;br /&gt;
* The two-part article [http://www.ericchadwick.com/examples/provost/byf2.html#wts Beautiful, Yet Friendly] by [http://www.linkedin.com/in/gprovost Guillaume Provost] explains how smoothing groups and other mesh attributes cause vertices to be duplicated in the game. The vertex count is actually what matters in-game, not the triangle or poly count.&lt;br /&gt;
* [http://www.poopinmymouth.com/tutorial/normal_workflow_2.htm Normal map workflow] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] demonstrates his normal mapping workflow in 3ds Max and Photoshop.&lt;br /&gt;
* [http://dodownload.filefront.com/9086954//72f71c0147df53765045a22253c18361a29a6d532425842007ead644d39cbb85d0794ab560365cfa This video tutorial] by [http://www.custom-airbrush.com/ Jeff &amp;quot;airbrush&amp;quot; Ross] shows in Maya how to subdivide the low-poly mesh so it more closely matches the high-poly mesh, to help solve wavy lines in the bake.&lt;br /&gt;
* [http://www.bencloward.com/tutorials_normal_maps1.shtml Normal Mapping Tutorial] by [http://www.bencloward.com/ Ben Cloward] is a comprehensive tutorial about the entire normal map creation process.&lt;br /&gt;
* [http://www.pinwire.com/articles/26/1/Generating-High-Fidelity-Normal-Maps-with-3-D-Software.html Generating High Fidelity Normal Maps with 3-D Software] by [http://www.linkedin.com/pub/0/277/4AB Dave McCoy] shows how to use a special lighting setup to render normal maps (instead of baking them).&lt;br /&gt;
* [http://cgtextures.com/content.php?action=tutorial&amp;amp;name=normalmap Tutorial for the NVIDIA Photoshop filter] by [http://hirezstudios.com/ Scott Warren] shows how to create deep normal maps using multiple layers. Note: to use Overlay blend mode properly, make sure to change each layer's Levels ''Output Level'' to 128 instead of 255.&lt;br /&gt;
* [http://www.poopinmymouth.com/process/tips/normalmap_deepening.jpg Normalmap Deepening] by [http://www.poopinmymouth.com/ Ben &amp;quot;poopinmymouth&amp;quot; Mathis] shows how to adjust normal maps, and how to layer together painted and baked normal maps.&lt;br /&gt;
* [http://boards.polycount.net/showthread.php?t=51088 Tutorial for painting out seams on mirrored tangent-space normal maps] by [http://www.warbeast.de/ warby] helps to solve seams along horizontal or vertical UV edges, but not across angled UVs.&lt;br /&gt;
* [http://planetpixelemporium.com/tutorialpages/normal.html Cinema 4D and Normal Maps For Games] by [http://planetpixelemporium.com/index.php James Hastings-Trew] describes normal maps in plain language, with tips on creating them in Cinema 4D.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=39&amp;amp;t=359082 3ds Max normal mapping overview] by [http://www.alan-noon.com/ Alan Noon] is a great thread on CGTalk about the normal mapping process.&lt;br /&gt;
* [http://forums.cgsociety.org/showthread.php?f=46&amp;amp;t=373024 Hard Surface Texture Painting] by [http://stefan-morrell.cgsociety.org/gallery/ Stefan Morrell] is a good introduction to painting textures for metal surfaces.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span id=&amp;quot;D&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span id=&amp;quot;Discussion&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;
=== Discussion ===&lt;br /&gt;
[http://boards.polycount.net/showthread.php?p=820218 Discuss this page on the Polycount forums]. Suggestions welcome.&lt;br /&gt;
&lt;br /&gt;
Even though only one person has been editing this page so far, the information here was gathered from many different sources. We wish to thank all the contributors for their hard-earned knowledge. It is much appreciated! [http://wiki.polycount.net {{http://boards.polycount.net/images/smilies/pcount/icons/smokin.gif}}]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[[Category:Texturing]] [[Category:TextureTypes]] [[Category:Bump map]]&lt;/div&gt;</summary>
		<author><name>Noors</name></author>	</entry>

	</feed>