How to Tangent Space Normal Map aka dot3 map

Tangent Space Normal Mapping allows you to bake lots of 3 dimensional detail into a low poly object. It also maps per face, so no matter how the object is deformed, the “displacement” effect continues to be accurate. It is used today in many popular titles such as Doom3.

There are two other tools I know of that can be used to get this type of mapping, MeLODy and ORB. MeLODy can be found at NVidias website, and IMO, is the most difficult to use. ORB is command line, and open source, but difficult to find on the internet. Regardless, I have tested 3 such tools for this job, and the best, by far, was given to us as Macuono’s BRayBaker.

Folks, if you love game art, and you love making it, this script is by far the most powerful weapon in your arsenal. It is a miracle script. Anything you can get Blender to render, it can bake to your UV’s. To repeat myself…
Anything you can get Blender to render, it can bake to your UV’s.*

*camera angle based calculations, like specularity, transparency, or reflectivity, may not turn out as you envision.

Imagine the details you can pack in, but not just 2d detail, normal mapped 3d detail.

(NOTE: The technique I am about to describe has only been tested with version 2.37a! Something changed in 2.4, and currently, baking from a hi-poly object, to a low poly object is very difficult, and I have not been able to get it to work correctly. —not true anymore, whatever was broken was fixed in 2.41!)

