Shadow Passes in XSI
I was stumped where I had to setup a light scene in XSI, as I had never felt the need for lighting scenes properly. Managing Shadows and Shadow Objects was also a critical need. So, I thought I should write a blog about it as it may help people who are either new to setting up shadows in XSI or just for the heck of it.
I also hit this post, which helped me initially set up a light scene but then I reckoned, XSI has a built in Shadow Toolbar in the Net View, which can really speed things up for you. The English in the post I linked is a bit hard to understand for the fast reader, so I’ll go over the method here as well.
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:
• Ray traced shadows that use the ray tracing renderer. The shadows are very realistic but take longer to render. For information about creating ray traced shadows,
• Shadow-mapped shadows that use the scan line renderer. They are quick to render, but not as accurate as ray traced shadows. Shadow-mapping works only with spotlights.
• Soft shadows that are created by defining area lights. Area lights need to be rendered with the ray tracing renderer to obtain soft shadows.
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 use 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.
Method I – Partitions
If you do not know what Partitions are, you might want to visit XSI’s documentation. There is nothing to it actually; it clearly provides you with a grouping of objects in scenes. If you apply a behavior to a partition, all objects in the partition automatically follow that behavior and eventually it won’t affect objects in other partitions.
For those of you who like to do shadow passes by overriding primary and secondary rays, I personally find that to be more time consuming. So, I have chosen to make shadow passes using Simple Shadow and Shadow Illumination properties in the render tree applied with an override on the surface for the objects material.
My example is just a scene with two primitives. It does not matter what you use. Just know that you need three partitions.
• Partition 1 contains Simple shadow objects (objects that will cast shadow)
• Partition 2 contains Shadow objects (objects that receive Shadow)
• Partition 3 contains lights emitting shadow rays.
You can create a partition in XSI, in this way:
In the render toolbar, go to Pass->Partition->New Partition. To know which object to add to a partition, follow on.
My scene contains two objects.
A cone in the Simple Shadow Partition (Shadow caster)
A Grid in the Shadow Partition (Shadow Receiver).
A light in the Background Lights partition.
Simple Shadow Partition
Add an override to the Simple Shadow partition.
Add a material-surface parameter to the override by selecting a surface node inside the shader tree.
Open the render tree by pressing 7.
Inside the render tree add a simple shadow node. If you can’t see anything in the Render tree, then you don’t have any object selected in the correct partition.
Connect the node to the override Material-surface input.
Now for the shadow partition you are going to repeat the first few steps.
*Add an override to the Shadow partition.
*Add a material-surface parameter to the override by selecting a surface node inside the shader tree.
*Open the render tree by pressing 7.
Inside the render tree add a Shadow node and a constant node.
Connect the Shadow node to the color input for Constant and the constant to the override Material-surface input.
Things to note… I added a constant in between the shadow and the material override to give light a stop point for the shadow rays.
I am adding an override to the light, because I usually have many lights in the scene and the lights affect the environment. It is easier to override a light than to hide it in every pass. So I can use a light as part of my rig and also as my shadow light for my shadow pass.
For the light partition in my shadow pass, I add intensity and shadow parameter.
When the dialog box comes up just say you want to add them as parameters.
Add your intensity value and check shadows.
That will tell XSI to turn the shadow rays in the light on.
Things to be concerned about before rendering:
Antialiasing and Optimization
Antialiasing changes how close the object is or if your production has presets to follow. I did a test a moment ago and in your computer a min of 1 and a max of 3 will be fine for a shadow pass.
For Optimization it is recommended to use a diagnostic mode and depth to determine the proper BSP settings. Nevertheless, I have found that a min of 20 and a max of 60 will work.
Also make sure that you have enabled ray tracing on in order for shadows to render.
For reflection and refraction; regular shadow presets are fine.
Change your region settings to show alpha and you should be able to see shadows.
Now if you show alpha and rgb on shaded mode. This is what you will get.
Have fun and I how this was helpful.
Method II – Light Tools 2.0 Add-on in XSI
You can get the Light Add on from the NetView (Alt+5) in Windows or you can go to
-Once you have the toolbar open, create a light, preferably spot or point light.
–Click on contribute and enable diffuse and specular as required.
–Now click on shadows and select shadows on.
-If you want Soft Shadows, select Area Lights. If you want a Shadow Map, you can select Shadow Map.
You can perform these steps by entering the Lights properties as well.
-Now click on Region and enable shadows if you want shadows for a specific area and if you do not want all objects in your scene to have shadows.
– Open the light’s property window and make sure everything you created is set up correctly.
– Draw a render region and make sure you have Alpha Blended RGB Enabled, and you’ll see a shadow for your object.
Method III – XSI’s way
Honestly, I could not get this to work myself initially but this may be the alternative way if you want to set up shadows in XSI. In fact, this is the right way. Text in this method has been adopted from XSI’s documentation.
Creating Ray traced 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
- Select a light in the viewport and choose Modify > Shader from the Render toolbar to display the selected light’s property editor.
- On the General tab of the light property editor, select Shadows Enabled.
- 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.
- 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, set Ray Tracing to Enable (deselect Scanline Mode).
- On the Shadows tab and in the Raytraced section, select a Shadow Type rendering method: either Sort, Segmented, or Regular.
- 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.
To create shadow-mapped shadows
- Select a spotlight and open its property editor by choosing Modify > Shader on the Render toolbar.
- In the Light property editor, click the General tab and select Shadows Enabled.
- To use shadow maps, click the Shadow Map tab and select Use Shadow Map.
- 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.
- 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.
- 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.
- Set the Samples to adjust the shadow’s resolution. High sample values yield a higher render quality, but increase rendering time.
- Select Enable Shadow Map in Region to activate shadow maps in the render region.
- 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:
- 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.
- To view the shadow map in the render region, draw a region (press q) and choose Render > Region > Options from the Render toolbar to open the View Rendering Options property editor.
- 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.
– If your scene has motion blur, you may want to enable the Motion Blurred Shadow Maps option.
- 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 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
- Select a point or spotlight and choose Modify > Shader from the Render toolbar to display the selected light’s property editor.
- In the light property editor, open the Area tab and select Area Light.
- 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
Having area lights visible in the render is useful when you want lights to show up in reflections.
- 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.
- 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 in the Rendering guide.
- If necessary, adjust the size and orientation of the area light’s geometry as described in the following section.
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 XSI, 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.
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.
To toggle shadow casting and/or receiving
- Select the object whose shadow casting and/or receiving you wish to toggle, and open an explorer (press 8).
- Expand the object’s hierarchy and click its Visibility node to open the object’s Visibility property editor.
- On the Rendering tab, toggle the Shadow > Caster and/or Shadow > Receiver options as needed.
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
- Select an object from which you want to create a shadow object.
- Click the Selection button in the Select panel to display the selected object’s node.
- Click the Visibility node to open the object’s Visibility property editor.
- From the Ray Visibility options, deactivate Primary and Secondary.
- From the Shadow options, activate Caster and deactivate Receiver.
When you render your scene, you can reduce the pre-processing time by activating the Separate BSP for Shadow Objects option on the Optimization tab of the Render Options property editor._
Ok, that was a veeery long post, but I hope this covers almost everything on creating shadows in XSI. If you have a question, please ask.
© 2016 Most of the work on this site is mine, ask before using. Thanks. –