Creating Shadows

If you want your scene to have a more realistic look, you can create shadows that appear to be cast by the objects in your scene. Shadows can make all the difference in a scene: a lack of them can create a sterile environment, whereas the right amount can make the same scene delightfully moody.

Shadows are controlled independently for each light source. This means that a scene can have some lights casting shadows and others not.

 

To create a shadow, you must set up three things:

• A light that generates shadows.

• Objects that cast and receive shadows.

• Rendering options that render shadows.

Types of Shadows

There are three basic kinds of shadows you can create:

Raytraced shadows that use the raytracing renderer. The shadows are very realistic but take longer to render. For information about creating raytraced shadows, see Creating Raytraced Shadows.

Shadow-mapped shadows that use the scanline renderer. They are quick to render, but not as accurate as raytraced shadows. Shadow-mapping works only with spotlights. See Creating Shadow-Mapped Shadows for more information.

Soft shadows that are created by defining area lights. Area lights need to be rendered with the raytracing renderer to obtain soft shadows. For more information, see Creating Soft Shadows with Area Lights.

Rendering Methods for Shadows

You can render all of the types of shadows listed in the previous section using different rendering methods. They are:

Regular shadows perform a basic, simple rendering of the shadows. The amount of light from a light source that passes through a shadow-casting object is determined. The shadow shaders are used in random order.

Sort shadows are similar to Regular shadows but uses the shadow shaders differently. The shadow-casting objects are sorted so that the shadow shader of the object closest to the illuminated point is processed first and the object closest to the light is preprocessed last.

Segment shadows also sort the shadow shaders in a specific fashion. When Segment is chosen, shadows are computed by tracing the segments (between the illumination point, the occluding objects, and the light source) and applying volume shaders to these segments (shadow segments).

This process slows down rendering, but is required if volume effects are to cast shadows.

None does not allow the light to compute shadows. This option is usually used to speed up rendering.

For more information about setting rendering options, see Managing Rendering Options [Rendering].

Creating Raytraced Shadows

Raytracing involves calculating how light rays are reflected, refracted, and obstructed. It gives very realistic results, but it can be a time-consuming process. The more lights used to generate shadows, the longer the scene takes to render.

To create raytraced shadows

1. Select a light in the viewport and choose Modify > Shader from the Render toolbar to display the selected light’s property editor.

2. On the General tab of the light property editor, select Shadows Enabled.

3. Set the Umbra value with its slider.

This defines a transparency factor on the umbra (main) area of the shadow (default 0.75). It controls how the shadow blends with the material on which it is cast to create a more realistic shadow.

4. Before rendering, choose Render > Render > Options from the Render toolbar to open the rendering options property editor for the current render pass and set the following options:

5. On the Optimization tab, set Ray Tracing to Enable (deselect Scanline Mode).

6. On the Shadows tab and in the Raytraced section, select a Shadow Type rendering method: either Sort, Segmented, or Regular. For more information on these options, see Rendering Methods for Shadows.

7. To view raytraced shadows in the render region, select Render > Region> Options and set the same options by clicking the Copy Options from Render button.

 

If you wish to turn the shadows off or make them invisible, you must deselect the Shadows option in an object’s Visibility property editor, as well as in the Optimization tab of the Render Options property editor.

Creating Shadow-Mapped Shadows

Shadow mapping, also known as depth-mapped shadows, works only with spotlights having a cone angle less than 90 degrees. It uses a modified z-buffer (depth) algorithm to create shadows more quickly but less precisely than those created with raytracing.

 

This algorithm calculates color and depth (z-channel) information for each pixel, based on its surface and distance from the camera. Before rendering starts, a shadow map is generated for the light (if one does not already exist).

This map contains information about the scene from the perspective of the light’s origin. The information describes the distance from the light to objects in the scene and the color of the shadow on that object.

During the rendering process, the light will be cut off at the distances specified by the depth map. This saves a tremendous amount of rendering time because the renderer needs only to check the depth map to determine which parts of a surface are shadowed and which aren't.

