Friday, October 30, 2009

Bonus Lesson: Lighting Reviewed



Here is the exercise with which we wrapped up our final session. Do this exercise from time to time for review. It was inspired by a lecture Jeremy Vickery gave at Gnomon.

Create a Poly Cube, 10x10x10 units, with 3 divisions in each direction.



 Next delete the front faces and the middle face in the rear to create a room with a window:



 
Now decorate your "room" with some various NURBs or Poly primitives. Toruses and Spheres work nice, as do stacks of duplicated cubes.



Now lock off a camera somehow so you can start test rendering. 3 methods that work are: 
1. create a new perspective camera and lock its translate, rotate attributes
2. create a camera bookmark and go to the bookmark before each test render
3. set a key on the camera on frame one and then move the time slider to return to your keyed view before each test render




Now we light!
First we need a card to represent the light outside the window. Create a Poly plane and position it behind the room-box so it fills the window form the camera's POV. Create a new Lambert material for this card and turn its Incandescence value all the way up (a white "Surface" shader would work as well).



 Now create a spotlight and invoke Panels: Look Through Selected to help you position it outside the box partially illuminating your hero objects.



Name this light KeyLight. Turn ON Raytrace shadows. Check Render Settings and make sure you are using Mental Ray. On the  Quality tab switch to Preview. Test Render to see something like this:



We have a keylight established, now we will set the ambient lighting for the room. Never use an "Ambient" light, which tends to limit the value range and thereby "flatten" the scene. A better method would be to connect an ambient occlusion texture to the Ambient Color of the scene's shaders. This will create a fill color that varies in brightness according to the occlusion of each surface area (that is, how close it is to other objects).
Find the mib_amb_occlusion texture in the Mental Ray Textures area of Hypershade. If you middle-mouse-drag this onto lambert1 (the shader assigned to all objects) and choose to connect it to ambientColor you will make this connection. For the occlusion texture, set Samples to 100, Max Distance to 5.



If you set the Bright value in the occlusion texture to an upper-mid-value rusty orange and the dark value to a reddish black, you can get a very warm-toned image for effect. I also changed the Incandescence color of the "skydome" shader (the one on the card outside the window) to a warm off-white.



Now we will place a series of bounce lights at low intensity to represent the secondary light rays, or bounce lights. Create an Area Light and move, rotate and scale it to have it roughly cover the main area on the floor that the key light is hitting. It will represent the light that is bouncing off the floor toward other parts of the room. Try lowering its intensity to .1 or .2 and give it soft depth map shadows (with a filter size of 5-7). Also tone the light color slightly orange to represent the color bleed from the bounced light (secondary rays tend to pick up the local color of the first object they hit and "bleed" this color onto nearby objects). Name this light BounceLight1.



Duplicate this light and move and resize to any other areas that the primary light hits directly (the wall, other areas of the floor). Adjust intensities of all lights to balance the image.



Now create and resize an area light to fill the area of the "window". Call this light Fill1 and set it to be 3 or 4 times brighter than any of the Bounce lights (I used .25). This represents the scattered light entering through the window.



Duplicate this light and flip it 180 degrees, moving it out in front of the window a few units. This Fill light will approximate the "bloom" of the light source; in this case, the window. Reduce the intensity to something akin to the Bounce lights (like .1).



To boost the bloom effect, add a shader bloom to the lambert on the sky card, something like .1 (Special Effects section: Glow Intensity). Set the KeyLight to an Intensity of 2 to make the scene brighter to match the apparent "brightness" of the window.



That's the basic strategy: identify your primary direct light sources (in this scene, only one: the window), then do bounce lights located at the major surface areas the direct lights are hitting, then do fills to represent scattered light in the environment. Do all of this with some method of ambient lighting; here we used an ambient occlusion texture (keeping render times down to about 12 seconds). Final Gather or Global Illumination can be used instead, but often with much longer render times.

To take this exercise further, try adding "Rim Lights" to your hero objects or changing the palette by tweaking the Bright and Dark values of the ambient occlusion texture. Practice lighting with primitives like this until it starts to become intuitive.

Happy lighting!


Wednesday, October 28, 2009

Session 10: Rendering and Compositing




Last week we discussed Maya's Render Layer Editor. Maya 2009 Introduces Render Passes, which provides a faster and more efficient method of producing multiple passes for compositing purposes. Render Passes is not a replacement for Render Layers, but a system to augment Render Layers. Render Passes is only available for the mental ray renderer.
Render Passes don't add to render time; instead it stores pass data in framebuffers, writing them out into individual images.

To set up render passes, open the Render Settings window and make sure you are using mental ray. Switch to the passes tab and look for the buttons on the right (may have to resize window to see them). Use the Create Render Pass button to create render passes (hold the command key to select multiple).

Select Beauty, Diffuse, Indirect, Reflection, Shadow, Specular.

Hit the central button to add the Scene Passes to the Associated Passes for the current render layer. Then render.

Subdirectories within the Images directory will hold the different render passes.

Tip: Under Common Tab: File Output: File Name Prefix: right-click over field to add "Renderpass" name as the filename. Can also name a subdirectory here, such as Test/ - puts all images into a subdirectory named "Test."

To create a Contribution Map (defines which objects and lights in the scene are considered in the render pass) right-click over the layer in the Render Layers Editor and Add a Contribution Map. Assign these Contribution Maps to individual passes in the Passes Tab of Render Settings.

Wednesday, October 21, 2009

Session 9: Non-Photorealistic Rendering

Toon Shading and Contour Rendering



      Open 14-contour_01.ma
      Render the scene. A ramp shader is being used to give the vase a toon-shaded quality in the Maya Software renderer. Look at the Ramp attributes to see how this was done.
      Apply a new Blinn shader to the vase.
      In the blinn's shading group node (blinn1SG) go to mental ray : Contours and turn on Enable Contour Rendering.
      Set Relative Width to .5 and Color to Red
      Switch to the mental ray renderer and set Quality Presets to Preview
      In the Contours section of the features tab of render settings, turn on Enable Contour Rendering.
      In the Draw By Property Difference section, set Between Different Materials to On.
      Render

Try using Draw By Property Difference : Around Render Tesselation to evaluate settings in an approximation node, or to see how an object is tessellating. (Create and assign a NURBs surface approximation node to the vase and switch approximation presets to see the difference in the renderer).


Maya Toon Shading

  • Accessed under the Toon menu (Rendering menu set)
  • Uses a combination of ramp shaders (for fills) and Paint Effect strokes or offset meshes (for outlines)
  • Uses the Maya Software renderer
  • Can use mental ray or Maya Hardware render (requires additional steps)

  1. Open toon1.mb
  2. Switch to ShotCam
  3. Toon: Set Background Color: shotCam – set to sky blue
  4. Select the hill and choose Toon>Assign Fill Shader: Solid Color (assigns a Surface shader to the hill)
  5. Open the Attribute Editor for the surface shader. Change the color to grassy green.
  6. Select the shroom on the right and Toon: Assign Fill Shader: Light Angle Two Tone (assigns a ramp shader)
  7. Attribute Editor: Change colors to dark purple and light purple
  8. Select the shroom on the left and Toon: Assign Fill Shader: Shaded Brightness Two Tone
  9. Attribute Editor: Change colors to dark orange and yellow
  10. Select the middle shroom and Toon: Assign Fill Shader: Shaded Brightness Three Tone
  11. Try the other fill presets (Dark Profile, Rim Light, Circle Highlight) on the shrooms.
  12. Apply fill shaders to the eyeballs and eyelids and teeth.

Keep going, or open toon2.mb.

  1. Select the right shroom
  2. Toon: Assign Outline: Add New Toon Outline
  3. Attribute Editor: Line Width 0.033
  4. Tumble around to see how outline updates. It is actually a paint effects stroke that updates according to camera angle.

4 Types of Toon Lines:
  • profile – define outside of an object
  • border – open edge of geometry or borders between shaders
  • intersection – where two objects that have the same toon line node applies intersect
  • crease – hard edges on polygon objects (not view dependent)

Border lines:
  1. Select the two eyelids for the right shroom
  2. Toon: Assign Outline: Add New Toon Outline
  3. Set width to 0.033

Intersection lines:
  1. Select the middle shroom and the hill
  2. Toon: Assign Outline: Add New Toon Outline
  3. Set Profile Lines to off
  4. set Border Lines to off
  5. uncheck Crease Lines
  6. check the Intersection Lines box to turn intersection lines on
 

Toon Shading Part 2


Open toon3.mb
A single toon line has been applied to all objects but the pupils (because toon lines can only be applied to meshes, not curves. However, Paint Effects strokes can be applied to curves)
  1. Windows: General Editors: Visor: Paint Effects Tab: Toon folder: Smooth brush
  2. Edit: Select All by Type: NURBS Curves
  3. Paint Effects: Curve Utilities: Attach Brush to Curves
  4. In the Outliner, select the newly created strokes and choose Paint Effects: Share One Brush
  5. Attribute Editor: Global Scale for the brush stroke to 0.165
  6. Render
  1. Select pfxToon1 node and look under Profile Lines attributes.
  2. Try using Profile Width Modulation to vary the width of the Profile lines depending on their curvature, causing the render to look more like a loose sketch than CG.
  1. Under Common Toon Attributes, set Lighting Based Width to 1.0 (makes line thin where light hits)
  1. Return Lighting Based Width and Profile Width Modulation to 0.
  2. Next to the field for Line Width Map, click the Texture button and choose a Noise texture. This creates a “scribble” line. Adjust settings in the Alpha Gain section in the Color Balance tab of this texture to increase or decrease thickness of lines. Animate the texture to create “nervous line” animation.

Applying Paint Effects Strokes to Toon Outlines

  1. In the Visor, open the Toon folder, and select brokenWiggle.mel
  2. Select the pfxToon1 node 
  3. Toon: Assign Paint Effects Brushes to Toon Lines
  1. Render. Try other types in the Toon folder.

Layering toon lines.
  1. Assign the doodle line.
  2. Select the geometry for the three mushroom and the hill and choose Toon: Assign Outline: Add New Toon Outline
  3. Select the new pfxToon2 node in the Outliner..
  4. Visor: select brokenGlopLine 
  5. Toon: Assign Paint Effects Brush to Toon Lines
  1. Attribute Ed. for brokenLineGlop1: Brush Type - Smear
  2. Render. Notice how the doodle line and edges of fill are still visible but have been smeared by the broken glop line.
See also Toon: Get Toon Example




Wednesday, October 14, 2009

Session 8: Custom Shaders in Mental Ray

Intro to Custom Shaders

2 Ways to adjust shaders for mental ray:
  1. Use mental ray attributes found in the mental ray section of Maya shaders
  2. Use the mental ray shader library
mental ray shaders are different from Maya shaders: they do not provide controls for Transparency, Reflection and Refraction. These attributes need to be connected in a certain way to allow their use.

Under the mental ray section for Maya shaders are controls for Reflection/Refraction Blur that allow for distance-based blurring (more realistic). 


The Ambient Occlusion Texture

Occlusion refers to the blocking of light that occurs based on distance between geometry  

A common practice for rendering occlusion is to connect the mental ray occlusion texture
  • to the Ambient Color of a lambert shader
or
  • to the Out Color attribute on a surface shader
1. open occlusion01.mb

2. Create an ambient occlusion texture (Hypershade;Create mental ray nodes tab (left pane);Textures;mib_amb_occlusion)

3. MM-drag and drop the occlusion texture over the lambert (default) material. From the popup, choose ambientColor. Set the lambert color value to white. Render with no lights.

4. To reduce splotchiness, increase the number of Samples of the mib_amb_occlusion texture. Try 100.

This grayscale render can be composited atop a “normal” render using multiply, soft light, etc. to create a soft, global illumination-type image.

Tip:

Also try mib_fg_occlusion in the MentalRay Lights section. This shader provides fast smooth ambient occlusion but final gather must be turned on.






Material and Photon shaders: dielectric_material and dgs_material

These two shaders implement different physically-based models of reflection and refraction

dgs stands fro diffuse-glossy-specular  
dgs_material can simulate mirrors, glossy paint, plastic, brushed metal, translucent materials such as frosted glass, etc.

dielectric_material is a physically based material shader which simulates dielectric media such as glass, water, and other liquids

  • Open 14-crystalBall_01.ma
This is a scene set up to render caustics via a photon-emitting light. The objects in the scene use regular Maya shaders.

  • Select the crystal ball surface. Open hypershade and click the Graph Materials on Selected Objects button. Double-click phong1SG to go into the Attribute Editor. On the phong1SG tab, under mental ray, custom shaders, create a material shader. Choose dialectric_material
A dialectric material is a poor conductor of electricity but a good supporter of electrostatic fields. Examples include porcelain, ceramics, plastics and glass. The dialectric material type has a built-in absorption fresnel reflection.

Photonic effects in mental ray are controlled by a photon shader. Note that dielectric material auto-maps itself to the photon shader field as well.

  • Assign a photon shader to phong1SG: dielectric_material_photon (under Photonic Materials)
  • in dielectric_material1, set Col as follows:
    H to 198

    S to 0.13

    V to 1.0

  • set the Index of Refraction (Ior) attribute to 2.0 (the refractive index of crystal)
  • set the phong_coef to 140 (similar to Cosine Power in a regular phong)
  • the dielectric_material_photon1 shader’s settings should match:
    Col to pale blue

    Ior to 2.00

    Phong_coef to 140

Save this scene to use in the next lesson “Shadow Shaders”




Shadow Shaders

Continue with the same file from Material Shaders tutorial, or open 14-crystalBall_02.ma
  • Drag a mib_shadow_transparency node to phong1SG’s Shadow Shader attribute
  • Set its Mode to inclusive
  • Set color:
    H to 198

    S to 0.3

    V to 0.8

  • Render and save.
Tip:You can enable Area Light in your light’s mental ray attributes section to soften shadows, but it will increase render time.




Volume Shaders

Volumetric materials are used to scatter light, simulating fog, glass, etc.

  • Continue or open 14-crystalBall_03.ma
  • Assign parti_volume (under Volumetric Materials) to phong1SG’s mental ray Volume Shader attribute.
  • Assign parti_volume_photon (under Photon Volumetric Materials) to phong1SG’s mental ray Photon Volume Shader attribute.
  • In both shaders, adjust these settings:
    Scatter to aqua (the color of the scattering medium)

    Extinction to 0.3 (how much light is absorbed in the medium)

    Min_step_len to 0.03

    Max_step_len to 0.1 (step length for rays; regulates accuracy)

  • Adjust the photon energy for nice caustics. In the light, change the Photon Intensity values to between 400 and 1000.
  • Set Render Settings; Indirect Lighting tab; Caustics; Caustic Radius to 2.0
  • Render and Save



Volume Noise

Continue with your file from the Shadow/Volume shaders tutorial or open 14-crystalBall_04.ma

A volume noise texture will be used to color the volume shader’s scatter attribute.
  • In the Create Maya Node bar of the Hypershade, 3D Textures section, create a Volume Noise texture.
  • Adjust the attributes:
    Amplitude to 0.86

    Freq Ratio to 1.37

    Frequency to 10.0

    Noise Type to Wispy

    Color Gain to dull yellow

    Color Offset to dark blue-green

  • Open the attribute editor for the parti_volume1 node and MMB-drag the volumeNoise1 texture to the parti_volume1’s Scatter attribute. Do the same for the parti_volume_photon1 node.
  • Render. There is a wispy color effect, but probably too uniform. Increase the non-uniform attribute to 0.95 for both parti_volume1 and parti_volume_photon1
  • Limit the height of the material: in both parti_volume1 and parti_volume_photon1, set Mode to 1 and Height to 3.
  • A noise texture can make the height less even:
    Create Maya Nodes bar of Hypershade;2D Textures;Noise

  • Adjust Noise attributes:
    Amplitude: 0.79

    Ratio to 0.32

    Frequency Ratio to 1.97

    Noise Type to wispy

  • Under Hypershade;General Utilities, create a Set Range node.
    (the noise texture’s output returns a value of 0 to 1, but the height value should be higher)

  • MMB-drag noise1 onto the setRange1 node and choose Other from the popup menu
  • In the connection editor, connect noise1’s Out Alpha to setRange1’s Value X attribute.
  • In setRange1, set:
    Min X to 2

    Max X to 4

    Old Min to 0

    Old Max to 1

  • MMB-drag the setRange1 onto the parti_volume1 node, then select Other from the popup
  • Connect setRange1’s Out Value X attribute to parti_volume1’s Height attribute
  • Repeat to connect setRange1’s Out Value X with the parti_volume_photon1 node’s Height attribute

  • Render. The smoke inside the crystal ball now has uneven distribution and height.  
Get the class files here.

Wednesday, October 7, 2009

Session 7: Image-Based Lighting

• Image Based Lighting
• HDR
• Exercise: IBL and HDR



 
Image Based Lighting (IBL)

IBL is the process of using an image or sequence of images to define the lighting in a scene. The color values in the image are used in one of the following ways:
  • as directional lights
  • as irradiance values for final gather
  • as photon emitters for global illumination

Render Settings > mental ray tab > Environment section > Image Based Lighting Button

-provides a spherical container that is used as a hemispherical bounding environment – appears in your scene as an IBL node. The IBL node can be mapped with an image that is used for casting light and color values into the scene (or just for reflection).

In Infinite mode, the position and scale of the spherical object is irrelevant (but rotation is used to orient the image). In finite mode (Infinite checked off) all transformations have effect; you can scale and position the IBL node in a closed environment such as a room.

High Dynamic Range Images (HDRI)

Can be used as the basis for illumination in a scene. An HDRI has an extra floating point value that is used to describe the exponent or persistence of light at any given pixel. This overall illumination information is used in the Final Gather process. Regular images have limitations when it comes to describing the range of colors necessary to describe light values precisely.

Creating your own HDRI involves taking several shots of the same subject matter with bracketed f stops and assembling the images into a floating point tiff or hdr. Photoshop CS4 or HDR Shop can be used for this purpose.

For more information, see
www.debevec.org
or
www.hdrshop.com



Exercise 1: Using an HDR Image as Final Gather Irradiance
13-HDRI_01.ma
  • Open 13-HDRI_01.ma
  • In the Hypershade, select the dome shader.
  • Map a file texture to the dome's Ambient Color.
  • Browse for the nappaValley.tif file in the sourceimages directory (don't worry about Maya's error message – mental ray can read it).
  • In Render Settings, set Final Gather to On.
  • Make sure the number of Final Gather Rays (Accuracy) is set to 100.
  • Render the scene.
  • To adjust the irradiance contribution, go to the Color Balance section of the file texture node.



Exercise 2: Creating an infinite Environment with an IBL node
13-IBL_01.ma
  • Open 13-IBL_01.ma
  • Open the mental ray Render Settings.
  • Indirect Lighting Tab: Environment > Image Based Lighting: click Create. In the Attribute editor for the mentalrayIblShape1 node, under Image Based Lighting Attributes, map nappaValley.tif to Image Name.
  • Render.
  • Experiment with Color Gain and Color Offset.
  • For shadows, you need turn on Emit Light under Light Emission.
  • Set both Quality U and Quality V to 64.
  • Set the Samples parameters to 10 and 4.
  • Render.
Note: Every pixel in the texture is a virtual directional light. The Quality U,V sets the resolution for the control texture. Samples controls the sampling of the strongest lights (first parameter) and the remaining lights (second parameter).





Exercise 3: Physical Sun and Sky
scene_04.mb and simpleSky.mb

  • Open scene_04
  • Render Settings: Indirect Lighting tab, Environment section, hit Create next to Physical Sun and Sky
  • Render
  • Start with a Multiplier of .3 and experiment with the sky and sun attributes


See simpleSky.mb for examples of sky with various mental ray shaders. Be sure to turn on Final Gather.


Exercise 4: Going Deeper into HDRI, with Final Gather and Photon Emission
IBL_Light01

● Open IBL_Light01

● Create an IBL node

● In the Attribute Editor, change Type to Texture and change the texture to white.

● Render



● Enable Final Gathering with Point Interpolation of 20

● Render

● To increase intensity, use Color Gain in the IBL node: increase V to 2

● Render



● From the Type attribute, select Image File. Load the image lat_long_ldr.tiff.

● Reset Color Gain to 1 and Render.



● Replace the image with an HDR version: lat_long.hdr

● Adjust Color Gain and Render



● Replace the file with ANGULAR.hdr and change mapping to Angular



● Disable Final Gather

● Turn on Light Emission and Render

● Chance the image to Spherical, lat_long.hdr and re-render to see the difference



Also in your project is the file apartment05preIBL.ma. This is for you to look at and play around with getting the CG elements to match the background image.
Directions are here. This file has everything done except tweaking the shaders. Make sure the IBL node is turned on and Final Gather is used.

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