lab impossible

A Community for New Media Creatives

lab impossible header image 1

Global Illumination: A tutorial

July 15th, 2010 · 3D, Tutorials, lighting

Render View Exponent

Global Illumination (GI) is a computer graphics technique used to create key characteristics of natural lighting.    It simulates the real world by using virtual photons that “bounce” off of surfaces.  GI uses both direct lighting (such as from a CG lamp or sun) and indirect lighting (bounced) and can produce astonishingly realistic results.  It can also become quite complex.

The objective of this tutorial is to introduce you to GI by looking at the most fundamental attributes and settings required for most GI implementations.  We will walk through sunlight streaming in through a window, bouncing off of the floor and thereby illuminating other parts of the scene (such as other walls in the scene).

The Advantages of Global Illumination

Because of GI, the light streaming in through the window automatically bounces off of the ground and partially illuminates the underside of the apple.  It continues to bounce, further illuminating the rest of the scene (and the left wall in particular).

bounced light

Without GI, this bouncing of light would need to be done manually (sometimes referred to as “fakeosity”).  Another  light source would need to be used on or near the ground to light the underside of the apple.  And since light in the real world bounces many times, a manual process would require repeating the steps for each subseqent bounce, and figuring out the position and angle of incidence of each light, the amount of decay (or light falloff), the unique interaction with each surface material, and other details.   Needless to say, this could get tedious (and with inferior results).

A single light in the real world can produce natural, soft lighting or high contrast, harsh, or stylized effects (such as in a studio setting).   The same options are possible with GI.

There are other advantages to GI, beyond workflow, realism, and control.   For example, GI can produce color bleed – the transmission of color through bounced light. Here, we will focus on workflow with a simple black and white image.   As the number of lights increase in a scene (and the total number of photons), render times can shoot up quickly.  It’s a good idea to start simply.

The Sample Scene

Let’s jump in and take a look at how to add GI in Maya.   If you’d like to follow along, download the abstract still life scene here.  If you have a reasonably zippy computer and are somewhat familiar with Maya, this tutorial can be done in less than 30 minutes.  Although, in order to get great results, lots of experimentation is recommended, so play with it!

But first, a note on Lights…

To use Global Illumination in Maya, you must use at least one light capable of emitting photons.   Maya offers four different types of lights that can emit photons: directional, spot, point, and area.  The sample scene uses spot lights for a couple of reasons:

  1. We want to include raytraced shadows, which spots are well-suited for, and
  2. Spot lights, like photons, encompass both direction and position.

We will use a basic 2 point lighting system composed of a key light (the window) and a fill light (overhead).  The main goal for the key light in this scene is to create a dramatic spill of light under the apple and to generate the raytraced shadows.  The goal for the fill light is to soften the high contrast created by the intense key light and bring out details on the walls to show off the textures.  The fill light is initially turned off so that we can focus on just the key light for now.

Render a frame now so we can see the impact of GI in a few moments.  Here is the scene with just the key light and no GI:

A single light and with no Global Illumination

The Global Illumination Workflow

In a nutshell, the workflow involves 3 steps (and plenty of test renders along the way):

  1. Use the Attribute Editor (AE) to turn on photons
  2. Use the Render Settings dialog to turn on GI
  3. Tweak settings in both the AE and Render Settings dialog to perfect the look

1 - Attribute Editor settings

  • Select the key light (keyWindow) and in the Attribute Editor, scroll down and open the mental ray section
  • Scroll down again and open the Caustic and Global Illumination section
  • Check “Emit Photons”
  • Leave all other values at defaults for now

Setting up GI in the Attribute Editor

  • Test Render.  The scene will look just like the prior render because in order for GI to take effect, we must also set the Render Settings (next step).

2 – Render Settings

  • Open the Render Settings dialog

Window > Rendering Editors > Render Settings

  • From the Render Using drop down, select mental ray
  • Select the Features Tab and check both Raytracing (if not already checked) and Global Illumination.

render settings features

  • Select the Quality Tab and from the Quality Presets drop down, select Preview: Global Illumination (note that this changes the Max Sample Level from 0 to 1)

Render Settings - Quality Presets

  • Test Render.  Notice two major problems: splotchiness and exposure.  (Actually, I kind of like the large splotches of light on the walls … it makes me think of a fruit disco.     But, we will fix it anyway!)

Render View splotches

3 – Tweaking Global Illumination

To Fix Splotchiness

This can be accomplished in a couple of ways:

  1. Increase the number of photons,  or
  2. Increase the radius of each photon, or
  3. Both

Since the fill light will emit photons as well (and possibly fix the problem), let’s fine tune the radius first.

  • Open the Render Setting Indirect Lighting tab
  • Set Radius = 5

Increasing the radius decreases the size of the light splotches.

Render Settings Indirect Lighting tab

  • Test Render.  Yes, that removed the splotches and impacted the exposure too (especially on the apple).  No more disco!

Render View

Experiment with Radius size.  In practice, you could slowly increment Radius until you have the desired level of smoothness (or blotch-freeness).  You may not notice much of a difference beyond the “right” level, but render times will certainly creep up, especially with large scenes.  So, for complex situations, it’s best to do the math to caculate an optimal Radius:

Scene Bounding Box Size / ( # of photos in the scene) / 2400)

In this case: 8.7 / (10,000 / 2,500) = a radius of 2.175

Round up to 3.   It will be difficult to see a difference between a frame rendered with a radius of 3 and a radius of 5, although the render time did increase by roughly 20%!  So, doing the math can be useful.  If your scene is small, as with this sample scene, you could just crank it up to 20 or so, at a negligible cost.

To Control Exposure (level of brightness)

Now, let’s add the fill light and use GI with this 2nd light too.

  • Select fillOverhead in the Outliner and open the Attribute Editor
  • Select Illuminates by Default
  • Scroll down to the Caustic and Global Illumination section
  • Check “Emit Photons”
  • Test Render
  • Now, it’s washed out
  • With the AE for the fill light still open, set Exponent to 3 (Exponent is the decay rate and impacts exposure).

There are other ways to control brightness as well.    For example, Photon Intensity controls brightness.   And, increasing Global Illum Photons increases the amount of indirect lighting which may also do the trick.  The best approach really depends on the scene.  Experiment.

Render View Exponent

  • Test Render.  Now we are getting somewhere!  However, notice the subtle splotchiness on the apple.
  • We could recalculate radius, since the scene now contains more photons with 2 lights (but we’ll skip it because the result is roughly the same.)

To Even Out Tones

  • Open the Render Settings dialog, Indirect Lighting tab
  • Increase Accuracy to 800
  • Test Render.   Then, notice the effect on tonality.   If it reduces contrast as well, it may be set too high.   Again, experiment.
  • If the specular highlights seem excessive (such as on the ground near the window or the actual window), try turning up the Max Sample Level.

Now, we have a wide tonal range from near blacks to specular highlights and many shades of grey in-between.  We can see the details of the wall texture and light bouncing off of the side walls.

GI is complex, but if you can get a handle on exponent, radius, accuracy and photon counts, you’re off to an excellent start!

To Recap:

Adjusting the various GI attributes takes time and much experimentation.   Here are the key values:

Global Illumination Photons – the greater the number of photons, the greater the indirect light (and possibly a smoother quality).

Exponent – use to control the decay rate.   1 simulates an intense source, such as the sun.  2 is equivalent to a quadratic or real world rate of decay (this is the default). 3 represents a weaker source.

Radius refers to the actual size of photons.  Increase to remove large splotches of light.

Max Sample Level – this can impact grain.

Accuracy – Deals with the blending of photons.  1 = No blending.  Accuracy in the 250 – 800 range generally works well.

→ No CommentsTags:···

Organic Content Creation with Maya

September 21st, 2009 · Education, Events, Tutorials

trillium-blk

Sculptie Creation for Second Life® with Maya

I spoke on organic content creation, using Maya, at the Second Life Community Convention (SLCC) in San Francisco last month.  Here are my notes.  Of course, there are a few fine tutorials on this topic already, but I wanted to cover: multi-object sculpties, lighting and materials (in addition to specific modeling issues).  Feedback is welcome via email.  Enjoy.

Find more info here:   Sculptie FAQ (wiki)

This tutorial in pdf form is here.

Setup: Install the Mel Script

1. Grab Qarl’s export script here:  http://www.qarl.com/qLab/pile/ant/sculpt.mel

2. Copy entire script (to clipboard)

3. Open the Script Editor in Maya


script editor

4. Paste sculpt.mel into the editor

5. With the entire sculpt.mel script selected, File ->  Save Script to Shelf


sculpt-mel

6. Give the shelf script a meaningful name, such as:

script-shelf-name

Setup and Define a New Project

1. File -> Project -> New

2. Name: flower

3. Select Use Defaults

4. Accept

Model

1. Set shelf tab to Surfaces


surfaces-menu

2. Create -> NURBS Primitives -> Sphere -> Option

Alternatively, sculpties can be made from NURBS planes, cylinders (no caps), or torus.

The stitching type may need to be set in SL or OpenSim to match a non-sphere object type (since the sphere is the default).  The sphere is usually the best way to go.  The exporter is also optimized for spheres.


create-nurbs

3. Set sections = 8 and spans = 8.

(Sections and spans can also be set to : 4, 8, 16 or 32, depending on how much detail is needed.  Sections do not have to be equal to Spans.)

4. Switch to Select by Component Type


select-by-component

5. Use any Maya tool for editing control points (such as move, rotate and scale).

Do not add or delete vertices.  For more complex shapes, add more NURBS spheres.  The ends, or poles, appear to be single points, but are  rings of very close control points.   Avoid manipulating the poles.

6. Switch back to Select by Object Type

Materials

1. Gather all source textures and copy to the project sourceimages directory.

This is the flower petal texture (256 pixels x 256 pixels):

flower_petal_256

2. Right click on petal object

Select Assign New Material -> Lambert

3. Open Attribute Editor (AE)

4. Change name to “purple_petal”

5. Set color to the file: “purple_petal”

6. Move transparency slider to the right about 1/4 of the way over

7. Set bump map (for this tutorial, use the same file as for the color map)


materials

Lights

Since the flower will be lit in Second Life, the objective here is only to ensure that the texture details are captured in the surface file.  We want to produce even, well-balanced illumination.

Here is a simple light rig:  1 overhead area light and 4 ambient lights for fill

(one for the front, back, left and right).

1. Create -> LIghts -> Area Light

position above (such as a large photographic soft box, or the sun)

2. Create -> LIghts -> Ambient

set intensity = .2 for each

position at left, right, front and back


lights

Camera (Optional)

For a white background in test render, (default is black):

1. Create -> Cameras -> Camera and Aim

2. Select Camera and Open AE

3. Environment: Change Background Color to White

Render

Confirm materials and lighting result in even illumination.

Adjust light intensity as needed.

Clean Up

1. It’s a good idea to save the scene at this point, prior to deleting history.

2. Edit ->  Delete by Type -> History


cleanup

3. Modify -> Freeze Transformations

4. Modify -> Reset Transformations

5. Edit ->  Delete by Type -> History

Select and Run Sculpt.mel

1. Select all sculpted objects in viewport and run sculpt.mel.

(Do not group objects.  Grouping will cause sculpt.mel to fail.)

export-dialog

2. Enter unique filename

3. Check  Maximize Scale (we can resize in Second Life)

4. Check Correct Orientation

5. Check Bake Surface Texture

6. Check Include Shadows

7. Check Generate Primscript (Filename.primscript is written)

Confirm That Images Look Right

Sculpt maps should look something like this:

sculpt-map

Surfaces (textures)  should look something like this:

sculpt-texture

Surfaces will look similar to the original color map file, with highlights and

shadows baked on (and taking into account any rotations).

Getting it Up to the Grid

1. Upload all the files (select lossless, if that option is available).

2. Setup scripts.  Find details here (scroll down to section labeled “In-world Scripts”):

http://wiki.secondlife.com/wiki/Advanced_Sculptie_Exporter_From_Maya

trillium

→ No CommentsTags:·······

Brainstorming, Mind Maps and Storyboards

July 2nd, 2008 · Tools

I came across a very cool new tool recently: bubble.  It is a free and elegant web application for collaborative brainstorming.   I played with it to flesh out  an idea that requires extensive project management.

This well-designed and intuitive app allows me to focus on putting ideas down and sharing with my team.   I can edit the colors, save, print, and collaborate (via the web).  I started with just a few items, but each generation (or child node), led to more ideas and generations.  Ah… precisely the point of brainstorming!  Here’s the first pass:

Here’s a close-up of the lower right:

→ No CommentsTags:····

Maya keyboard shortcuts

May 16th, 2008 · 3D, Tools

To verify or change keyboard shortcuts in Autodesk Maya (8.5 and 2008):

Window -> Settings / Preferences -> Hotkey Editor

SNAPPING OPERATIONS

c Snap to curves
x Snap to grids
v Snap to points
j Move, Rotate, Scale Tool snapping
Shft+J Move, Rotate, Scale Tool relative snapping

[Read more →]

→ No CommentsTags:····

How to Open the Maya Attribute Editor in a Separate Window

May 16th, 2008 · 3D, Tools

These screenshots are from Autodesk Maya 2008.

  • Select Window -> Settings / Preferences -> Preferences
  • Under the Categories list on the left, highlight Interface
  • Set Open Attribute Editor to In separate window
  • Click the Save button (or use File -> Save Preferences)

[Read more →]

→ No CommentsTags:···