Keep in mind that the more lights used to generate shadows, the longer the render times.

 

Avoid using area lights at the same time as shadow-mapped shadows. Artifacts may occur within your scene.

To create shadow-mapped shadows

1. Select a spotlight and open its property editor by choosing Modify > Shader on the Render toolbar.

2. In the Light property editor, click the General tab and select Shadows Enabled.

3. To use shadow maps, click the Shadow Map tab and select Use Shadow Map.

4. Set the Resolution to determine the quality of the shadow map (width and height of the map buffer). A high-resolution setting increases memory usage and rendering time.

Raising the shadow map resolution should not be the first thing you do to solve shadow problems, such as artifacts. Try adjusting the Bias parameter, which does not add to your rendering time.

5. Set the Bias to control the distance offset to add to the shadow map.

Bias is a number that gets added to each distance measurement in the shadow map. Essentially, it pushes the shadow’s start-distance further out from the light. Increase the bias to slide the shadow further away from the surface casting the shadow, for cases where the shadow starts too soon. Modifying the Bias helps to eliminate shadow overrun (self-shadowing) or shadow artifacts if the shadow map algorithm fails to generate the depth value accurately.

Generally, a scene built on a larger scale might need a higher bias, and a scene built on a very small scale might need a lower bias.

6. Set the Softness to determine the type of shadow. A value of 0 results in hard-edged shadows. Higher values create longer, smoother shadows, but take longer to render.

7. Set the Samples to adjust the shadow’s resolution. High sample values yield a higher render quality, but increase rendering time.

8. Select Enable Shadow Map in Region to activate shadow maps in the render region.

9. Select Enable Shadow Map in All Passes to activate shadow maps in the render options of all render passes.

Although the default settings use shadows in the render region and during the final render, you may need to do the following to complete the shadow map effect:

10. Select the objects whose shadows you want to cast and display their Visibility property editor. Click the Rendering tab and make sure that both Shadow Caster and Receiver options are enabled. For more information, see Shadow Casters and Receivers.

11. To view the shadow map in the render region, draw a region (press q) and choose Render > Regions > All Options or Active Viewport Options from the Render toolbar to open the View Rendering Options property editor.

12. On the Shadows tab:

- Select Enable to activate shadow maps in the render region.

- Select the Rebuild option to recalculate the shadow map at every frame. This is necessary only when the shadows change, due to an animated light or object, for example.

- Set the shadow map Type. Default is the standard shadow map setting, while OpenGL Accelerated takes advantage of your graphics card’s OGL rendering capabilities to speed up shadow map rendering.

 

The extent to which you can use OpenGL shadow map acceleration depends the graphics card and/or drivers on the machine that you are using to render the shadow map. Keep the following restrictions in mind:

• If your graphics card and/or drivers do not fully support OpenGL accelerated shadow maps, enabling them may introduce distortion and surface artifacts that are undesirable in a final quality render.

If this is the case, accelerated shadow maps should be used for rough preview renders only.

• OpenGL accelerated shadow map rendering may not work at all with some graphics cards and/or drivers. If this is the case, the shadow map rendering mode simply reverts to Default.

• If you are rendering using a renderfarm, each client machine must have identical graphics cards and drivers that fully support OpenGL shadow map acceleration.

If client machines have different graphics cards and drivers, each machine is likely to produce different shadow map results, depending on the degree to which they support shadow map acceleration.

For a list of graphics cards that fully support OpenGL accelerated shadow maps, see the Hardware Certification pages of the Partners section at http://www.softimage.com.

- If your scene has motion blur, you may want to enable the Motion Blurred Shadow Maps option.

13. Before rendering, choose Render > Render > Options from the Render toolbar to open the Rendering Options property editor for the current render pass and set the following options:

- On the Optimization tab, select the Scanline renderer option (deselect Raytracing).

- On the Active Effects tab, select the Shadow Type rendering method for your scene: Regular, Sort, or Segment. For more information on Shadow types, see Rendering Methods for Shadows.

- On the Shadows tab, set the shadow map options described in step 11(the shadow map options in the render region options property editor are identical to those in the render options property editor).

Creating Volumic Shadow Maps

Volumic shadow maps, are similar to regular shadow maps, but store more detail. Instead of simply storing the distance from the light to the first object hit, the volumic shadow map algorithm raymarches through the scene from the light’s origin until it hits a fully opaque object. Along the way it stores changes in light color or intensity along with the depth at which the change occurred. Volumic shadow maps are typically used when rendering shadows for geometry hair.

 

To activate volumic shadow maps

1. Follow steps 1 to 8 of the previous procedure, To create shadow-mapped shadows.

2. Activate the Use Volumic Shadow Maps option.

3. Adjust the Sub-Samples value to controls the oversampling of each pixel of the shadow map.

The value specifies the size of the oversampling rectangle in N x N sub-pixels. For example, if Samples is set to 3, nine samples are taken, per shadow map pixel.

4. Adjust the Step Size to set the accuracy of the volumic shadow map. The Step Size determines how far apart along the same shadow “ray”, samples are taken to test for the nearest shadow-casting object. Step Size is a distance measure that is expressed in scene units.

When Step Size is 0 (default), mental ray calculates the volumic shadow map using a step size of 1/1000th of the scene’s bounding volume. If your scene has a very large bounding volume in relation to the object or character for which you want to generate a shadow map, then the default value of 0 may not be sufficient to produce an accurate shadow.

If this is the case, set the Step Size to something more realistic for the scale of the shadow-casting objects in your scene. Play around with different values until you get the shadow effect that you need. Keep in mind that if the Step Size is too large the calculations may “jump” over parts of your character that require a shadow. If the Step Size is too small, you will see no visible difference in the shadow effect but the additional samples taken will unnecessarily increase processing time.

5. Choose one of the following Shadow Type settings:

- Intensity Only: Only changes in intensity are stored in the shadow map, resulting in just grayscale shadows.

- Full Color: Changes in color are stored in the shadow map. Color sampling has a higher memory overhead than just intensity sampling, but allows for full-color shadows.

6. Continue with steps 9 to 13 of the previous procedure, To create shadow-mapped shadows.

Creating Soft Shadows with Area Lights

Area lights are a special kind of point light and spotlight. The rays emanate from a geometric area instead of a single point. This is useful for creating soft shadows with both an umbra (the full shadow where an object blocks all rays from the light) and a penumbra (the partial shadow where an object blocks some of the rays).

 

The shadow’s relative softness (the relation between the umbra and penumbra) is affected by the shape and size of the light’s geometry. You can choose from four shapes and set the size as you wish.

To determine the amount of illumination on a surface, a sample of points is distributed evenly over the area light geometry. Rays are cast from each sample point; all, some, or none of the rays may be blocked by an object. This creates a smoothly graded penumbra.

 

Avoid using shadow-mapped shadows at the same time with area lights. Artifacts may occur within your scene.

To define an area light

1. Select a point or spotlight and choose Modify > Shader from the Render toolbar to display the selected light’s property editor.

2. In the light property editor, open the Area tab and select Area Light.

3. Activate the Visible in render option to have the area light’s geometry appear in the rendered image.

The rendered area light uses the light color and intensity defined in the soft_light page of the light’s property editor (see Setting a Light’s Color).

 

Having area lights visible in the render is useful when you want lights to show up in reflections.

4. Select a Geometry for the area light to use. The geometry can be a Rectangle, Disc, Sphere or Cylinder. This determines the shape of the surface from which the light rays emanate.

 

Cylindrical area lights are always open at both ends.

5. Set the Sampling sliders to control the size of the grid of sample points on the surface of the area light in the U and V directions. Values greater than 5 take longer to render.

 

Because each area light is sampled multiple times, the sampling level for the render pass can be lowered even for high-quality renders. For more information on rendering options, see Managing Rendering Options [ Rendering ].

6. If necessary, adjust the size and orientation of the area light’s geometry as described in the following section.

Transforming Area Lights

You can transform an area light’s geometry by changing its scaling and rotation values in the light’s property editor or using manipulators in any 3D view.

To transform an area light from a property editor

1. Select an area light and choose Modify > Shader from the Render toolbar to display the selected light’s property editor.

2. From the Area tab of the Light page, set the Area Transformation values to set the size of the surface from which the light rays emanate:

- For rectangles, the X and Y values control the length and width when scaling.

- For discs and spheres, the X value controls the radius and the Y and Z values have no effect when scaling.

- For cylinders, The X value controls the radius, the Z value controls the length, and the Y value has no effect when scaling.

3. If desired, set the X, Y, and Z Rotation values to further control the rotation of the surface from which the light rays emanate. X, Y, and Z rotations are always defined according to the geometry’s local space; that is, according to its own center of orientation.

 

The center of the area light’s geometry is always the position of the underlying point or spotlight. The Z axis of the local coordinates points from the light’s center toward its interest. Orientation has no effect on area lights with sphere geometries.

To transform an area light using the manipulators

1. Select an area light from any 3D view and press b to display its manipulators.

2. Press Tab until the area light geometry appears thicker. This indicates that the manipulators are active.

3. Drag the manipulators to set the size of the surface from which the light rays emanate:

- For rectangles, drag an edge of the manipulator to scale the light surface in X or Y.

 

- For discs and spheres, click and drag anywhere on the manipulator to scale the radius of the light surface.

 

- For cylinders, click and drag either end of the cylinder to scale the radius of the light surface. Click and drag the point in the center of either end of the cylinder to adjust the length of the light surface.

 

 

Shadow Casters and Receivers

In the real world, a shadow is created when one object prevents light rays from reaching another object. The object blocking the light is said to cast a shadow onto the other object, which receives it. In Softimage, you can control whether scene objects cast and receive shadows by adjusting their visibility properties.

By default, every object is both a shadow caster and a shadow receiver, but you can deactivate either of these properties to control the scenes shadows more precisely.

 

 

 

In this example, all of the objects in the scene are both shadow casters and shadow receivers.

Turning the gray and striped spheres’ shadow caster option off prevents them from casting a shadow. Note that other scene objects continue to cast shadows.

Turning the floor’s shadow receiver option off prevents the floor from receiving any shadows cast by other objects, even if those objects are shadow casters.

Toggling shadow casting/receiving gives you a very granular control over shadows in your scenes. You can, for example, control which shadows appear in each of your render passes, or create shadow-only objects that cast a simplified (but visually satisfactory) shadow for a complex object whose shadows would otherwise take a long time to render (see [here]).

To toggle shadow casting and/or receiving

1. Select the object whose shadow casting and/or receiving you wish to toggle, and open an explorer (press 8).

2. Expand the object’s hierarchy and click its Visibility node to open the object’s Visibility property editor.

3. On the Rendering tab, toggle the Shadow > Caster and/or Shadow > Receiver options as needed.

Grouping Shadow Casters and Receivers

If your scene contains a lot of shadows, casting and receiving can be difficult to manage on a per-object basis. In complex scenes, it’s easier to group casters and receivers and use overrides to control shadow casting and receiving for all of the objects in the group. This process is described in Creating Visibility-Option Groups [ Interface and Tools ].

Creating Shadow Objects

An object’s shadow caster and receiver settings allow you to render its shadows without actually rendering the object itself. This type of object — often called a shadow object — is typically used to create fast-rendering shadows for a complex object whose outline is comparatively simple. Using a simple shadow object to create the shadows reduces rendering time because its shadow is calculated faster than the original object’s.

To create a shadow object

1. Select an object from which you want to create a shadow object.

2. Click the Selection button in the Select panel to display the selected object’s node.

3. Click the Visibility node to open the object’s Visibility property editor.

4. From the Ray Visibility options, deactivate Primary and Secondary.

5. From the Shadow options, activate Caster and deactivate Receiver.

 



Autodesk Softimage v.7.5