home about gallery publications education links forum contact


..::raytraced area shadows::..

Note from the author: This article was written with 3ds max 4 in mind. It should be noted that later versions of 3ds max contain a built in area light and area shadowing system..

In the current, and previous incarnations of 3ds max, raytraced area shadows cannot be created without the use of a third party plugin, yet we are able to create a workaround. Raytraced shadows have their advantages and disadvantages. They benefit from having the ability to create hard-edged lines and behave properly with transparency. On the other hand, these same hard-edged shadows can be totally unrealistic within certain scenes such as soft or diffused lighting and not direct sunlight. Also, these types of shadows can take an age to render especially with transparent two-sided objects, so overall use with Omni lights, which cast multiple shadows, are not overly recommended. Raytraced Area lights in general take longer to render as the basic concept behind them are several Raytraced shadow-casting lights (the number can vary) tightly packed together emanating from a large surface such as strip or tube lighting. For example a light may emanate from every face or vertex. On complex subdivided objects, render times can dramatically increase! In addition with this high number of lights, the shadows need to be blended together else their hard-edges will be visible and the required effect lost. All of these factors need to be taken into consideration when designing the effect, yet it is something that 3ds max can perform quite adequately without having to resort to a plugin.

Let us take strip lighting for example. Strip lighting is one solid tube of light generally used to illuminate offices and other places of work as they are quite inexpensive. Due to it’s physical size, the shadows become more diffused the further away from the illuminated subject they are cast from as the sides of the light illuminate the cast shadow from the other part of the light, and vice versa. There’s also the “light wavelength” physics aspect here, which I won’t bother going into at this time!
In our basic scene, we can create a large strip light to illuminate our basic primitives; a large cylinder primitive with a self-illuminated material applied will suffice, ensuring that cast and receive shadows are checked off in the object’s properties. To successfully illuminate the objects using this object as a light source, we could position lights casting raytraced shadows all along it’s surface. This would function well, however we require the ability to blend the shadows together to remove those harsh-edges lines, which would cause a banded effect.

We can remove those lines and create the desired effect using muli-pass rendering and one single light to emulate the strip light. A raytraced shadow-casting Omni light should be created to pass down the length of the strip light object, or preferably around and along it to generate the proper effect. This entire motion should be completed in one frame, so, for example, at frame 1 the light is back at the beginning again. This process should be repeated for frames either side of the desired frame to render as the multi-pass effect will be performed over one entire frame to create the required result.

To blend the shadows together, Video Post should be used as this has the ability to render off multiple pass motion blur for the entire scene that is not just limited to one specific object, such as when using Object Motion Blur. The amount of diffusion should be increased to it’s maximum setting to blur the shadows evenly and reduce the amount of banding in the resulting render. However, should you find that the end result is too pixelated, you can increase the amount of passes to smooth this out. Generally, the rule of thumb is that if you increase the amount of passes, you should reduce the amount of blending to compensate, and vice versa. Always perform a test render as on high polygon counts this type of effect may take a long time to render. Also, unless the multiple pass effect is limited to a very short timeframe, such as a fraction of a frame, and the entire motion of the light is covered in this time, this type of effect is best suited to still images due to the animated object or moving scene (in the case of an animated camera) also being blurred with the animated light.

Enlarge Screenshot Open the sample scene arealight_basic.max . This is a basic 3ds max 4 scene that consists of five objects: four basic primitives to illuminate and a ground plane object for them to sit on. Each object has the same material assigned, with a masked raytrace map in the reflection slot. You may with to turn this off if you find render times are too high for your liking.
Enlarge Screenshot Create a cylinder primitive and label it “Strip Light”. This is our main light source that shall be used to illuminate our scene. Assign the self-illuminated “Light” material to the cylinder and perform a test render. You will notice that the self-illuminated material has no effect on the scene as the default lighting is still being used.
Enlarge Screenshot To cast some light on the subject, create an Omni light and increase it’s multiplier to 2. Check on Cast Shadows and amend the shadow type from Shadow Map to Ray Traced Shadows in the Shadow Parameters rollout.
Enlarge Screenshot Create a Helix spline with the same radius and length as the cylinder, and position it directly over it. Increase the amount of turns to, say, 10. Select the Omni light and add a Path controller to it’s position motion controller. Add the helix as a path. Scrub the timebar and observe as the Omni light performs one full pass of the spline over the 100 frames of the scene.
Enlarge Screenshot Select the keyframe at frame 100 and drag it to frame 1. This ensures that the entire motion of the Omni is performed in one full frame. In Track View, select the Omni’s Path controller and click on the Parameter Curve Out-of-Range Types button and select both previous and subsequent frame buttons to Loop. This ensures that the motion continues from one frame to the next.
Enlarge Screenshot In Video Post, add a new Scene Event and select the scene’s camera. Check on Scene Motion Blur and increase the Duration to 1 and the subdivisions to a value of 50. You may wish to increase or decrease these as necessary. Increase the Dither spinner to 100 to blend the passes together. Finally, add an Image Output event (if required) and render the image.
Enlarge Screenshot The same technique also works with other types of light. Here, two spotlights are created using the same technique but on Star spline paths to cover the “disc lights”
Enlarge Screenshot Here the blending is illustrated between shadow passes. To reduce the amount of pixilation, take down the blend level and increase the number of samples per subframe.
Download the max file! Zip file to accompany - To reduce rendering times, please reduce the number of samples in the Scene Motion Blur parameters and/or turn off the raytraced reflections in the illuminated object's material.

..::tips::..

Only resort to using raytraced shadows if needed. Shadow maps have much greater flexibility for optimisation due to the ability of being able to have their sizes reduced. Instead of using Raytraced shadows for everything, combine the scene with raytraced lights for (partially) transparent objects and the rest use shadow maps. This should help bring render times down. Lights should include and/or ignore relevant objects as necessary to generate the desired effect.

Even though this technique creates a nice effect, it is only a workaround. Plugins such as Brazil, FinalRender or Lightscape to name a few produce better overall results and can be easily utilised with animation and moving cameras. They also take specific light values into consideration to perfectly emulate the required lighting method (although this may vary slightly from product to product).

If using shadow maps instead of raytraced shadows, create several lights by snapshotting the original light along it’s motion path. This will enable you to use the (now) faked area light with all types of motion blur without having to use the multiple-pass technique; the blurring effect can be emulated by increasing the sample size in the shadow map’s rollout.

This technique isn’t just limited to creating tube lighting. Virtually any type of light can be emulated, providing you can create a uniform path for the light to travel along or around. The path needs to be uniform to ensure that no concentrated dark patches appear in the shadows where the light has dwelled on an area for longer than necessary.

Initially published: 3D World magazine, Issue 27, July 2002.

Copyright © Pete Draper, July 2002. Reproduction without permission prohibited.

www.xenomorphic.co.uk