Wednesday, September 30, 2009

Session 6: Indirect Illumination




Outline

• Intro to mental ray and indirect lighting methods

• Caustics
Exercise: cognacGlass_01.ma

• Global Illumination
Exercise: global_01.ma

• Final Gathering
Exercise: finalGather_01.ma

• Homework:
FgGi_01.ma


cognacGlass_01.ma demo


A demonstration of creating caustics with mental ray






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.



Tweak raytrace settings in the mental ray tab:

Refractions : 6

Max Trace Depth (reflections plus refractions): 8



Under Photon Tracing, Increase Max Photon Depth and Photon Refractions to 6.



Tweaks:

Turn up Caustic Radius (1.5 or 2)

Turn up Accuracy to smooth out caustics. (Changes the number of photons used to compute the local intensity of global illumination. The default number is 100; larger numbers make the global illumination smoother but increase render time.) Also change the caustic filter type to Cone for more smoothness.

Finally, in the light's Caustic section, turn up Caustic Photons (20,000)



Also Try:

Turn ON Direct Illumination Shadow Effects (This should be turned ON if you use transparent shadows with Global illumination and/or caustics.)

Turn up Raytracing > Shadows in the mental ray render settings.

Under Caustics and Global Illumination, turn on Enable Map Visualizer to see photons in scene after render.

Experiment further with the light's Photon Intensity, Caustic Photons and Exponent values (exponent works like decay).

 

Global Illumination




● Open global_01.ma. This is a flying saucer in a garage, with the garage door animated to open.



● Go to the last frame of animation where the illumination is at its fullest. Render the scene.



● Switch to mental ray and select the Quality Preset PreviewGlobalIllum



● Select the spotlight

● Set Intensity to 0.3

● Set Emit Photons to On

Test render



● It is dark because the Exponent acts as decay on the photons and none are hitting the objects. Set Exponent to 1 and re-render.



● To brighten scene, set Photon Intensity to 15000 (from 8000) and re-render.



● To decrease blotchiness, under Global Illumination in Render Settings, set Radius higher



● When you reach the point where changing Global Illumination Radius has little effect, start increasing Global Illum Accuracy (smoothing effect).



● Experiment with adding soft raytraced shadows to your light.





Tip: When optimizing render time, go to the Render > Render Current Frame Option Box and turn Verbosity Level to Progress Messages. This will display information in your command shell during your render. After a render, the wallclock time is the time it took to complete the render.


Final Gather





With Final Gather, mental ray calculates the scene irradiance or total incoming illumination in the scene.

Final Gather is affected by the Final Gather settings in the Render settings window, as well as:

● the camera background color

● colored incandescence in the scene

● ambient color in the scene

● irradiance contributions from shaders

● irradiance color mapping contributions from shaders

● whether there are lights in the scene and their locations



Sample Scene:



Open finalGather_01.ma

This scene contains one light with Illuminates by Default turned off. A dome above the saucer has a slight Incandescence value.



● Switch to mental ray, turn on Final Gathering in the mental ray render settings and render.

● Experiment with incandescence levels on the dome's shader.



Color bleed with lights:

● In the light's Attribute Editor, turn Illuminates by Default ON. Render.

● In the mental ray section of the floor shader's attribute editor, decrease Irradiance Color slightly to decrease color bleed and darken the floor.



Color bleed, no lights:

● Turn back off Illuminates by Default in light.

● Adjust the Ambient Color or add incandescence to the ship's ramp shader. Render.



● Try changing the camera's background color to adjust lighting levels.

Settings:

Accuracy represents the number of rays used to compute indirect illumination. Increasing the value reduces noise.

Point Interpolation is an inexpensive way to smooth the result (set to higher values).

Point Density controls the number of points to be computed (expensive, so use higher values carefully).

Scale lets you control the Intensity and Color of the Final Gather contribution on a global scene level.


Tip:
To use IPR with Final Gather or Global Illumination, in Render View window select IPR > IPR Quality > Render Settings.



GI and FG Together




Open the file FgGi_01.ma



The scene contains 7 lights:

3 spots over the translucent panels

2 spots for the lampshade over the dining area

1 spot outside for interior direct illumination and shadows

1 directional light for exterior lighting



Change these attributes on spotlight5:

Decay rate to Quadratic, Intensity to 2500, enable Raytrace Shadows