(NOTE II: I am simply providing how to set it up. There is much reading online about how to make TSNM correctly. There are lots of rules and nuances. You will have to do much more reading on the subject to get these maps to start producing the results you want. If you do not know what a tangent space normal map is, you need to google and start reading, and it will take time and focus to understand the theory… the technology itself is only about 2 years old!

This thread at cgtalk is a good start: http://forums.cgsociety.org/showthread.php?t=129627 )

http://img189.imageshack.us/img189/2294/vsnmrealtime7mu.th.gif

http://img71.imageshack.us/img71/6610/vsnmtest5ou.gif

Above is a UV mapped low poly part of my Fuel refinery

OK, now for the mini tutorial.

  1. Go to here: http://www.blender3d.org/cms/Normal_Maps.491.0.html in there you will find the instructions on how to make a normal map in Blender, and a .blend with the normal map material.

  2. Download the .blend, make a copy and rename it, then open the copy. (this is so you can save the original material to be used on different projects)

  3. As you know, we are going to try to bake the 3d details of a hi-poly mesh to a low poly mesh, (BTW… on a tangent, Cambo is working on the sculpt mesh script, which when finished, could very well be another very powerful tool on par with ZBrush, for making a hi-poly mesh). So now you will need to append the hi-poly and the lo-poly mesh to the open material file from the Blender website.

  4. delete the meshes and lamps that were in the blend, all you want to use is the material, and the camera, (be sure it is in Ortho mode).

  5. Set the world colors to R 0.5, g 0.5 B 1.0 (pale blue) noteallthough this may not be necessary, I think it will help hide seams even furthur, should the script find difficult areas

  6. Apply the material to your hi-poly mesh.

  7. Now it is time to run BRayBaker.
    Be sure to bake it to the UV coordinates, and be sure to render the hi-poly object’s layer, but select the low poly object for baking.

(NOTE III: BRayBaker is an advanced tool, and as such, you will need to visit his site he provides a link to in the elysiun thread, and I have found it may take a little practice and getting used to, but it is better than MeLODy or ORB, in the way that it cleans up seams very well, which if not cleaned, look horrible in the final result)

  1. There you have it. the final result should give you an image, that you can apply to your lo-poly UV map. If done correctly, the image should be mostly that light blue color with green and red hues showing the 3d details.

+++++++++++++++++++++++++

Blender does not support TSNM’s, (It can generate a correct map, but cannot use the map) but if you leave the low poly model in it’s place, (no rotating, but movement and scaling is fine) and render an animation, it will render the low poly model and it’s details correctly.

The only way to fully test whether your TSNM worked correctly would be in an environment that supports TSNM shaders, then you could bend, twist and rotate the model, and still have the normals displayed correctly.


Hey thanks for the tut, you need to edit the link to BF’s site though, it’s got a . (period) on the end of it which prevents it from loading unless you notice and remove it then reload. For a second I thought the site was down again.

the script’s page

http://www.alienhelpdesk.com/index.php?id=22

the script’s page here

https://blenderartists.org/forum/viewtopic.php?p=535813#535813

Are there any sample files to work with? Or possibily point to some files in the test suite I could use this on?

If so I can test braybaker and possibly add it for the next release (assuming the author desires so)…

Also can someone explain the differences between braybaker and the texturebaker of jms that is included?

Thanks,

LetterRip

OK

http://rapidshare.de/files/11039663/VSNM-tutorial.zip.html

Here is a zipped file, in it is included a screenshot of the settings I used with BRAYBaker, and the VSNM that was produced after running it. It is already applied in realtime display, if you extract the 3 files to the same folder, but you can still run the script, if your settings match the screenshot exactly.

I am hoping ot use these 2 cubes as an example, as well as show some of the things VSNM cannot do. The “L”, “H” and “sphere” will render correctly.

The “U” was too tall, and will look very flat and unconvincing from any angle, the “E” was too deep.

The “O” appears blank, because it used 90 degree angles in it’s indentations.

BRayBaker vs. texturebaker

  1. Texture Baker cannot bake from a highpoly object to a low poly object

  2. BRayBaker is much more effective in taking care of seams, texture baker usually leaves alot of seams that need to be cleaned up afterwards.

  3. BRayBaker has a GUI, but definitely can take hours longer to finish baking.

BRayBaker Tips

+I have found, the most important camera setting is the C-dist setting. If you have details that are deeper, or jut out more than 0.1 blender units, then you will need to adjust c-dist accordingly, or it will clip them.

+I prefer to map to UV coordinates (tile size relativity = UV area), and turn off estimate sizes. Say I want to map my cube to a map 512x512. As you can see, the cross is 4 squares across. 512/4 = 128. For this particular model, all UV faces are the same, so both min and max settings should be 128.

+be sure your render size set to 100%, or things will look pixelated

+try to keep details on the hi-poly model smaller then the smallest gap between faces on the low poly model, to avoid clipping issues.

+as Macouno says on his sight, triangles are bad, they will not help the seam situation. So avoid them when modelling.

+try to keep your faces in some sort of similar size ratio, don’t have one face span 10,000 square units, and another span only 1 square unit.

+the more square-like the faces, the better the results.

+The script works with version 2.41 (current version when last edited)

Tangent Space Normal Mapping Tips

+never have faces perpendicular on your hi-poly model to the faces to be baked to your low poly model. Notice on the cube, all the faces have been sort of “bevelled”. If you render a detail that is 90 degrees to the face you are rendering, you will not see anything.

(see the “O” in the sample for what happens if you use perpendicular faces .blend)

+remember, the silhouette will let you know the details are TSNM details. The silhouettes never lie. That is why your details should not jut-out, or sink in too much. One of the best tricks, I found, was to sink in, and then fill the carved out area with details… leaving the silhouette rather flat.

(see the “U” and the “E” for too much jut and sink. See the “sphere” for a good detail using the carved out technique I described)

+you cannot have any overlapping faces on your UV map*

+You cannot fix things up in photoshop or paint shop, at least not very easily, because ( tan R + tan G + tan B ) == 1

+if you want to know more, and theory, this thread at cgtalk http://forums.cgsociety.org/showthread.php?t=129627 has a fantastic wealth of information, as well as some diagrams to illustrate a couple of other pitfalls.

*Some game engines allow “mirroring”, but the model parts being mirrored of course have to be symmetrical, if this is the case, you can overlap those particular faces.

Some general Baking tips:

+If you plan to do most of your details with baking, keeping the UV islands the same scale is not improtant, (in my opinion). Since I prefer to bake to UV area, I make the areas I want to have more detail larger on my UV map.

Overhangs, the bottoms of shoes, etc, can be very small on the map, since they will not be seen much, and therefore require less detail. A face, however, probably sould take 1/16th to 1/9th of the map.

Has anyone tried this program for generating a map from a high-res mesh to a low-res one?
http://www.seanomlor.com/mikeb/

It was mentioned on Ben Cloward’s normal map tutorial page in that it is like the ATI converter but can work directly with OBJ files.

Shawn

http://img47.imageshack.us/img47/4274/dot3success3ad.th.png

Correction: I have gotten Blender to render tangent space normal maps (but only in object space), by having a spotlight follow the same path as the camera.

Unfortunately, raymir does not like normal maps, it creates a sort of “whitenoise on the TV” effect for the areas that are supposed to be reflective.

Below are divx and windows versions of a movie displaying TSNM in action, the model is only 4998 triangles:

~~The results with just a TSNM UV applied to nor in “mapto”, and normalmap in “image”, and (.avi format)
568Kb, divx

296Kb windows media

~~for fun, what it looks like if the TSNM is mapped to “col” instead of “nor”
http://rapidshare.de/files/14551712/TSNM-col-divx.avi.html = divx 840Kb
http://rapidshare.de/files/14551761/TSNM-col-win.avi.html = windows 486Kb

basically, this means when displayed in the position the model had the dot3 map baked into it, it will render correctly, animating, hower, will mess it up.

P.S. – Shawn, I have not seen that program or tried it.

Thanks for the tut NeOmega, it is very detailed.
However I’m not able to get decent results with BRaybaker. I tried it on a simplified uv-unwrapped Suzanne with a subsurfed one, but I get very disturbing seams and artifacts.

What worked for me was this app http://www.santyesprogramadorynografista.net/projects.aspx

Problem is its windows only and I’d rather work on my linux computer. To show the difference, after hours of trying this was my best result with Braybaker
http://img139.imageshack.us/img139/2853/normalmaptestraybaker5op.th.jpg

First try with xNormal:
http://img299.imageshack.us/img299/2720/normalmaptestnormalsanddisplac.th.jpg

Yes, I have noticed after much experimentation, that for architectural and vehicles and such, which is mostly what I do, this method works.

However, because the way BRayBaker takes and average of the faces tangent it is baking to, (I think is the problem) it does not do biological and subsurfaced features well. that means I’ll probably go back to usign Orb or meLODy for those tasks.

But Ill still use BRayBaker to create the first layer, becasue it is still the best at expanding seams colors around the UV islands.

So I would BRAY bake, then use the other map, with the black as alpha, and paste it on top.

like so
http://img146.imageshack.us/img146/6656/normalmaptestraybakerblended6a.th.jpg

Ill have to look at http://www.santyesprogramadorynografista.net/projects.aspx

edit: same with whne baking color maps. I have read on line plenty of times people talking abotu they clean up the seams by using photoshop, this wshould put you one step ahead.

These are quite bad news… I’m trying to find/release a complete toolchain for producing dot3 bumpmapped meshes in linux too, but there are just 2 ways to accomplish this: Denormgen which needs fox (which is compatible with gcc-4.1 only in the latest version) and itself has issue to compile in newer gcc, or BRayBaker. Orb, Melody, Ati Tools, etc. are all limited to the windows words, shame

Ati’s normalmapper (the one without a GUI) works with WINE and you can export to nmf with the script on this page
http://www.ogre3d.org/phpBB2/viewtopic.php?t=8595&postdays=0&postorder=asc&start=0
This is the best working option for me sofar. Other than the Gimps normalmap-plugin that is.

If someone knows howto make the script call normalmapper.exe through wine then linux users wouldn’t even have to use the console.

The author of XNormal also mentioned that he was planning on making a Linux release. Not very usefull if you need normalmaps right now, but something to look forward to.

HI Dual Joe,

Finally got around to trying this normal mapper. (xNormal)

But it doesn’t seem to like my .obj files. What are you exporting to from Blender?

Sorry NeOmega, was called back into active service and have been offline for a couple of months now.

In case you’re still interested, there’s a new version of xNormal and it should support a number of formats that Blender can export. Obj-format worked for me, but I haven’t tested the new version. Collada should work.
In the end it’s the texture you’re interested in, so the format shouldn’t really matter.

Up till now I’ve painted my normalmaps by hand with the Gimp.
As soon as I figure out how to draw straight lines with the new sculpt tool, I’ll switch to high-res-modelling.
In windows I’ve mostly used nfz normalmap plugin from the ogre-forum, but I prefer denormgen with linux.
Gentoo is more stable and way faster than windows on my box. Really makes a difference with the huge textures I’m doing.

Would be really nice if Blender could generate AO-, normal- and displacementmaps, what the hell why not faster texturebaking while we’re at it.

Just had an idea:
Wouldn’t Aqsis (or any other Reyes-renderer) be able to render to texture, or generate normalmaps for that matter?
I remember doing a tutorial about rendering an AO-map with Aqsis, it was fast as hell. Too bad I don’t understand RIB-files.