Adverti horiz upsell
Faking ray-traced shadows with depth-map shadows i
Faking ray-traced shadows with depth-map shadows i
sdb1987, updated 2005-09-16 14:43:17 UTC 63,187 views  Rating:
(3 ratings)
Page 1 of 2

To produce realistic 'soft shadows' in Maya, you have two solutions.

# Ray-traced shadows (with radius > 0); it works pretty well, but the higher rays samples (at low value, you get a noisy shadow), the longer it'll take to compute an image.

# Depth-map shadows, which is the quickest way, but has some limitations in realistic rendering: by default a depthmap shadow is sharp or blurred (according to the Dmap filter size value in the shadow section of a light)

Before starting the tutorial, let's review what a depthmap shadow is and how it's generated. A depthmap shdw is a depth image (Z channel) of your scene, calculated from the light's point of view, and that indicates to maya, which surface is illuminated and which surface is in shadow.

Now, in order to produce realistic depthmap shadows, you'll need a lightInfo node, and an anim curve connected to your light.

To create an anim curve, go to effect section in your light's ae (attribute editor). Click on create intensity curve. In the hypershade you can see that your light has now 2 nodes connected to it. The lightInfo and animation curve which feeds the intensity channel.

Open the graph editor. You can see that the intensity curve is driven by the sample distance returned by the lightInfo node. That means, for what interests us here, that you can set different values to an attribute according to the distance from the light source origin.

click for larger version

In our case, we just need a 2 point curve, so you can delete the in-between points. Disconnect the curve from intensity, and connect the output to the Dmap filter size light's attribute (connection editor)

To make set the values of the curve points, we need the sample distance from the light to the lit object, and the distance from the object to the dmap filter size max value (the distance where shadow is as blurred as you wanted)

You can use the measure distance to calculate it. Set the points values (remember, x is the sample distance, and y is the dmap filter size)

This done, you should have a curve like this

Now, disconnect the curve from the intensity attribute, and connect it to the dmap filtersize of the light.

For a very convincing effect, I set the Dmap_filter_size 'max' value to 50

Now let's see what you can get with that connection network. 3 images at different Dmap filter size values to show how I used the distance to tell maya to interpolate Dmap filter size attribute