BACK TO TEACHING HOMEPAGE

BACK TO COURSE HOMEPAGE

   
     

MAA 3312: Advanced Texturing and Lighting

In this course the students will learn to apply traditional paint concepts, tools, and techniques for use in computer animation. They will develop critical ideas for surface treatment, texture, and lighting and demonstrate the layering of light in space to create mood, emotion and theme.
Furthermore, they will demonstrate an understanding of global illumination, final gather, Radiosity, and HDRI. Finally, upon completion they will be able to critically understand how light affects a surfaces’ color based on material: Diffusion, Gloss, Specularity, Reflectivity, Translucence, and Ambience.

 
     
JUMP TO A SPECIFIC WEEK:

 

 

Week 5: Specular, Normal, Bump, and Displacement Maps:

 

Specular Mapping Using Zbrush and Mudbox:

Specular maps are the maps you use to define a surface's shininess and highlight colour.
The higher the value of a pixel (from black to white), the shinier the surface will appear. Therefore, surfaces such as dry stone or cotton fabric would tend to have a very dark specular map, while surfaces like polished chrome or plastic would tend to have lighter specular maps.
The colour of a pixel is also used, to calculate the resulting colour of the surface. A very saturated specular map will have a very different visual effect than a grey specular map. If you need a more "neutral" highlight on a surface, your specular map should use the inverse of the diffuse map's colour. Using the same colour on the specular as on the diffuse will result in a more saturated highlight when viewed in the game.
You can use contrasts in specular to make a surface appear more visually interesting - for example, this door has a very dark specular for the wood while the metal parts are much lighter, which will make the metal stand out more as a shinier surface when light hits it. This sort of contrast can help make surfaces in the game appear more realistic too.

 

Mudbox also allows you to easily create Specual Maps right onto your model. Simply create a specular map channel instead of the diffuse map channel shown in the videos below:

 


 

Creating Difference Maps in Photoshop, Crazybump, Maya, Zbrush, xNormal, and Mudbox:

Heres a site that explains some of the complex stuff: Normal Mapping Tutorial part 1, Normal Mapping Tutorial part 2
Heres the Wiki on Normal Mapping: Wikipedia

What is a Difference Map? A Difference Map refers to a type of mapping, applied to a surface that creates a change in the appearance of the model as if the object itself was shaped differently. This map often depicts the change (difference) between the a low poly model and a higher poly (or percieved higher poly) mesh. There are two basic types of Differnence maps, displacement maps and bump maps. Displacement maps effect change in the surface by simulating the effect of extra polygons "tesselation" at render time to cause an effect where the actual geometric position of points over the textured surface are displaced, often along the local surface normal. It gives surfaces a great sense of depth and detail, permitting in particular self-occlusion, self-shadowing and silhouettes; on the other hand, it is the most costly of this class of techniques owing to the large amount of additional geometry. Displacement Maps are a Height Style Difference map, meaning that they have the look of an all gray image with dark areas pushing down and light areas rising up.

The original implementation of displacement mapping required an adaptive tessellation of the surface in order to obtain micropolygons whose size matched the size of a pixel on the screen. To distinguish between the crude pre-tessellation-based displacement these renderers did before, the term sub-pixel displacement got introduced to describe this feature.
Sub-pixel displacement commonly refers to finer re-tessellation of geometry that was already tessellated into polygons. This re-tessellation results in micropolygons or often microtriangles. The vertices of these then get moved along their normals to archive the displacement mapping. The effect is that surfaces which are Displacement mapped exhibit preturbances into their silhoutte (alpha).

Bump maps can actually be broken up into two catagories, Tradditional Height Style Bump Maps (refered to hereafter simply as Bump Maps) and Normal Maps. Both types of maps have one thing in common: they do not effect the object's silhoutte like Displacement maps do. Bump maps are a grayscale map used to fake the same look that displacement maps actually achieve by creating new geometry by preturbing the surface normals up or down based on the luminence of value of the map applied.

 

Bump Maps versus Normal Maps:

One of the major differences between Bump and Normal maps is they way that space is handled. With a Bump map, as we are all very well familiar with so far, height and depth are determined as a greyscale value with white being high and black being low. Of course, implicit in this formulation is the understanding that height and depth are thusly RELATIVE to each other. For light grey to be high, it has to be higher than dark grey. Without a darker grey area to define how much lower the lowest area should be than the highest areas, we are unable to determine our bumping effect.

Normal Maps work entirely different. Since a specific color value is used to determine the direction which a surface normal is
preterbed, there is no relative effect at play. Thusly Normal Maps are ABSOLUTE in value. Each RGB color points to XYZ space and that value is accurate without having to process their relativity scaling through an external node, which is why they can be processed by Hardware (and thusly are perfect for gaming applications).

 

