By Dave Jerrard
One of the biggest advancements in realistic 3D rendering is undoubtedly the ability to render realistic shadows with edges that blur more as the distance from the objects casting them increases. Called area lights, these new lights can simulate the lighting model of a fluorescent tube, or a flat panel, giving size to the the light source, which had always been a single point before. As of the release of version 5.5 of LightWave 3D, these new lights have opened up many new possibilities for artists, and 3D imagery has never looked better. However, there's a price to be paid for that realism. These new lights are not fast. They are also not exactly directional either, which can be a real problem. What happens when your favorite Client From Hell wants a character to be in a spotlight, and insists that the shadows look real? Or even worse, what if you just can't afford the render times involved with Area Lights? Here's a solution that set your mind spinning, among other things.
There's a little secret buried in Lightwave that few people know about.
Any light can be turned into an area light if you treat it right.
That's right, distant, point, and spotlights can all be made to cast those
beautiful soft edged shadows. One method was through the use of light
arrays, where you would make multiple copies of a light and place these
in an evenly distributed pattern, with the entire array parented to a null
for easy placement. (figure 1.) Each light would then cast a shadow
slightly offset from its neighboring light, and these shadows, given enough
lights were used, would appear as one soft edged shadow, with the
edge appearing sharp near the object and softening over distance.
![]() |
There are a couple problems with this method however. The first one is that setting the intensity of these lights can be a real nightmare, especially if you have a lot of lights in the array, as each light in the array will have to be adjusted. That is, until you feel comfortable linking intensity channels to one another. The other problem is render times. The more shadow casting lights there are in a scene, the longer the scene will take to render.
If we could generate multiple shadows from a single light, we'd solve both problems, but how? LightWave has already shown us that answer in the way it calculates Depth of Field by jittering the camera slightly during each antialiasing pass. Now, how do we make a light jitter around like that? We could use Noisy Channel, or some other modifier on the light's motion, but we need something that will be the same for each frame, otherwise, our shadows will appear to flicker.
Step 1: Load up LightWave and load the toys.lws scene from the LightWave CD. Create two null objects, and name one Handle, and the other, Spinner. Parent the spinner null to the handle null. Select the light and reset the light's position and rotation to 0, then parent it to the spinner null.
Step 2: We have just built the basic setup needed for our little lighting trick, so let's set it in motion. Open the Graph Editor and select the Spinner Null's Rotation:B channel. Create a keyframe at frame 1 and enter a value of 720 degrees here. Set the Post Behavior to Linear and close the panel.
Note: We didn't use a value of 360 degrees for an important reason. The Blur Length setting indicates how far back in time LightWave will calculate motion. At 100% LightWave will calculate the motions of objects all the way back to their positions in the previous frame. If we had our light rotate 360 degrees per frame, LightWave would render the entire span of that rotation with motion blur. A blur length of 50% however would only cover half of that rotation, so to get a full circle, we need to double the amount of spin. Field Rendering requires that we double this yet again. When Field Rendering is applied, the Blur Length is effectively cut in half, now being applied to each field. Thus, we'll need a bank value of 1440 degrees (720 doubled) for the Spinner null if we render with 50% blur and Field Rendering.
Step 3: In the Light Properties panel, change the light type to Distant. Select the light as the view mode, then select the Handle null. We'll use this to aim our light. For now, let's get the shadows to fall in the foreground, so set the handle null's rotation to H: -150 and P: 50.
Step 4: Since we're using a distant light, only the angle is important, not the position. What we have just set up will now spin this light on its axis every frame, but the light will still be facing the same direction, which will do nothing special. What we need to do is angle the light slightly so it's no longer parallel with the rotation axis of the Spinner null. We'll do this by changing the light's heading to 1 degree. Now, we're ready to render.
Step 5: Open the Camera Panel, and select Low Antialiasing, and turn on Motion Blur. (Dithered Blur will improve results) Leave the Blur Length set to 50% and make sure Trace Shadows is activated in the Render Options, then hit F10 to render frame 1.
Note: Rendering frame 0 will not calculate the effects of motion blur. By hitting F10, we tell Lightwave to start rendering frame 1, unless we specifically enter an alternative starting frame. Knowing this can make life easier by letting you stay on frame zero for initial setup without having to advance to frame 1 before hitting F9.
While this renders, you'll notice that the shadows adjust slightly during
each render pass, then get averaged together at the end of the frame, giving
a soft looking edge to the shadows. We just used Motion Blur to calculate
the shadows of a light from five (ten if you used Dithered Blur) different
angles and blending them together. At this low level of antialiasing,
you'll be able to discern the individual shadows, particularly from objects
that are distant from them. (figure 2) This can be reduced
by raising the antialiasing level to medium or high. The rate that
the shadows spread out is adjusted by the angle of the light to its axis
of rotation, in this case, the Spinner null. Larger angles will emphasize
the soft edge, giving the illusion of being lit by a larger (or nearer)
light source. In any case, it's inadvisable to use an angle greater
than 5 degrees since the individual shadows will start to separate, spoiling
the effect. The shadows will not be affected by the light's position
so you can place it anywhere. It's only the angle that matters here.
![]() |
Note: A few observant people have noticed that the light actually ends up in the same place twice. The location of the light at the beginning of this loop is actually duplicated at the end of it. There is a solution I left out of this tutorial when it was first published, which must be fine tuned for the rendering mode being used. To prevent the light from landing on the same spot at the beginning & end of its cycle, we simply need to shorten the amount of rotation by a small amount. This amount is based on the number of render passes, including Dithered Blur's additional passes (excluding Field Rendering) that LightWave is using. To be more specific, it's the number of degrees of rotation divided by the number of passes. For example, using the setup we've used here already, with the Antialiasing set to Low, we'd divide 720 by 5 (the number of passes for Low Antialiasing). We'd then subtract that from the original 720 and end up with a value of 576. For Medium AA with Dithered Blur, which is 18 passes, we would have a value of 680 degrees. To simplify things, when you set the value for the bank at frame 1, you can use type this equation right into the field: "720-(720/n)" and substitute the 'n' with the number of passes you're going to be using. (Hopefully a future version will allow us to create an expression that can access the number of passes internally, so we'd only need to input a single expression, and never have to worry about it if we later change the AA level.)
Since we used a distant light here, every object in the scene will cast these soft shadows, with the soft edge, or penumbra, of every shadow expanding with the same angle. This makes this technique ideal for those outdoor scenes.
Hint: To duplicate the shadows cast by sunlight, rotate the light's heading by .25 degrees. This will create a penumbra with a 0.5 degree angle, just like we have here on earth.
Now, how about those indoor ones?
Step 6: Open the Light Properties panel and change the
light type to Point. Now, before doing another render, we have to
adjust this light's position slightly. First, move the Handle up
and behind the objects. Try setting moving the null to X: 1.0 m,
Y: 3.0 m, Z: 2.0 m. Now, move the light itself to -10 cm on the X-axis.
This will put it off center of the Spinner, which will now cause it to
circle the null in a 10 cm radius orbit. Don't worry about its heading
since that has no effect with this light type. Again, hit F10 to
render. (figure 3)
![]() |
By spinning this light in a tight orbit like this, we've simulated giving it a size, in this case, a 20 centimeter diameter. However, since this is a flat orbit, the area effect is most apparent from the front & back of this light, much like a true area light. Shadows cast edge on from this orbit will look more like they were cast from a linear source. We'll keep this in mind for later. Let's move on to the next light type and really start to have fun.
Step 7: Again, open the Light Properties panel and change
the light type to Spotlight. Change the Cone Angle to 12 degrees
and the Soft Edge Angle to 0. Leave the Shadow Type set to Raytrace.
For this light, both position and orientation are important, so it should
be handled a little differently. We'll target this light to an object
in the scene for more control, so we'll use the Floor.lwo as that target
for now. Hit F10 once again for another test render of frame 1.
(figure 4)
![]() |
You'll notice that the shadows are virtually identical to the ones our spinning point light created, but this time, they're confined to the spotlight's cone angle. Also, notice that our spotlight doesn't have a razor sharp edge we'd expect from a Soft Edge Angle of 0. Sure it's little rough here, but by increasing the Soft Edge Angle slightly, we can improve it considerably. Let's continue with the next test first.
Step 8: Open the Light Properties panel again, and this
time, set the Shadow Type to Shadow Map. Set the Shadow Map size
to 512 and the Shadow Fuzziness to 1.0 and do another test render by typing
F10. (figure 5)
![]() |
The first thing you'll notice is that this image rendered much faster
than the previous ones, revealing an obvious benefit - speed. If
we look more closely at this technique, we'll find there are a couple hidden
bonuses to using a spotlight like this. The first is that by spinning
a shadow mapped spotlight, the resulting shadows will actually become more
accurate, allowing you to use smaller shadow maps than you normally could.
For example, set the Shadow Map size to 200 and render a frame with Antialiasing
turned off. In a few seconds, you'll have a pretty sick looking shadow.
(figure 6a) Compare that with the same shadow settings with the motion
blur applied. (figure 6b) Experiment with the Shadow Map Size
and Shadow Fuzziness settings to see how these affect the shadows.
|
|
Polylines and particles are not able to cast shadows, except through shadow maps. With this method, they can also cast area shadows, opening the door to some interesting effects.
Another added bonus is that now your spotlight beams can have a focal point applied to them, very similar to how a projector focuses at a certain distance. By using a null as a target for the spotlight, we have a means not only to aim the light, but to set its focal point, which will be centered on the null. In fact, let's create that projector effect.
Step 9: Clear the scene and load up the flatbox.lwo object
from the Objects/MappingPlates directory. Make two clones of this
object and position them similar to that in figure 7. No need to
be precise here, we just want to be able to project our spotlight onto
three separate panels at varying distances at the same time.
![]() |
Step 10: Create the null arrangement that we set up in Step 1, by creating two nulls, and parenting one to the other. Once again, open the Graph Editor and create a keyframe at frame 1 for the Spinner Null's Bank channel. Set the bank to 720 degrees (or use the more accurate method mentioned earlier) at this frame and set the Pre and Post Behavior to Linear. Close the panel and move the handle null back about 20 meters on the Z-axis.
Step 11: Create one more null, and call it focus. Leave it the origin for now and target the light to it.
Step 12: Open the Light Properties panel and set the light type to Spotlight and set the Shadow Type to Shadow Map. Parent the light to the spinner null and position it at 50 cm on the X-axis. Switch the view mode to Light and adjust the Cone Angle until you have portions of all three flatbox.lwo objects filling the view. We want to make sure our light will shine on each one for this experiment.
Step 13: Position the camera so you can get a good view
of the movie on all three panels. Open the Camera Properties panel
and activate both Low antialiasing Dithered Motion Blur. Leave the
Blur Length set at 50%. Use the settings below if you want to get
the exact results shown here.
| Flatbox 1:
X: 3.0 m Y: 0 m Z: 0 m |
Flatbox 2:
X: 0 m Y: 0 m Z: 3.0 m |
Flatbox 3:
X: -3.0 m Y: 0 m Z: -2.0 m |
| Camera:
H: -3.4 P: -14.2 B: 0.0 |
Focus Null:
X: 0.0 m Y: 0.0 m Z: 0.0 m |
Spotlight:
Cone Angle: 7.0° |
Do a test render to make sure you have light falling on all three panels. If not, adjust the position of the flatbox objects or Handle null, until you do.
Step 14: For our movie, we'll show my all time favorite, "The Monster That Mooed Manhattan" (obviously, a Roger Corman flick), by loading up the famous GiantCow.iff image. In the Lights Panel, select this image as the projected image for the spotlight. While we're here, let's darken the theater by reducing the ambient light to 5% or less.
Step 15: Before we can show our flick, we have one major detail to fix. Since our light will be spinning around, our projected image will also be rotating. We'll have to counter the rotation of the Spinner null by banking our light in the opposite direction. In the Graph Editor create a keyframe at frame 1 for the light's Rotation:B channel and enter a value of -720 here. This will cause the light to spin at the same rate, but in the reverse direction of the spinner null, effectively canceling it out.
Step 16: Position the focus null to the same Z value as
the middle panel, being sure to keep the X and Y values unchanged from
0. Hit F10 and sit back.
![]() |
Note: This setup is available in the Projector.lws scene is included on the CD-ROM.
In a few moments, you'll have an image projected onto three panels, but out of focus on two of them. The middle panel though, will be sharp since that is the distance we set our focus null. Try positioning the null near the other panels and rendering again. You'll find the same principles apply here as with Depth of Field for the camera. The farther you get from the lens, or in this case, the light, the greater the depth of field will be. The closer you get, the lesser the distance that will be in focus.
Well, we've covered what is now known as the Spinning Light Trick, but there's another trick we touched on earlier. Let's go back to that point light source again. Remember how it casts full area shadows, but only from the front and back? From the edge, the light would seem to be a straight line, like a Linear light! Well, there's a way we can simulate that type of light. That is to simply stretch the Handle null, which will apply the same stretch factors to the path of the light, turning into an elliptical orbit. In this way, we can conform the orbit of the light to fit virtually any rectangular area, or linear area. However, this will only work with a point or spot light. Distant lights will not be affected by this path stretching.
In all our lighting tests, we've been using a low level antialiasing to provide blur to our shadows. However, they've also suffered a little due to the fact that we could still make out the individual shadows. that were generated. By using Dithered blur, we can double the number of shadows to further smooth out the look. Increasing the antialiasing to medium, or even high will greatly improve the quality of these shadows, but at a corresponding cost in render time.
Another way to increase the quality is to add a second, or even a third light light to the null assemblies, each with slightly different radius. If the main light is placed at 10 cm, we could place a second light at -5 cm to act as a sort of counter balance. With two lights at low AA levels, we'll now generate 10 shadows, or 20 with dithered blur. We just need to be aware that we will now have to divide the intensity of the lights by the number we use in the spinning assembly since they will add up, quickly washing out the scene. We will also have to adjust the intensity of every light in the assembly to get the lighting just right. Luckily, for test renders, we don't have to wait for all those antialiasing passes. We can simply turn AA off for our test renders and still see exactly how bright our scene will be lit. Then, when we're satisfied, we just turn it back on, activate motion blur and let it render.
Ok, so we've been blurring shadows all day now, but what's the point if we have Area Lights in LightWave? In one word, SPEED. LightWave's Area lights take a long time to render. In fact, a single pass render with an area light can take nearly twice as long as a five pass render with a spinning light. Let's take a look at a few comparisons.
Using the toys scene we set up, we'll try each light type & compare
the results. My results are shown in the chart below, though your
values will undoubtedly vary. The shadow map size I used was 512,
with a 1.0 fuzziness value.
| Light Type: | No Antialiasing: | Low Enhanced: | Medium Enhanced: |
| Distant:
Point: Spot (Raytraced): Spot (Shadow Map): Linear: Area: |
29 seconds
34 seconds 32 seconds 18 seconds 178 seconds 342 seconds |
238 seconds
285 seconds 258 seconds 151 seconds 853 seconds 1705 seconds |
432 seconds
501 seconds 511 seconds 292 seconds 1602* seconds 3078* seconds |
|
|
|||
As you can see, the Area Light takes about ten times longer than a normal light without any antialiasing. Even if you were to apply adaptive sampling to a frame involving an area light, it will take about as long to render as a normally illuminated scene with Enhanced Medium antialiasing. Meanwhile, our shadow mapped spotlight comes in at about half the time of its closest competitor, and it's one of the most versatile lights we have in our arsenal. Now, you're probably asking yourself, "why even bother with these Area Lights if they're so slow?"
Let's not dismiss these new lights entirely. They do have attributes
the others don't. For instance, their lighting model more closely
duplicates that of the real world. Let's compare the Area light with
a spinning point light and a spot light. The first thing you'll notice
is that the area light has a significant falloff, even though we never
specified one. At the same intensity value, the area light creates
a stronger hotspot on nearby objects, and generally gives a much more dramatic
feel overall. Our point light, while faster rendering, tends to look
a little flat. Applying a falloff value to it will improve the appearance,
but we'll also have to increase the intensity to try to match the Area
Light.
Our shadow mapped spotlight also feels a bit flat compared to the area
light, but even at medium enhanced AA, it renders faster than an area light's
single pass. Again, a falloff value and a higher intensity can adjust
it to match the area light. The greatest benefit aside from speed
is the fact that the area effect is constrained to the spotlight's cone
angle. We could simulate this spot effect with an area light by placing
it inside an open ended tube, but that would impact the render time even
more since so much of the scene would now be in the shadow of that tube.
![]() |
So, what have we learned from this? For one, we now have a way to improve our scenes with soft area shadows and still squeeze out precious minutes per frame. More importantly, we've added a useful lighting technique to our toolbox, nearly doubling the number of light models to choose from. I don't know about you, but I feel like making shadow puppets now.
Copyright © 2001 Advanstar Communications, Inc.
All rights reserved. No portion of this CD-ROM may be reproduced, duplicated or used in any form or by any means, graphic, electronic, or mechanical, including photocopying, recording, taping, or information storage and retrieval, without written permission of the publisher.