4.1 Lighting Guidelines
4.1.1 Depth Map Shadows With Maya Lights
The same attributes that control depth shadow maps in Maya are acknowledged by 3Delight for Maya:
- In the `Depth Map Shadow Attribute' panel of a light node, check the Use Depth Map Shadows toggle.
- Create a render pass node by using the Add Render Pass item in the 3Delight menu and hit the Render button it displays in the Attribute Editor. Or, use an existing render pass node and make sure its Render Shadow Maps attribute in the Shadow Maps panel is checked.
4.1.2 Ray Traced Shadows With Maya Lights
When ray traced shadows are desired, a few extra steps are required since in 3Delight for Maya, objects are not visible to ray traced shadow rays by default. This procedure illustrates a way to get ray traced shadows working:
- For each light node that will cast ray traced shadows, enable its Use Ray Trace Shadows attribute.
- Select all objects that will cast ray traced shadows;
- Pop up the shader assignment panel and create a new geometry attribute node by clicking the texture button on the right of the Attribs option menu, then click the AE button to display its attributes in the Attribute Editor.
- In the Visibility panel, set Transmission to `Shader'.
- Create a rende rpass node by using the Add Render Pass item in the 3Delight menu (or select an existing render pass) and hit the Render button it displays in the Attribute Editor.
4.1.3 Deep Shadow Maps With Maya Lights
Here is a quick procedure to produce deep shadow maps:
- Select all light nodes that will cast shadows using deep shadow maps.
- Pop up the shader assignment panel and create a new light attribute node by clicking the texture button on the right of the Attribs option menu, then click the AE button to display its attributes in the Attribute Editor.
- Turn on the Generate Shadow Maps toggle.
- Select `deep' for the Shadow Map Type.
- It is recommended that, in each light node, the Bias attribute (6) is set to `0.2'.
- Select 3Delight as the default renderer and render.
Note that the same procedure can be used to create depth map shadows. Simply set the Shadow Map Type attribute to `normal'.
4.1.4 Lighting and Shadowing With RenderMan Light shader
A very basic setup using a RenderMan light shader node can be made with the following steps:
- Select a light node;
- Pop up the shader assignment panel and create a new light shader node by clicking the texture button on the right of the Light option menu, then click the AE button to pop up the Shader Manager.
- In the shader manager, double-click on the desired light shader file on the left section. A shader node is created and listed in the right section.
- Select the created light shader node and click the Assign button.
- Close the shader manager.
- Back in the shader assignment panel, notice that the newly created shader node is now the selected entry of the `Light' option menu. Click the AE button on the right of that option menu to edit the shader node attributes.
- Assign relevant values for the various shader attributes. Note that by default, these attributes are independent from the light node attributes.
- Select 3Delight as the default renderer and render.
NOTEYou might need to increase the RenderMan shader node attribute that controls the light intensity in order to see the light.
If the selected light shader node is able to use a shadow map, the following extra steps will produce shadowing:
- Select a light node that has been assigned a RenderMan shader node.
- In the shader assigned panel, create a new light attribute node by clicking the texture button on the right of the Attribs option menu, then click the AE button to display its attributes in the Attribute Editor.
- Turn on the Generate Shadow Maps attribute;
- Set a Shadow Map Name, using the browser brought up by clicking on the Folder button.
- Double-click on the shadow map name file path and copy it.
- In the shader assigned panel, click on the AE button next to the Light option menu;
- Paste the file path in the RenderMan shader attribute that specifies the shadow map.
- Make sure the Render Shadow Maps toggle of the render pass used to render is turned on. Then start the render.
It might be convenient to connect some of the RenderMan shader node attributes, such as the cone angle, to the light source for easier manipulation. The following is an example on how to do this with the spotlight shader that is packaged with 3Delight.
- Create a spot light. This example assumes that it is named spotlightShape1.
- Pop up the shader assignment panel and create a new light shader node by clicking the texture button on the right of the Light option menu, then click the AE button to pop up the Shader Manager.
- In the shader manager, make sure the Directory is set to `$DELIGHT/shaders'. Find the spotlight shader in the list on the left side of the shader manager and double-click on it.
- Select the created light shader node and click the `Assign' button.
- Close the shader manager.
- Back in the shader assignment panel, note that the newly created shader node is now the selected entry of the Light option menu. Click the AE button on the right of that option menu to edit the shader node attributes.
- The node name is displayed at the top of the Attribute Editor, in the delightShader text field. Rename it to `dl_spotlight1'
- Right-click the `coneangle' attribute and select Create New Expression...
- In the Expression section of the Expression Editor, type in the following expression:
spotlight1.coneangle = deg_to_rad(spotLightShape1.coneAngle / 2 + abs(spotLightShape1.penumbraAngle))and then click the Create button. - Right-click the conedeltaangle attribute and select Create New Expression...
- In the Expression section of the Expression Editor, type in the following expression:
spotlight1.conedeltaangle = deg_to_rad(abs(spotLightShape1.penumbraAngle))
and then click the Create button. - In the shader assignment panel, create a new light attribute node by clicking the texture button on the right of the Attribs option menu, then click the AE button to display its attributes in the Attribute Editor.
- Turn on the Generate Shadow Maps attribute;
- Set the Shadow Map Name, using the browser brought up by clicking on the Folder button.
- Open Maya's Connection Editor.
- Select the shape spotLightShape1 and click the Reload left button of the Connection Editor.
- In the shader assignment panel, right-click the Light option menu and select Select Shader(s). Then, click the Reload Right button of the Connection Editor.
- The following connections can be established:
- spotlightShape1.color -> dl_spotligth1.lightcolor
- spotlightShape1.intensity -> dl_spotlight1.intensity
- spotlightShape1.dropoff -> dl_spotlight1.decay
- Back in the shader assignment panel, right-click on the Attribs option menu and select Select attrib node(s).
- In the Connection Editor, click the Reload Left button.
- Create the following connection: delightAttribs1.shadowMapName -> dl_spotlight1->shadowmap.
- Assign the beamdistribution attribute of the dl_spotlight1 shader node to `0.0' if you want an effect closer to the Maya spot light.
- Make sure the Render Shadow Maps toggle of the render pass used to render is turned on. Then start the render.
4.1.5 Shadow Map Tips
- When a light attribute node is attached to a light node, all options related to shadow map generation (such as resolution) are retrieved in the light attribute node. The only exception to this is the Shadow Map Name attribute when it's left empty. Refer to Shadow Maps.
- Even when a light attribute node is attached to a light node, any options related to shadow map usage (such as shadow color, filter size and bias) is specified in the light shader (RenderMan or Hypershade).
- The coverage of the shadow map is defined by the cone angle of the spot light. In order to maximize the resolution of the shadows cast by objects, it is recommended to adjust the cone angle of the light source so that it tightly surrounds the shadow-casting objects.
- If there is not enough details in the shadow, first try to optimize the usage of the shadow map by adjusting the coverage as suggested above. If this is not enough, try increasing the shadow map resolution.
- If you get shadowing artifacts on an object, it might be caused by self-shadowing. For depth shadow maps, using midpoint depth filtering usually helps getting rid of this problem. If a light source has no light attribute node attached to it, turning on the Use Mid Dist attribute of the light node usually takes care of this problem. If the light has a light attribute node attached to it, then select `midpoint' for its Shadow Depth Filter attribute.
- The Bias attribute of the light shader can also be adjusted to avoid the self-shadowing problem. The default Maya light node `Bias' value of `0.001' is not very good for 3Delight and will create bias artifacts most of the time. A better value to begin with is `0.2'.
- Any light shader that can use a depth map shadow can use deep shadow maps without any modifications. This includes `Maya' Hypershade light shaders. Refer to Deep Shadow Maps With Maya Lights.
- Unfiltered shadows are usually undesirable and not supported by 3Delight; when using Hypershade-shaded lights, setting the Filter Size to `0' will produce the same result as setting it to `1'. If the Filter Size is larger than 20, the filtering will be increasingly blurrier, while in Maya any value larger than 20 look similar to a filter size of 20.
- If the light source moves or is lighting animated objects, it is recommended to check the Add Frame Ext attribute of the light node or to add the current frame number in the `Shadow Map Name' attribute of the light attribute node. See File Path Expressions for details on how it is possible to construct paths containing dynamically expanded tokens.
- When re-rendering several times the same frame, it is often unnecessary to re-render shadow maps. Shadow maps need to be recomputed only if the objects they contain have moved, objects have been added or removed, or if the light direction or cone angle has changed. The rest of the time, you can avoid rendering them. When rendering the frame the renderer will try to use the existing files and you will still get the shadows. There are several tools to avoid useless shadow maps re-renders:
- - If you do not use light attribute nodes, you can set the Disk Based Dmaps light attribute to Reuse Existing Dmap(s).
- - If you use a light attribute node and the shadow objects are the same from one frame to another, you should turn on the Generate First Frame Only attribute (see section Shadow Maps).
- - If you do not need any shadow maps to be rendered again, turn of the Render Shadow Maps attribute of your render pass (see section Shadow Maps.
- - You can also create render pass nodes that will render only shadow maps by deselecting Render Primary Display and Render Secondary Displays attributes of your render pass node. You could create Maya sets consisting of a few related lights and create a render pass that would render only these shadow maps. This way it is easy to re-render only a few shadow maps and use a render pass that does not render any shadow maps to render the displays. Refer to The Render Pass.
- By default the objects lit by a light and the objects that cast shadows for a light are the same and are defined by the light linking. When using shadow maps, it is possible to have an object not lit by a light and still cast shadows. You simply need to create a Maya set that includes only the objects that cast shadows and specify that set in the Shadow Objects attribute of an attached light attribute node. Reversely, you can define a Maya set of lights that will illuminate an object and specify this set in a geometry attribute node attached to this object. The object will still appear in the shadow maps of the lights it is light-linked to.
3Delight 8.5. Copyright 2000-2009 The 3Delight Team. All Rights Reserved.