Tangent Space Normals versus Object Space Normals versus World Space Normals:

There are three ways to define Normals space, off the Tangent, off the Object, and in relation to the World. To Render Normals in Maya we will need to calculate our maps using the Tangent Space Normals (TSN) configuration. TSNs will calculate the RGB values based on the original direction that each face's normal points. OSNs are calculated based on the the direction the object is positioned in XYZ space. WSNs calculate the vector direction based on the position of the object in world coordinates. These Maps have different uses:

Tangent Space Normals-can work on characters and objects that deform since the vector direction is based on each face
Object Space Normals- can not work on objects that deform since the vector is created off of the pivot point for the object. But, they render faster than TSN, do not exhibit seam problems (which TSNs can), and can be used for non-deforiming moving objects.
World Space Normals- are computed off of the 0,0,0 coordinate of world space and thus can only be used on objects that do not move in any way.

The Major Benefit of normal mapping is that we can create a type of difference map that actually renders in real time. Normal maps use a color value to indicate which vector an object is pointing in. For Tangent Space Normal maps, the RGB Color Value for no deflection (pointing straight up) is 127,127, 255, its HEX code is #8080ff.

 

 

Click on the image below to learn how to Fix Normal Map Seams:

 

Photoshop - Combine Normal Maps from CG Bootcamp on Vimeo.

 

Click on the image below to learn how to Fix Normal Map errors on hard edges:

How are difference maps created:

Usually there are 4 different approaches to creating a difference map.

1. They can be drawn manually such as grayscale bumpmaps in photoshop

2. They can have a filter or process applied to an already existing image, such the nvidia filter for photoshop, or the normalRGB material in Zbrush

3. They can be calculated from 2 (or more) seperate objects, usually a highpoly and a low poly, but can also be multiple objects to one single object. This is seen in Maya and Mudbox's search envelope method, and Zbrush's raycasting method.

4. They can be created based on a subdivision hierarchy such as standard displacement and normal map generation in zbrush.



Click on the image below for a video about Bump and Spec maps:














Creating Difference Maps from a texture-first approach:

 


Creating Height Style Maps in Photoshop: The Tire Tred

In class I will use the example file below (or a similar file) to demonstrate how color maps can easily be made into normal maps using CrazyBump and Photoshop.

One of the simplest ways to create a bump map is to desaturate a color map. The target is a good 50% middle gray with white representing higher spots and black representing lower points. In the case below, the color map had a darker, muddier bottom which works easily when desaturated to create depth:



However, what if, the truck that made these hadn't run through muddy ground, but over sandy ground. The color texture at the "bottom" of the track would be lighter, and when we simply desaturate the map, this technique would produce the opposite result from what we intend:


At this point in time, I can use one of several solutions to "fix" the result.
a) I can invert the bump map
b) I can use an the Replace Color Adjustment, by eyedropping
to select the color (or colors in case of the eyedropper+ icon at the top).
c) I can use the High Pass Filter and later adjust the contrast


To turn this bump map into a normal map, I can use either Crazybump or Photoshop.........

 

Creating Normal Maps in Photoshop:

To do this we will need to instal NVidia's Photoshop Plugin Filter which I have conviently located in my faculty folder. You can also download it here: http://developer.nvidia.com/object/photoshop_dds_plugins.html
Its a very simple install. First, make sure that Photoshop is closed. Then, double click on the .exe and click through the "nexts" and "I agree to this and thats", and it will be done within about 30 seconds.

Once in Photoshop again we can now use the filter! Open the Bump Map file and under Filters-->Nvidia Tools choose the Normal Map Filter. The important values to change are in the Height Generation section. Set the Filter type to either 4 sample or 3x3. The Scale will change the depth. Also, look at choosing Invert Y. Inverting the Y will make sure that what was black bumps in, not out. You can experiment with the 3d preview. Also make sure that the Height Source is set to Average RGB and not Alpha Channel. When done, hit OK.... Lets note the background color which is 128,128, 255 or 8080ff in hex. If there are any errors in the map, or parts that you wish to smooth out, use this color value to renormalize the map.

USING CRAZYBUMP to GENERATE NORMAL MAPS, CLICK ON THE IMAGE BELOW:

 

 

 

 

 

 

 

 

Creating Difference Maps from a model-first approach:

 

 

Creating Normal or Displacement Maps in Maya:

Normal Mapping inside of Maya VIDEO

