Tuesday, September 12, 2006

Render Layers

A multi-pass render breaks out the different components of the beauty pass. Usually these are the diffuse, shadow, occlusion, and specular passes. These can then be composited together to get the final image.

Render layers allow you to do multi-pass renders very easily. Each render layer has overrides on the settings for render components, render settings, model and light membership, and materials.

The power here comes in being able to adjust the layers seperately in the comp, rather than re-rendering the full image. The occlusion pass is often slow, so it's nice to be able to play around with tinting the specular pass or diffuse pass without re-rendering the occlusion. Drop the layers into Shake or Photoshop with the appropriate layer operations and you can tweak away.

Steps:
- Select all the objects and lights you intend to render.

- Create five new render layers, choosing the icon with the blue ball in the render layers window.

- name them, from the bottom up, diffuse1Layer, diffuse2Layer, shadowLayer, occLayer, specLayer.

- RMB-click on each layer to choose the appropriate override preset based on the name of the layer.

- for the second diffuse layer, create a material override by clicking the shaderball icon on the render layer and dragging a different material on car objects.

- turn off the render switch ("R") for the second diffuse layer.

- Set the composite operations to:

specLayer = Screen
occLayer = Multiply
shadowLayer = Multiply
diffuse2Layer = Normal
diffuse1Layer = Normal


- In the render view window, choose Render > Render All Layers ... (options) and switch to Composite and Keep Layers. This will save each pass to the Render View buffer and comp them all together.

- Render the frame.
You'll see each pass render and get stored in the buffer. You can then scrub the horizontal bar under the Render View to check out each pass. Shadow pass lives in the alpha channel. The final image is the comp.

If you want to try the different paint color, toggle the "R" render switch for the Diffuse1Layer and Diffuse2Layer. Re-render and be amazed!

Now, to really make use of this you should do a batch render. First, pick the masterLayer render layer and then open the Render Settings. Change the output type to .psd layers. Then do a batch render. Head over to photoshop to play with the results.


Scene file: beetle02.ma.
Classicbody.jpg
headlight.jpg
chrome.jpg
TyreTexture.jpg

Monday, September 11, 2006

Cel rendering

There are two main components to rendering your scenes in a cel style: ink and paint.

Fill
Paint is the body of the image, usually limited to two or three tones to show the color, shadow and highlight regions of the model. We still light these with direct lights, but instead of the typical lambert, blinn, or phong shading models (with gradients) we will see flat colors and sharp deliniations.

The way to get this paint look is with a ramp shader and a facing ratio sample. Pick your model and then choose Toon > Assign Fill Shader > and pick one. Maya has some presets for these types of shaders (called "Fills") in the Toon section of the rendering menu. Here are the main types:


Solid Color
This is a straight Surface Shader. This is great for objects that you want no shading on, like eyes, for example.

Light Angle Two Tone
This gives you a ramp of two colors for light and dark areas on the model. The color choice come from the direction of the light, and the brightness of the colors will change as the light gets brighter or darker.

Shaded Brightness Two Tone
Similar to above, the color choice comes from diffuse brightness, rather than light angle. Can give nicer curvature of the shading effect over the surface, and the colors are constant -- they don't change based on light intensity.

Shaded Brightness Three Tone
Is like the above, but with a third color in the ramp for the highlits of the surface.

Dark Profile
This one does some trickery with the incandescence to create a dark rim around the profile. Can be a cheap way to avoid ink lines for some models.

Rim Light
This is like the above, only with a bright color incandescence to create a rim around the object.

Circle Highlight
This one creates a very bright highlight by mapping a ramp to specular color, so things look shiny.


Toon Lines
Ink is the other half of the cel render look. Maya can generate magical lines that change based on viewing angle to the camera. To create them, select the model (or a few models) and go to Toon > Assign Outline > New Toon Line. These toon lines can be based on a number of factors:

Profile Lines
Profile lines define the visible outer edge of your model.

Crease Lines
Creases are the hard edges in your model. These can show up even when they aren't at the outer edge of the current model view. For example, the corner of a cube facing you will show up as a crease line with default settings. This can be adjusted based on crease angle.

Intersection Lines
If you create a toon line that spans multiple models you will get an intersection line wherever the two models intersect. Push a ball into a wall and you'll see a line on the wall where the two meet.

Borders
Borders are the final edges in a model or where there is a material change between faces.

Scene file: toonShrooms.

Monday, September 04, 2006

Class Eight notes


final gathering

Final gathering is an approximate global illumination solution that works very well for outdoor scenes and for lighting highly detailed models. It can be used for soft shadows and for shadowing the nooks and crannies of models. Do you remember the Pepperidge Farms guy talking about the English muffins having nooks and crannies? Mmmm. Buttery English muffins…

You could light the nooks and crannies of your English muffin very nicely with final gather. What is a final gather? It is a diffuse raytraced global illumination pass. For a certain sample of the image from the camera’s view, a set of rays are sent out. When they hit a diffuse surface, more rays are sent out in a hemisphere above the point. The average brightness and color seen by these rays is used to light that point. Only one bounce is used (or sometimes two) unlike photon mapping.

So what’s the difference? Photon mapping works well indoors where you have lots of surfaces to bounce photons off of, and is more “physically correct”. But photon mapping won’t give you shadows in highly detailed models or light outdoor scenes the way final gathering will.

Lighting without lights
A particularly groovy aspect of final gather is the ability to light objects with other objects. Huh? Well, since the diffuse rays shoot out from the surface looking for other surfaces, when they encounter a bright or colorful object they’ll be “lit” by it.

This means we can use bounce cards that have bright colors or incandescence values as lights. One of the easiest ways to begin lighting for studio or automotive scenes is with large white cards that are both reflected in the shiny surface and provide light for the scene.

Another aspect of this is that you’ll see nice bounce lighting and color bleed between objects in a final gather rendering.

final gathering tutorial


• Studio Lighting with fg
• Exercise: fg lighting a rocket

• Ambient Occlusion texture
This one is great for building dirtmaps/shadow contact maps. You can take the output into your comp and multiply it against your beauty render. To use it, assign a Surface Shader to your models, and then click on the Create Render Node button next to the Out Color slot in the Attribute Editor. Choose the mental ray tab from the Create Render Node window and look for the Textures section. Click the mib_amb_occlusion button. Now, render your scene to see the awesomeness. You don't need to have any particular feature of mental ray turned on (e.g., final gather, global illum) other than raytracing.

Tune the image, increase the number of samples in the mib_amb_occlusion1 texture from 16 to 128 or beyond.


• Image Based Lighting
• HDR





• Exercises:
IBL and HDR Apartment
Here is my Maya file, in which I've done everything but add the IBL node.

Primitives


Some additional reading and links:
Light probes in HDR
Sunlight probes
Creating a light probe

Tuesday, August 22, 2006

Diffuse Global Illumination

Photons can be used to bounce energy around the diffuse surfaces in your scene. This approximates the ambient light bounce that we've been faking with our fill lights up until now. Each bounce of a photon off a diffuse surface will impart some of the color information of the surfaces it contacts.

This is set up in the light the same way we did for caustics.

scene files (RMB click to "Save As...")
Start
End

Monday, August 14, 2006

Caustics

Focused specular light reflections and refractions cause caustics. In order to simulated the effects of caustics we need to tell mental ray to
a.) cast photons from our lights and
b.) enable photon mapping in the Render Settings.

Let's start with the light. In a spot light, open the mental ray tab. Look for Caustics and Global Illumination. Here, check the Emit Photons button.

In the Render Settings, choose mental ray as the render engine. Then, set the Quality Preset to Preview Caustics.

In class we'll go over visualization of the photon map and tweaking settings.

The homework assignment is to use the scene below to create caustic renders.

CausticScene

Sunday, August 06, 2006

refraction settings

If you are having trouble with the refraction settings, be sure to change the Refractive Index to a number like 1.5 for glass, 1.3 for water, 2.4 for diamond, and so on. If you try to put that number in the Refraction Limit field (the next one down) it'll pop to a whole number (integer) -- this field is for limiting the number of light bounces through the material.


Vacuum 1.0000
Air 1.0003
Ice 1.309
Water 1.33
Ethyl alcohol 1.36
Glass (fused quartz) 1.46
Glass (crown) 1.52
Sodium chloride (salt) 1.54
Zircon 1.92
Diamond 2.42

Thursday, August 03, 2006

Class 5 notes

Reflections (I'll demo this in class 5.)

This tutorial is a quick recipe for getting reflections on your objects using both raytracing and reflection mapping. We’ll add a shiny, chrome tree to impress all the dull, wooden ones.

I took a photograph of some small objects on my desk sitting next to a tree ornament. This plate will used as the image plane for a match move camera. Note that EXIF data from your digital camera will tell you the focal distance of the lens, which can be helpful in match moving. You should also measure real world distances on set and the angle of the camera pointing at the scene if you’re being particularly anal about things.
--

Next, I duplicated the photo and cropped in on the ball. This will be my reflection map for filling in the gaps where my scene lacks 3D geometry to reflect. In this case, almost the entire scene's reflections will be faked with the map.
--

In Maya, I imported the plate.tif file as the image plane for my camera (not the perspective, but a new one I’ll lock down). This image will be used to line up a new piece of match moved geometry – I built a NURBS curve and revolved it into another tree. I lined the tree up with the background as best I could. (OK, that’s a lie, it was a pretty slapdash job, but YOU should take much care in this step.)
--

Rendering the scene now will show you a dull gray tree that doesn’t really fit into the scene. Perfect! We’re all done. Goodnight.
--

What. You want to keep going? Alright, let’s move on. Using three-point lighting basics and my keen powers of observation I placed some lights to match the plate roughly. (The chrome ball is a pretty good record of where the lights were in the real set.) Since most of the lighting on the tree will come from its reflectivity I’m not going to kill myself lighting it. I’m also going to change from the past to the present tense and back again many times throughout this tutorial.
--

Next, I wanted to place a shiny metal shader on the tree. For this, I built a Blinn material, set the color to black, the diffuse pretty low, gave it sharp highlights (low specular rolloff and high eccentricity), and very high reflectivity.
--

As a test I created a sphere to sit right where the ornament is in the plate. I turned raytracing on in the Render Globals and was not surprised to see a reflection of the ornament in the tree when rendered. The problem is that that’s the only solitary lonely little object that is reflected. What to do? Reflection maps are the answer.
--

In the reflection color slot of the Blinn material I created an environment texture of the type Environment Ball. This node is designed expressly for importing pictures of mirror balls. In the image slot I browsed for my cropped ornament photo. The manipulator for the 3D projection that gets created in the middle of the scene can be used to line up the reflection (akin to reorienting the whole room). Even better, since the environment reflection photo was taken at the same angle as the plate is to use the Eye Space option in the EnvBall node. This will line up the reflection with the render view.
--

Now when I rendered things looked much better and I was very happy and wandered off to get some cheese to eat.
--

On a fuller stomach I looked back upon my render and was less happy. Where are the shadows to tie it in? Why isn’t the green base of the plate showing up in the reflection map? What about the multiple specular hits?

I attacked the shadows thusly: I created a cube (a plane would’ve been smarter – I attribute this lapse of judgment to the wine that was consumed along with the cheese) and matched it to the green wooden base. I placed a shadow catching material on this cube – the Use Background material in fact. I set the visible in reflections flags off for the cube. I set my key light to cast shadows and there they are. You can also get a raytraced reflection of the cg tree to show up on the cube.

The green base should be reflected up onto the tree, but it doesn’t. This is because I used the ornament to create the reflection map and it was sitting on the desk, not the green base. There are three main remedies that spring to mind: 1.) shoot the picture of the chrome ball correctly in the first place, 2.) paint some green into the reflection map back in Photoshop, 3.) add some green geometry under the tree to be caught in a real raytraced reflection. Numbers one and two would be preferable, but too boring for this tutorial, so on to number three.
--

I duplicated my shadow catching cube and assigned a surface shader to it. The out color slot of the shader was mapped with a projection of the image plane. The projection was set to the shot cam, with a vertical film gate fit. (Just coloring it green would have been fine as well.) I only wanted this reflection cube to be used in the reflection on the tree, so I turned on Visible in Reflections and turned off primary visibility in the attribute editor of the reflection cube's shape node.
--

The renders were looking much better to me at this point. I turned off the Emit Specular setting on all my lights to avoid the multiple spec hits. The last thing I did to plus it a bit was add a post-render glow effect. By upping the shader glow threshold I got this to only glow around the bright reflections in the environment map of the overhead lights.
--

Reflection tree support files.

Monday, July 31, 2006

Class 4 notes (updated)

I've pushed the original assignment to next week, once I've had a chance to demo the techniques for you.

For this week I'd like you to practice lighting the refractionBottle scene (below) and using the refraction settings to get a realistic image.

Also, download the reflectionTree.zip file, extract it and use the reflectionDepth file. This is the one with the beachball on the mirror plane with the mirror hanging in space. First, get this to properly raytrace the reflections, then add fake reflection to the reflection color slot of each material. Practice using the envChrome and envSky types of nodes for the fake added reflection.

--

Reflection tree support files.
Refraction support file.

Monday, July 24, 2006

jep notes

www.understandingmaya.com/share/lighting_statue01_lit.ma

Sunday, July 23, 2006

Class 3 notes

The Pixel Cinematography handout and the link below both cover the fundamental approach to three-point lighting. Some additional notes:

Your key (or keys) should have a link to all surfaces (this is the default) and a linear decay. The key should also cast shadows that are as hard or soft as the light source.

Fill lights can be linked exclusively to the subject, leaving out the set. Don't cast specular from them either, in order to sell the diffuse light source.

Rim lights need to be bright and wrap around the edges of the subject. Often you will need multiple sources or an area light to get the desired look.

Remember to tighten up your shadow angles on the key dmaps.

If you are using light linking to prevent light from the fills from hitting the set you may either need specific lights for the set or to get rid of some of the shadow density via shadow coloring.

For the homework assignment, use the same statue file from class 1, but this time light it with the three-point method and any other techniques we've covered in class.

http://accad.osu.edu/~mpalazzi/key_fill_kick.html

Monday, July 17, 2006

Class 2 homework

Here is the kitchen scene. Use it to try out these techniques:
  • Gobos
  • Dmap shadows
  • Negative light
  • Camera work

Class 2 notes

Gobos
Place gobos by mapping the color slot of a light with a texture. This can act like a slide projector if you use a file texture, or just a way to break up the uniformity of light with a ramp or noise.

Dmap Shadows
Depth map shadows are quick and dirty when compared with ray tracing shadows. Here are some tips for getting Dmaps to do what you want.

Resolution should be powers of two in the range of 32 to 2048 pixels (square).

Auto focus may give you a crummy percieved shadow resolution if you have a large scene. Try overriding this focus angle yourself.

Filter size is what you can use to soften shadow edges. Try anywhere from 1 - 8.

Bias the shadow to cure self-shadowing artifacts.

Per object shadow cast & receive
You can selectively toggle shadow casting and receiving attributes on your models. This will speed up shadow tuning in many cases. Tell floors to not cast shadows and you'll avoid self-shadowing artifacts.

Directional and ambient lights
Generally speaking, don't cast Dmap shadows off of light types other than spotlights. They will either be slow or problematic. Ambient tends to flatten your scene; you can use low-intensity directional lights instead to add "ambient" lighting. Don't let these guys emit specular light, either, to further help the illusion.


Links

Shadow mapping

Lighting tutorial


Tuesday, July 11, 2006

Class 1 homework

Here is the scene file of the statue. RMB-click to download it (then choose something like "Save link as...").
The assignment is to light the scene with some of the techniques we went over during the first class. No need to texture it or anything like that.
-JP

Class 1 handout

Here is the class curriculum:
Studio Arts Course Outline
Lighting

This course covers the principles and practice of CG lighting and rendering.

Structure
The class lectures will consist of both demonstrations and hands-on practice sessions. Please practice the techniques and do any exercises or assignments before the next class.

Recommended reading
[digital] Lighting & Rendering by Jeremy Birn
Understanding 3D Animation Using Maya by John Park
Learning Maya 7: The Special Effects Handbook by Alias Learning

Curriculum
Class 1:
• Lighting Workflow: Projects, Interface, Globals, Buffer, IPR, Shelf, Look through light camera
• Light Types: Point, Spot
• Dropoff, penumbra
• Attenuation
• Colored Light
• Shaping Light Throw with Barn Doors
• Exercise: lighting a statue

Class 2:
• Light Types: Directional, Ambient
• Shaping Light Throw with Gobos
• Depth map shadows
• Negative light
• Camera Fundamentals
• Image Planes
• Clipping Planes
• Exercise: lighting a still life in a kitchen


Class 3:
• Three-Point Lighting Setup
• False Color Rendering / light isolation
• Sample rates and anti-aliasing
• Area Lights
• Optical Effects, shader glow for bloom
• Exercise: lighting the statue with three-point techniques

Class 4:
• Maya’s Render Engines
• Raytracing Reflections
• Raytracing Refractions
• Raytracing Shadows
• Fake Reflections
• Exercise: reflection trees in an ornament

Class 5:
• Caustic Reflections
• Global Illumination with photons
• Exercise: caustics on a bar
• Exercise: temple lighting

Class 6:
• final gathering
• Studio Lighting with fg
• Car Lighting with fg
• Exercise: fg lighting a rocket

Class 7:
• Ambient Occlusion texture
• Depth of Field
• Exercise: DOF

Class 8:
• Image Based Lighting
• HDR
• Creating Your Own HDR Maps From Photographs
• Exercise: IBL and HDR

Class 9:
• Ramp Shaders for Toon Shading
• Paint Effects for Toon Shading
• Contour Rendering
• Exercise: Toon shading

Class 10:
• Render Layers
• Rendering Multiples Passes
• Compositing Render Passes




Pixel Cinematography