On the following lights, turn off Illuminates by Default and then link them as follows:

spotlight1 to panel1

spotlight2 to panel2

spotlight3 to panel3

directionalLight1 to wall1

spotlight6 to lamp1



Change these attributes on spotlight4:

Decay Rate to Quadratic, Intensity to 45, enable Raytrace Shadows



Global Illumination Setup



Render Settings: Turn Global Illumination on

Accuracy: 450

Radius: 6

Spotlight4: Emit Photons: ON

Photon Intensity: 2000

Exponent: 2.0

Global Illumination Photons: 25000

Render



Final Gather Setup



Disable Global Illumination (turn off Emit Photons in spotlight4, GI to Off in Render Settings)

Turn Final Gather on in Render Settings

Accuracy: 125 (good for test rendering - later set this to 400-600)

You can turn up Point Interpolation for smoothness.

If render is too bright, adjust intensity of lights.

If some areas appear splotchy, apply Jitter



FG & GI Together



Toggle back on Global Illumination

In the Final Gather section of the Render Settings, turn on Pre-compute Photon Lookup (arranges irradiance to be stored with the GI photon map. Fewer Final Gather points are required with this option.)

Turn back on Emit Photons in spotlight4.




Wednesday, September 23, 2009

Session 5: Raytracing


Image by Michael Blackbourn, from 3dRender

Get the class files here.

Raytracing: Reflections and Refractions



● Scanline vs. Raytrace
Raytracing is sending rays into a scene from the camera's POV for each pixel in the frame. These primary rays return the pixel's color. Secondary rays detect reflection, refraction and shadows.


  • If raytraced shadows are turned on, secondary shadow rays are fired from each surface point to each shadow-producing light. If a shadow ray intersects another object before reaching the light, the original pixel is shadowed.
  • If the surface is reflective or refractive, secondary rays are created at the original intersection point. If either ray intersects a secondary reflective or refractive surface, the ray-splitting process is repeated. This continues until the ray depth limit is reached.
  • Set the maximum number of ray-splitting iterations in Render Settings > Maya Software tab > Raytracing Quality
  • The Bias attribute serves as an adjustment for 3D motion blur: increase value to remove artifacts




● Look at refractionBottle.ma

Refractions
  • Refraction Index (set in shader’s attribute editor > Raytrace Options)
  • Refraction Limit- max. number of times a ray can be refracted
  • Light Absorbance - amount of light that is absorbed by transparent objects.
    Higher values = more light absorbed = darker surface


  • Surface Thickness - simulated thickness of a surface that possesses no model thickness
    Below is an image showing a thickness of 100 on the left, 0 on the right.


  • Shadow Attenuation - the brightening of the shadow's core and the darkening of the shadow's edge when the shadow is cast by a semitransparent object.  High attenuation = high-contrast shadows. The image below has a Shadow Attenuation of 0 on the left, 1 on the right.


  • Chromatic Aberration - replicates color shifts in refractions caused by the inability of a lens to equally focus different color wavelengths.




Refraction settings

The Refractive Index influences the direction a refraction ray travels from the original raytrace intersection point. Different materials have different refraction properties.

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.






Index of Refraction:

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

Reflection Settings


  • Reflection Limit
  • Reflection Specularity - controls contribution of specular highlights to reflections. Can set to values below 1 to reduce anti-aliasing artifacts in reflections. The image below shows Reflection Specularity set to 0 on the left, 1 on the right.





Reflection Mapping (faked reflections)

  • less computationally expensive, more control over map
  • environment textures
  • file textures
  • can be combined with raytracing (example on far right below)




Many images in this post are from Advanced Maya Texturing and Lighting 2nd Edition by Lee Lanier.


Homework: bottleCollection.ma
 


Wednesday, September 16, 2009

Session 4: Special Effects

Image courtesy of CPO Digital: http://cpodigital.blogspot.com/

Homework review

Get this week's files here.


Subjects:

IPR


Depth of Field
  • lower f-stop = more blur
  • use Heads Up Display > Object Details to get Distance from Camera
  • see DOF.mb 
  • Create > Measure Tools > Distance Tool and point-constrain one locator to the camera to create a sliding scale. Use the connection editor to connect distanceDimension1:Distance to renderCam:Focus Distance (see the file DOF2.mb)
Area Lights
  • computationally more expensive
  • yield softer lighting
  • emits a number of rays according to a two-dimensional area
  • size of light icon = brightness of light
  • produces softer, larger highlights
Volume Lights
  • allows light only in a specified boundary volume
  • easy control of light's range
  • falloff controlled by a color ramp in the Attribute Editor
Negative Light
  • for faked “shadows,” put a light of negative intensity in an area to suck light out of that area
  • use fast decay to contain it
  • volume lights are particularly well suited for faking shadows: emit ambient and turn off diffuse and specular
  • try using light linking or colored negative lights (hint: set it to the opposite of the color you want the shadow to be)

Light Effects

● Fog
  • use with point, spot, or volume lights
  • spot lights have intensity and spread
  • point lights have type (normal, linear, exponential), radius, and intensity
  • three types of fog in Maya: light, environment, and volume
  • light fog is the default and most common. it can cast dmap shadows (other types cannot). Control these shadows in the light’s attribute editor under Depth Map Shadow Attributes>Fog Shadow Intensity & Samples
  • change light fog to environment or volume by MM-dragging from the Hypershade (Volumetric Section) to the Light Fog attribute
  • Environment fog is not controlled by particular lights, but exists everywhere within scene. Doesn’t cast shadows. Look under Render Options in the Render Settings window to apply it.
  • Volume fog can exist within a volume primitive. Create>Volume Primitives. Adjust Dropoff type in Attribute Editor.
● Optical Effects
  • create an optical fx shader on your light by clicking the checkered texture button next to the Light Glow field
  • can create glows, halos, and lens flares
  • use sparingly!
● Gobos
  • create by mapping a texture to the color attribute of a light
  • can create Gobos in Photoshop, use procedural textures or images you find on the web – black and white work best for “shadows”



Homework: hauntedhallway.ma

 
 

 Images courtesy of ImagineFX: http://www.imaginefx.com

Wednesday, September 9, 2009

Session 3: Shaders and Lighting Setups Revisited

 

This session is a recap of our first two sessions, filling in the blanks to provide a complete lighting workflow. To do this we will revisit our still life and focus on the example of the orange.
  • Homework review
  • Recap on Materials, Textures
  • Hypershade and methods of assigning materials

Step-by-step lighting discussion: Orange-HiddenLights.ma

  • Key light: specular turned off
  • Spec light: emits only spec (more control for brighter highlight; by not adjusting spec in the shader we can still have soft spec in the fill light)
  • Slash light: creates a long, narrow slash to lead the eye in the composition; uses barn doors to shape the light
  • Fill light adds blue ambience
  • Rim Light: creates a thin bright outline around the object. Should be behind the object from the camera; needs to cast shadows; light-link to the object. Easiest to set up from the camera's POV.
  • Extra Fills
  • Kicker: thicker rim lights are called kick lights. Used to bring a highlight to the shadow side.
  • Bounce light: low light, colored like the fabric below the orange, emits only diffuse.

Time permitting:
  • Render settings cont'd
  • Raytrace shadows
  • IPR
  • Camera settings


Homework: 
  • Using Orange-Start.ma, practice trying to match the MatchMe.iff image in the /images folder (optional but advised)
  • Revisit the fruit bowl with renewed vigor
Files can be downloaded here (for 90 days):
day3.zip

Wednesday, September 2, 2009

Session 2: Working with Lights and Shaders



• Homework review

Hands-on: fruit_v2.mb

Subjects:

● Depth Map Shadows cont'd

● Light Manipulator cont'd
    ● Decay Regions

    ● Barn Doors
●  IPR


● Light Linking 

Assigning Materials


● Surfaces and shaders
  • Lambert
  • Phong, Phong E
  • Blinn
  • Anisotropic
  • Use Background
● Procedural textures

● Navigating shading networks


● Mapping transparency and using high-quality renderer to preview


● Using file textures


● Placement nodes and tiling textures with repeat UV or coverage

● Intro to Hypershade: assigning materials, graphing the network


● Intro to Multilister

● Projection mapping

Intro to UV mapping

● Displacement and bump mapping 


● Shader glow for bloom

● Render Settings

● Sample rates and anti-aliasing

● Object Shape node: Render Stats


Homework: Finish Fruit Bowl 

Get project files here.