This Process requires having two versions of your model, one high poly, one low poly. We will be using Transfer Maps to create maps with this detail. The Process below is listed for normal maps, but it works just the same for displacement maps (just choosethe displacement button instead).

step 1:

Time to transfer our information. Make sure you are in the rendering window set in Maya, and under the Lighting/Shading menu, choose transfer maps:

step 2:

Select the lowpoly object and click Add Selected for our Target Meshes section since we want to transfer our information to this model. Make sure to leave the Search Envelop at 0.0 so that Maya wraps its search area tightly around the model when creating the maps.
Now select the highpoly object(s) and click Add Selected for our Source Meshes section. This will now make this model the source of the information to be transfered.
Under the Connect Output Maps rollout, set it so the Maya will automatically Connect the new maps to the shader, and have it add those maps to the already assigned shader. (before doing the transfer, make sure that you have assigned your own material)


I assign the low poly arm as the Target Mesh and the high poly (sculpted) arm as the Source Mesh. Choose Normal as your output map, and define its name and file format (TGA).

step 3:

Click on the Big 'ole Icon for Normal Map under the Output maps tab. Set the destination and name of the map in the first window, then it's file format in the second (targas will work very nicely). For the reasons explained on the last page, make sure that out Map space is set to Tangent space.
Under the Maya Common output, set the size of the map next. We will want to transfer our maps in Object Space not World Space as this will make sure that even if the meshes are not overlapping, the map will still transfer properly. DO NOT CONFUSE THIS WITH THE SPACE REQUIREMENTS FOR THE NORMAL MAP!
Set your sample quality, and when done, hit Bake (or Bake and Close).



step 4:

This will automatically attach the newly created normal map to a bump2d node which has been set to be used as tangent space normals (not as bump). Note, this option not available before Maya version 7.0. This map has then been attached to the blinn's bump map section.


 

USING xNormal to create normal maps:

 

 

USING Zbrush to GENERATE Tiling Textures:

CLICK ON THE IMAGE BELOW for a video of the process:

 

Another video of the process:

 

In my own version, I first created a rock from a simple polygon sphere.
Then I deformed it using the move elastic brush, planar trim, flatten, and clay brushes
Next, I added two layers of procedural surface noise to break it up.
I did this all on different 3d Layers so I could create and blend to make variable rocks.
I set my material to a gray mat cap, and created a polypaint with a spray stroke and a splatter alpha

From this rock I was able to snapshot it to a square 1024x1024 document (snapshot is Shift-s), rotating and moving the rock. I made sure not to touch the edges of the document. Once the I was ready to texture the edge areas with rocks, I left edit mode on my last rock and used the ~ key to pan/offset the document. From there I just kept snapshoting rocks until it was full up. This allowed me to create a full document.

I performed a Render on Best Quality, then exported the following image to be my color map:

Finally, I grabbed the NormalRGB material, set Zadd to off, and made sure I set MRGB to on and my color to White. I grabbed the Single Layer Brush (in the tool palette, its a 2d brush) and painted the whole document.
I turned off shadows in the render settings, and this gave me a matching normal map that I was able to also export for use in Maya:

 

Creating Displacement and Normal Maps in Zbrush and Rendering in Maya:

Creating Displacement Maps in Zbrush4:
Creating Displacement Maps in Zbrush 4 can now be done at the same time that maps are created for Normals, Polypaint Texture, AO, and Cavity using the Multi Map Exporter.
Once the Multi Map Exporter Plugin is installed from the Download Center <----link, you can then access it under the Zplugin Palette. The options are intuitve from there!

Creating Displacement Maps in Zbrush 3.2 and 3.5R3:

GENERATING THE MAP IN ZBRUSH------

-Since we are calculating the difference between the HIGH and LOW poly models, we will need to roll down our Geometry level.
-In Tool Palette's Geometry Subpalette, set your SDiv level to level 1.
-Obviously, you'll need UVs on your model first, so make sure those are established.
-Then we need to establish the size of our Map. Go to Tool-UV Map and click on one of the presets (in this case, 2048)

-Open up the Tool-Displacement Map sub-palette
-Choose Adaptive, BUT NOT SmoothUV, set your DPsubPix to 2 (if your map is 2048, 1 if 1024, 4 if 4096... you get the idea)
-Hit Create Displacement Map.


-Again, within a short period of time, the map is created.


EXPORTING THE MAP TO MAYA USING GoZ FILE FOR EXPORT------


If GoZ is installed, you can use the GoZ Icon in the Maya Shelf to send your selected objects over to Zbrush Automatically.


Then in Zbrush, you can use GoZ to send the mesh back to Maya



GoZ Video Tutorial:

 

EXPORTING THE MAP TO MAYA USING .MA FILE FOR EXPORT------

-Now, if you export your Tool as a Maya file(.ma), the Displacement map (along with any other created maps that are stored in their palettes (texture, normal too) will get hooked up for you automatically.
-If you export a Maya file, you need to make sure that you have Mental Ray loaded in Maya before importing, otherwise it will not establish the file links correctly
-Doing this method will automatically hit "3" for you, creating a subdiv proxy.
-By Using an .ma file, all of the approxmiation and scaling elements should be linked up for you, but to understand how to control them, you can read on....


EXPORTING THE MAP TO MAYA USING .OBJ FILE FOR EXPORT------

-If you are reimporting as an OBJ or if you you are hooking your Displacements up to a Maya file on your own, you will need to establish a couple of things, using Mental Ray, to assure quality renders.
-First, Hit "Clone Disp" to send this map to the alpha palette, where it can be exported. Then Export it as a Tiff

When Importing, make sure to open the Options Box. Under File Type, Switch from Best Guess to .OBJ.
Then, scroll down in the window till you get to the File Specific Options. UNCHECK "Create Multiple Objects".
If left on, this will screw with your vertex order and could mess up our rendering or future animation needs!!!!!!



First thing out, Hit "3" with your mesh selected to turn it into a subdiv proxy. Once you have it "smoothed", you can add in the displacement map.


 

MANUALLY HOOKING UP DISPLACEMENT IN MAYA------

Time to add the displacement map. Assign a material to your model (I used a Blinn), and click on the Go To Output connections button, seen below:

This will take you to the Shading Group node. Here you will want to add a Displacement Map. Clicky on the Checker Boxy!

Find your file:

Make sure you are using Mental Ray, and set your Quality Presets to Production.

Hit Render Current Frame!... and OMG, what the Hell happened?????

Don't Panic! What you see based off of the fact that by default, there are several things wrong with Maya's interpretation of Displacement Maps from Zbrush. First of all, we haven't set a scale to determine the relative amount that our Displacement map needs to displace the surface (remember from the theory reading above???). Zbrush creates Alphas with Black as 0 (no change to the surface) and white being 1 (severe change to the surface). Maya does something wholly different. It says that 50% Gray is no change, that Black is a severe downward change, and that white is a severe upward change.

We are going to have to adjust our settings to reference this. Instead of our Alpha Gain being a value of 1 and the Offset being a value of 0, (the default values) we are going to have to make the Gain twice the negative of the Offset Value. See Diagram Below:


As you see in this image, I have gone into the color balance section of my Displacement Map, and Set the Gain at 0.2 and the Offset to -0.1. These values were generated using a guess and check method. Alternately, try using a height field node to narrow in on what you need. The only rule here is that the Gain should always be twice a negative version of the offset. Since this is constant, try using the following espression to generate the changes for you. In the alpha offset field, type:

=-file(#)alphagain/2
If your texture is named file3 you would type =-file3alphagain/2, or if it is file14, it would be =-file14.... and so on.

One of the things you might notice in the render above is that the displacement might still look a little angular around the edges. This is becuase Maya prefers to render displacement off of a subdivisional surface, and not off a polygon mesh. First, we must turn off Maya's regular Feature Displacment however. Select your mesh. Go to the Attribute Editor and click on the Shape Node's Tab. Under Displacement, uncheck Feature Displacement!!!!

Good News Everybody! We can get out mesh to behave as a Subdivision surface with Mental Ray Surface Approximations. We will use just a Displacement Approximation (this is different from previous generations of Maya and Zbrush where we also used a Subdiv Approxiamation) to generate a smooth surface with which to displace from. In Maya, go to Window--Rendering Editors--Mental Ray--Approximation Editor, as seen below:

With the mesh selected, click create for a Displacement Approximation. This will assign the approximation to the mesh.

For Displacement Approximation, set the Approx method to Spatial which will allow us to set a range of levels with which it can subidivide the model at render time to make it look smoother. I set my range to be no less than 2 and no more than 3, but these values can be adjusted for speed or for quality. I next set my length to 0.100. This value determines the length of the smallest triangle when the model is tesselated. Too small, and your render will take too long. Too big, and you will suffer from poor quality. Next I check the box for View Dependent meaning what we don't see, won't do anything (saving render time).

And here's my render now, slightly smoother, AND notice how we can see a little more detail in a few of the features (I'm looking at the head crest) and also notice how my render time has DROPPED!!!!! to 0:06 seconds from 0:14 seconds when we started.

Now, just light your scene, add your other maps, and you are good!

 

BACK TO TOP

JUMP TO A SPECIFIC WEEK: