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. |
||
|
JUMP TO A SPECIFIC WEEK:
|
Week 7:Grab-bag week.
This Week we will take a look at several diverse topics based on student interest. These topics may include:
-Creating Light Fog
-Using Photon and Shadow Shaders
-Creating UV sets for: Layered Shaders, Lightmaps, Characters
-Creating Contour Renders for wireframes
-Using Mental Ray Render Proxies
-Texturing with Zapplink in Zbrush, or Mudbox Projections
CREATING
LIGHT FOG:
Here is the link to my Light Fog Demo using Mental Ray:

CREATING PHOTON AND SHADOW SHADERS:
Click on the image below for a discussion of Mental Ray Shadow and Photon Shaders:

Creating Hair using Textured Planes (also great for games)..... requires shadow shaders:
For this character I decided to use textured hair planes. The advantage to this is 2 fold: I have direct texture control over the look of the hair, and also that this type of hair works in a real-time enviornment.

Here is what the geometry looks like for this head of hair. It is made of 300 or so overlapping NURBS planes (but Polyplanes can also be used of course). I have the freedom to sculpt and model them however I want. However, It is important to note that they are ALL ORIENTED THE SAME WAY as seen in the second image where I have applied a ramp texture to the material. Notice that red is consistently the tip side of the texture plane, and blue is consistently the root side.

I created these planes by generating EP curves, exactly the same as in the demo above on long hair using Maya Dynamic Hair. Except this time, instead of creating a hair system and attaching it to the curve, I am creating geometry from the curve using Surfaces-Surfaces-Loft. Select the two curves and choose this option to output NURBS geo by default. Remember when you do this though that your EP curves need the same number of spans and need to be drawn out the same way (root to tip) to make sure the UVs orient correctly too. If you care to output to polygons, you can do so by swapping these options. For curly or wavy hair, you will need a higher count. For straight hair, set the count as low as you can go which will make just a single face plane. From here we can now make the texture for the hair (assuming that you have now created all of the geometry). Go to Window-Paint Effects:
Click on the "double brush" icon shaped like a "V" to open the Visor. Choose the hair type you desire:

We want to set the canvas size under Canvas-new (I chose 1024 square here), and VERY IMPORTANTLY you should edit your background color to roughly match the color of your hair. Leaving it white usually makes the hair look "fringed" as the white blends with the alpha creating a 1 pixel "Stroke" of white around each hair. UGLY.

Click the Paint Effect Brush Settings Icon shown below to open the Settings window. To straighten the hair, you will want to edit the number of Multi Streaks, Segments, and Length Min and Max shown in the two images below. You can also edit the color under shading. Draw out on your canvas to test, you can always crop these out to separate images later.


Now the cool part about this process is that when I create a color map, it also SIMULTANEOUSLY creates a matching alpha channel for transparency!!!! Just save your texture as a targa when you are done.

Now lets move on to hooking up the texture. For simplicity's sake, I am going to do this to a single plane in a test scene. I create a new Blinn material and drive the outColor and outTransparency from the texture into the Color and Transparency nodes of the blinn. When I hit "6" to enter textured mode, it gives me the following look in the viewport. Looks great, right???

Well when I render, there are two apparent problems. 1 is the blown out specularity since the Blinn is completely shinny the surface looks laminated in plastic. 2 is the fact that the shadow takes on the shape of the square plane, not the shape of the hair.

So, I head to photshop where I make a specular map out of the alpha and color maps combined. I hue shift it blue to give the sheen off the hair a slight bluish tint. I put black in the "alpha" area and then load this into Maya where I apply it into the Specular Color channel of the Blinn. And now.... NO laminated look. Hooray! But, one problem still remains, the square shadow....

To fix this, I need to create a Mental Ray shadow shader. See... mental ray is kinda dumb. It needs your help to figure out what this shadow is really supposed to be doing.
Go to the Blinn's shading group node by click the "spaceship exiting the stargate" button (just to the left of Presets). Open up the Mental Ray section and under custom shaders hit the checkerbox for Shadow Shader. Here, create a Mib_shadow_trans (as seen in part 2 of the image below). In the Transparency section of the
Shadow Shader, you can input the Alpha from your color map (outalpha to Transparency).

But then you render and this happens..... Um... Dear Mental Ray... WTF???
Ok, so MR is, for some god-forsaken reason, BACKWARDS from Maya when it comes to alpha detection. What this means is that where there is black, Mental Ray sees white.
Seriously, WTF....

So what we need is a Reverse node between the Color texture and the Shadow Shader:
![]()
Take the Color node and MMB drag it onto the Reverse node. Connect OutAlpha to Inputx/y/z as seen below. Then hook the reverse into the transparency of the shadow shader, and finally that shadow shader into the shading group of the Blinn (which you should have already).

And finally, your hair will render with proper transparency!

CREATING UV SETS:
Maya Multi UV Set Tutorial from Dror Lazar on Vimeo.
UV sets are created for the purpose of applying seperate texture maps to different parts of a model, often as seen below, with the case of Game-ready characters for a Head and a Body. Unreal Tournament 2004 specifically requests this setup in fact. To establish UV sets, simply layout your model's UVS in two groups, seen below in the animated GIF, overlapping each other. The First thing we need to do is make sure that our UVs are in the correct spot BEFORE creating UVsets. Not doing so will cause improrer texturing later on.
1.Select
the first group of faces, in this case the body, and Choose "Copy
UVs to UV set-->Copy to New UV Set" option under the Polygons
menu in the UV texture editor, call it Body.
2. Now, you will notice a new UVset has been created which can be seen
under the UV Sets menu in the UV texture editor.
3. In this menu, return to map1. You will again see both parts. Select
the other group, in this case the head.
4. Again assign the head's faces to a new UV set called Head.
5. You can toggle back and forth at any time with the UV Sets menu. Use
these isolations to assign materials directly to the faces of the model.



Layered
Textures- The Layered Texture node allows
me overlap AND BLENDmultiple
textures to control one attribute at a time on a matierial (such as
color, specularity, ambient color, etc...). In the example below, Checker1
is covering Crater1 based on the pattern of Grid1.The
Grid controls the alpha slot on the layered texture, and the output 1 MATERIAL, MANY TEXTURES.
As mentioned above though, there are several ways to blend the textures
together, as controlled by the Blend Mode (circled below). By default
it is se to over, which simply overlaps the textures, but other modes
such as: In, Out, Add, Subtract, Mulitply, Difference, Lighten, Darken,
Saturate, Desature, and Illuminate work just like
layers in Photoshop.

Layered
Shaders-Like a layered texture,a
Layered Shader allows us to combine material effects. However, whereas
the Layered Texture was only capable of displaying a layering of one
texture input (such as color, transparency or bump), the Layered Shader Overlays 2+ Materials (blinns with lamberts, anisotropics
with phongs, any combo will do, even lamberts with lamberts.... ),
with the transparency of materials on top governing the visibilty of
materials beneath. Notice how in the figure below the The flat (red)
lambert masks out the Blinn material (blue) based on the Checker pattern
filtered which governs the transparency on the lambert. NOTE:Transparency doesn't mask out specular
highlights, so if the red material was a blinn, expect to see a highlight
still present in the transparent area, which of course would warrent
the use of a specular map as well.

This effect is the same as what we see happening in this render:

Using Layered Shaders to hide tiling-Layered Shaders can be used to create unique seaming spaces with small tiling textures. In the image below, you can see the effects of Layered Shaders at work, where the base brushed metal and diamon plate shaders have two varrying dirt shaders applied on top. When lit properly, it is nearly impossible to tell that there is repeat in the tiny 256x256 textures that are used in this shot since the dirt layer and then the lighting/shadowing further obscure the repetition (click image below for larger):
Here is a look at the shader networks used in the shot you see above:

Using UVsets to Create Lightmaps-Lightmaps use UV sets to bake out all lighting information so that the artist doesn't have to use lights on render time (or when drawing in an game engine).
In this example, we might have a building with many parts. In this case, we see the tiling layout of scaled UVs for a brick wall. Notice how it extends far beyond the 0-1 space so it can use a tiny 256x256 repeating brick texture.

First, combine all the objects in your scene, and Create an Automatic Map. OR, layout the already existing UVs using Polygons-Layout. Assign this to a new UV set called Lightmap.

Next, you want to Select your object and Choose Lighting/Shading---BatchBake (Mental Ray)---options.
Set your options as shown below (pay close attention to where there are red-dots).
Under Color Mode, we choose Light and Color, but note that in the drop-down, you can also choose to bake bounced light (global illumination) or your Ambient Occlusion!
Prefix the file name and give it a size (in this case "lightmap" at 1024sq).
Under UVset name at the bottom, make sure to type in EXACTLY the name of your UVset with perfect capitalization and spelling. Then hit "Convert and Close"

You will get a map that looks like this, showing you the postion and color of your illumination:

Create a shader network, and apply the lightmap into the ambient color channel using the UVset relationship editor as discussed previously:

And, here will be your final result. NOTE, this is NOT a render, this is real-time viewport in HQ mode.

Click on the image below to learn how to render clean wireframes with the
Mental Ray Contour Shader:

Wireframe Rendering from CG Bootcamp on Vimeo.
Using Mental Ray Render Proxies:

Projection Painting to Texture with Zapplink:
--First up, we want to make sure our Document Size is correct. Zapplink will not work in Zbrush 3.5 if you have stored out a custome document size (which is utter horse-poop, I know). So when you start up Zbrush, you will have a relatively small document. I describe using Zapplink like trying to paint through a screen door with a can of spray paint. If your screen is too small, or your model is too far away, the paint won't apply correctly. Go to the Document Palette once Zbrush has opened, and up your document size to something BIG like 2000 pixols or larger. My numbers here (circled in red) would still be a bit small for use:

There are seveal factors that can contribute to a bad looking Color Map from Zapplink. To fix this, make sure that you have done all of the following:
------------
Take Large Photos (we already talked about this one)
------------ Set a Large Document Size (we just mentioned this as well)
------------ When positioning your model, position it as large on the screen as possible (zoom out your document in 2d to see it all)
------------ Create a Larger sized texture file to hold all of the information. Here I createa 2048 Map using the presets in Tool-UV Map:

---Now I am ready to start texturing. Create a New Texture under Tool-Texture Map:

---Also, I switch to the Pearl Cavity MatCap Material to assure that I don't get confused with any color addition from material into my texture. By choosing a white material such as this one, it makes it easier to see the "pure texture" that I am painting.

Now it's time to use Zapplink:
--Open up Photoshop (if it is not already open) in addition to having Zbrush open
--Position the model as full on the document as possible and zoom out the document in 2d so you can see everything in full on this large document.
--Also, Subdivide the model a few times so that it is no longer faceted. *** if this causes extreme size change in your model (shrinking from smoothing) then you need to reinforce your edges back in Maya by making a "mid-poly stand-in" model.

--Then go to Docuemt-Zapplink and choose Drop Now

--This will send a screenshot what you are working on in Zbrush, over Photoshop. This canvas in Photoshop will have 3 layers:

-----The Zshading layer shows you your material contributions from Zbrush
-----The Zfill layer is your background gradient
-----And Layer 1 is what you will painit onto. If you add new layers (which you will by adding photos) you will have to merge these layers into layer 1 before saving and bringing back to Zbrush)
--Open a Source photo and copy a small section using the Lasso tool. The smaller the better (within reason) since your warp transform tool, which you will use to place this photo onto the model, only has a limited number of points (16) to control with. Thus if you have a smaller section, and you repeat the process more, you will have more points of control over the course of the project.

(image courtesy of www.3d.sk)
--Copy this, and paste it into the Zapplink Canvas

--Place the image, then Transform it to roughly the correct size to match up with what you see in the Zshading layer

--Use Warp Transform to distort this section into place

--If heavy distortion is needed, pull it as far as you can with the warp transform, then use the Liquify filter to make smaller movements. Note, the liquify filter is a destructive tool, so only use it for small nudges.

--Once you have this in place, select a new section to repeat the proces.

--
My advice is that your new selection should overlap slightly with the previous one, that way you can erase any seam lines and avoid having to clone stamp, which always looks bad. Here is an area where I have a seam, but since I have overlap, I can just erase this out:

--Once I have a more completed area, I can merge all of these layers into a single layer... THEN merge that layer into Layer 1 last. Choose "Preserve" when it asks you what to do with the mask:

--Hit save (ctrl-s) in photoshop to save out the canvas. When you return to Zbrush, you should get this dialogue:

--Just choose "Re-enter Zbrush", and your images will apply onto the model and into the texture.

--If you get this dialogue box, just return to Photoshop, hit save again, and come back into Zbrush and it should work:

Projection Painting to Texture with Mudbox: