Effective Scene Lighting for CG Space
BetterSpace
The final touch, and the one that is most often done badly in CG space scenes, is adding decent lighting to the scene. All the hard work you've put into building and texturing your objects will be a complete waste of effort if your lighting sucks.
Lighting a scene is a fine art, you must ensure that your rendered images are neither too bright nor too dark, with enough contrast to pick out the form and detail of your objects... the list goes on.
This lesson will deal with lighting tech-based ships.
1) | Previous Step | Next Step |
The good news is that with an object as well detailed and textured as the one we have been building in the previous lessons, lighting is remarkably easy.
Start by opening Lightwave Layout and loading the object we've been working with up to now.
Move and rotate the camera so that you are looking at your object in a similar way to that shown here.
camera moved & rotated |
Leave the lighting setup as it is, with one distant light source set at 100% intensity and ambient light at 25%.
Next, open the Camera Panel and set the following options:
|
||||||||
camera settings |
2) | Previous Step | Next Step |
Now press F9 to render a quick test render.
default lighting |
As you can see, the default lighting setup isn't too bad, but the image looks a little flat.
An easy way to alleviate the flatness of the image is to enable ray-traced shadows for the main light source.
Open the Render Panel and enable Ray Traced shadows, then render the frame again.
default lighting with shadows |
This is looking better, and definitely shows off the form of the object better, but there isn't a great deal of tonal range on the object.
3) | Previous Step | Next Step |
The primary cause of this flat, uninspiring lighting is Ambient (non-directional, global) Light.
Nearly all 3D animation packages have this feature in some guise or another... and it is nearly always the single most destructive force when it comes to making good-looking CG space. Ambient light (in Lightwave terms) is designed to be a quick and easy way to simulate reflected light in the scene. It does this by automatically increasing the luminosity of all surfaces (although you never actually see the luminosity values being altered). The result is a non-directional lightening of all surfaces, and the higher the ambient light level, the lower the contrast will be between light and dark areas of the objects in the scene.
I'll show you just how nasty it really is.
Open the Light properties panel, and click the 'Global Illumination' button.
Set the Ambient Intensity to 50%... this is going to be bad.
global illumination panel |
Hit F9 and stand back to witness the true horror... I warned you... If you really want to see just how bad ambient lighting really is for a scene, reduce the intensity of the main scene light to 0% and increase the ambient intensity even more. The result of doing this is too unpleasent to post an image here. Quite obviously, this horrible tool of Beelzebub should never be used in CG space scenes, so return to the appropriate control panel and turn it off, kill it, anihilate... kill... KILL KILL! ...or simply set the Ambient Intensity to 0.0% Ensure that the main scene light is set back to 100% intensity and render again. Suddenly, the object appears far more natural against the black background. |
|
So now our object has some bright areas where the light catches it, and also some absolutely black areas where the object is oriented away from the light, or where there are shadows.
This kind of lighting is probably the most accurate simulation of lighting in space, where the main lightsource would be the nearest star, and there would be no other light source.
However, thanks to film and TV, this is not really how we expect space to look. Shows like Star Trek, and films like Star Wars create their space scenes by photographing miniature versions of the ships in a studio environment, and this is the kind of look that the general public expects to see when they see space scenes, rather than the look of real space.
4) | Previous Step | Next Step |
For now, we will continue to deal with real space lighting, and we will move on to recreating the studio look later.
Let's add a few more objects to the scene. Luckilly, we have already created a repository of space sscenery in a previous lesson. Using Lightwave's Load From Scene feature, load up the objects that are part of the scene we saved at the end of Lesson 5, called Space_Environment_03.lws. This will load up three starfield objects and a nebula, with all their rendering settings (such as shadow-casting and object dissolve) intact. When Lightwave asks if you want to load the lights from the scene as well as the objects, click NO. The scene that I load up will include a blue nebula, and I will base the remainder of this tutorial on there being a blue nebula in the scene... so if your nebula isn't blue, then you'd better pop over to Photoshop to make a blue version...
Rotate the nebula to H=-133, P=-20, B=31 so that it is visible behind the object and render again.
scenery added |
When Foundation Imaging were designing the CG effects for Babylon 5, one of the primary reasons for the large blue nebula seen behind the Babylon 5 station was to pick out the black silhouette of the station against the backdrop. As you can see, the nebula does the same job here.
Now we have some context for the lighting in our scene, but the object appears a little 'stuck-on' to the backdrop.
One of the most important things to strive for in lighting CG space is to have a context, or cause, for every light source in the scene. The image we just rendered looks odd because the lighting does not really tally with what we can see in the scene. We have a very bluey backdrop, but the predominant lighting colour is white. Let's fix this now.
Change the colour of the main light source to R.230, G.230, B.255 to give it a bluey tint. If you render this frame, you may notice that the whole object appears a little dark, so increase the light intensity to 150% to simulate proximity to a fairly bright star.
light colour and intensity changed |
The object now sits a little more comfortably against the backdrop. From now on, I will refer to this first light as the Key Light. I suggest that you rename the light to reflect this.
5) | Previous Step | Next Step |
A good rule of thumb to follow it to only create an extra lightsource when there is a scene element that might be causing emitting or reflecting this light. For example, if there are two lightsources, ask yourself the question "what is causing this second light?". It could be a planet reflecting starlight, or a nebula giving off its own light... but you get the idea.
I want to add a second lightsource now, to simulate the blue light spilling out of the nebula. Create a second distant light source with the following settings: Name the light Kick Light and give it a colour of 81,81,255 (RGB) with 25% intensity. As the nebula does not emit light from a single point, but rather, is an area of light, I will turn off all shadow casting options for this light. Finally, give the light a rotation of H=-133, P=-20, B=0 to roughly correspond to the orientation of the nebula object. |
|
If you render out the results, you will see that the effect is subtle, but noticable, and further helps to tie the object to the background.
kick light added |
6) | Previous Step | Next Step |
Okay, so we've made the object appear as if it's in real space, but the look that we are hoping to achieve is that of a practical model shoot in a studio. The effects for TV series such as Star Trek : Voyager are produced entirely in CG, but the effects artists strive to achieve a look that is not dissimilar to that of earlier Star Trek series, such as Star Trek : The Next Generation, which was produced almost entirely with practical models.
To begin to simulate these lighting conditions, we must add a further light to simulate some of the inevitable reflected light from the studio surroundings.
Add a third distant light source with the following settings:
|
||||||||||||||||
fill light settings |
The orientation of this light is designed to fill-in some of the very dark areas of the object, while retaining the blackness of the shadows in some areas.
fill light added |
So now we have a pretty good start to our studio lighting setup.
7) | Previous Step | Next Step |
A huge advantage of the distant lights that we have used up to now is the fact that their position in the scene is irrelevant. If you didn't know this already, take note! To prove this, move (do not rotate) one of your light sources so that it does not even point at the object, and render the last frame again. What do you see? No difference! The only transformation in 3D space that changes the effect of a distant light is its rotation.
This is why it is important to turn off the shadowing options for the nebula in any space scene, or else the nebula will cast shadows over everything else in the scene. In the image below, the light coloured white/grey would not shine at all on any of the objects in the scene if the nebula had cast shadows enabled, as the light comes from an infinitely far-off point on the axis of the light (indicated by the white arrows), and therefore, the nebula would block the light coming in.
|
|||||||||
distant lights explained... |
I digress... anyway, distant lights are very good for simulating real space lighting, and their non-positional nature means that your objects within the scene can move around freely without having to alter the position or rotation of the lights to follow them.
However, by their very nature, distant lights have some distinct disadvantages, especially when it comes to simulating a studio lighting setup. One of their major limitations is that they cannot render and kind of shadows except by ray-tracing, and ray-tracing is very costly in terms of render time. Ray-traced shadows are also incapable of creating a soft edge, except by using special tricks with the motion of the light, which I will not go into here.
Move your camera in close to the object and render a frame, and you will see the harsh, sharp edges to the shadows. This is something that does not happen with studio lights, mainly because it is impossible to have an infinitely large studio in which to position distant light sources...
shadows are very sharp |
The closest we can come to studio lighting using Lightwave (without incurring massive rendering overheads) is to replace our distant light sources with spotlights casting shadow-mapped shadows.
8) | Previous Step | Next Step |
Shadow maping may sound a little like a texturing tool, and in fact, it is. Shadow mapping works by rendering a version of the scene as seen through the light, and then working out which parts of the scene's objects are lit, and which should be in shadow. This information is then converted into a kind of diffuse map for the whole scene, which is invisibly applied to all objects during the render.
Because a map is created prior to the actual rendering of the objects, we have the ability to affect the map before it is rendered onto the objects. These settings are accessed through the lights panel when the shadow type for a light is set to Shadow Map.
The two important settings are Shadow Map Size (default = 512) and Shadow Fuzziness (default = 1.0).
The Shadow Map Size controls the resolution of the shadow map created, so if you need a very vague shadow, you can probably get away with a size of 256 (which creates a map measuring 256 x 256 pixels), whereas if you wanted to see very detailed shadows that are more like ray-traced shadows, you might want to increase the map size to 1024 or even 2048 (creating a very detailed map of 2048 x 2048 pixels). NOTE however, that large shadow maps like this are VERY costly in terms of memory, although they still render a lot faster than ray-traced shadows.
The Shadow Fuzziness setting controls the amount that Lightwave will blur the shadow map before it is rendered onto the objects, effectively giving you a control for the softness of the shadows' edges.
Let's convert the lighting setup in our scene to a shadow-mapped solution now. Go through the three lights in turn, and give them these settings:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
spot light settings |
Notice that I have increased the light intensity for the key light to 200%. I have done this because the spotlight will, by its nature, cast a more distributed, more diffused light than a distant light.
If you now re-render the previous frame, you will find that we now have a more pleasing play of light on the surface of the object, and the shadows have a nice soft edge to them.
lights converted to shadow-mapped spotlights |
9) | Previous Step | Next Step |
A major problem that we must overcome when using shadow-mapped spotlights is the fact that their position is important. Thus, if were to move our object now, it would move outside the light from the spotlights and become completely dark.
There are two solutions to this problem. The first solution would be to move the spotlights a very, very long way away from the object, so that wherever the object moves, it is still within the cone of light cast by the spotlights. However, this solution brings with it a major disadvantage. In order to keep a decent level of detail in the shadow map with the light set to illuminate such a large area, the Shadow Map Size would need to be enormous, and would certainly cause all but the biggest computers to choke. Therefore, this solution isn't really a solution at all, but more oa problem.
The second solution, and the one which is far more user and computer-friendly, is to have the lights track with the object. What this would mean is that the lights retain their relative position to the object, no matter where the object moves to.
The simplest way to achieve this effect is to parent the lights to the ship object that is moving... but this is only half the solution, because as soon as the object rotates, the lights will rotate with it, completely destroying the illusion of these lights being part of the environment, and not attached to the object.
What we need to do is have the lights inherit the X,Y and Z components of the object's motion, but to ignore all other transformations, such as rotation.
To achieve this, I will describe two methods, one of which will work in both Lightwave 5.6 and Lightwave [6], and the other which is specific to Lightwave [6], or a plugin-enhanced Lightwave 5.6. The Lightwave 5.6 method will require some manual adjustment to the lights following every alteration to the motion path of the ship object, while the Lightwave [6] method is completely automatic after the initial setup.
10) | Previous Step | Next Step |
The steps described below describe the two methods available to achieve the tracking-spotlights effect. The Lightwave 5.6 method will also work in Lightwave [6].
Begin by adding a Null Object called Lights Parent to the scene.
Now take each of the three lights in turn and parent these lights to the Lights Parent null. The lights should stay in their same positions within the scene at this point, as the Lights Parent has no motion.
This technique is a bit long-winded to set up, but once it's done, we will never need to come back to it, as all the updating of the lights' positions is automatic.
Leave the ship object with the default motion path for now (one keyframe at frame 0, XYZ=0, HPB=0).
Select the Lights Parent null object and open the Graph Editor so that you can access the motion controls for this object.
We are going to use a plugin that comes with Lightwave [6] called LW_ChannelFollower to control the motion of the Lights Parent null object. We will slave the XYZ position of the Lights Parent to the XYZ position of the ship.
Double-click the name of the Lights Parent null object in the bottom-left panel of the graph editor (1) to ensure that we are editing this object only, and you should see that a list of the available motion channels for that object appears in the top-left panel. Click on the Lights Parent.Position.X channel (2). This tells Lightwave that we want to edit the X-position motion channel for the Lights Parent object.
Lightwave [6] graph editor (image cropped) |
Click the Modifiers tab (3). Click on the Add Modifier (4) button and select LW_ChannelFollower to add LW_ChannelFollower as the Modifier plugin. This plugin will then appear in the list of active modifiers for the motion channel.
Now double-click the name of LW_ChannelFollower in the active modifers list (5) to access the plugin's options.
Scroll the list of scene items in the Channel Follower options until you find the ship object (in my case, this is called My Detail Object:Layer 1). Click the small grey triangle (6) next to the name of this object to expand the available motion channels. Double-click on Position.X (7) in this list of channels, then click OK to exit the plugin options panel.
channel follower options |
When the panel closes and you are returned to the Graph Editor, you should find that whereas the plugin list used to say 'LW_ChannelFollower' it will now say 'LW_ChannelFollower Position.X'. This confirms that the X-position of the Lights Parent null object is now slaved to the X-position of the ship (My Detail Object).
You must now repeat the steps above in order to slave the Y and Z position of Lights Parent to the Y and Z position of the ship object.
When you have done this, exit the Graph Editor create about 100 frames of animation with the ship object, animating its position and rotation over time.
If you now playback the animation in the Layout window, you will see the lights following the object, but not rotating with it. Superb!
Lights Parent slaved to position of ship object |
Note: if you use the Lightwave [6] Channel Follower technique and you move a keyframe for the ship objects, you will not see the lights move until you move the timeline or hit the play button. This is a common occurence among motion plugins for Lightwave.
11) | Previous Step | Next Step |
Here are a few other lighting setups you may want to try out, some of which I have used in the test renders showing my cruiser model. For your reference, the ship in the renders below is pointing straight down the Z-axis.
Just out of interest, all the nebulas shown in the following images were hand-painted using the methods described in an earlier lesson of this tutorial series.
|
This first lighting arrangement gives a harsh, cold light to the scene using distant lights. All three lights cast ray-traced shadows, so the render times can be fairly high. If you want to use this lighting setup but the shadows' edges are just too harsh for you, try rendering your frames with Soft Filter enabled in the camera panel. I recommend that you use a dim nebula with a bluey-tint, or no nebula at all when using this lighting setup.
|
|
This second lighting arrangement gives a soft, warm ambience to the scene, although the key light at 250% intensity gives very strong, over-exposed highlights. I recommend that camera is oriented so that it points towards this light, or the objects may appear overly bright. The large size of the shadow maps in this setup reflects the need to create an adequately detailed shadow for the level of detail on the object shown... but having three maps each at 2048 is very hungry for memory. Be careful that your computer does not start using virtual memory too much, or your scenes will take weeks to render.
|
|
This setup gives a cool, soft atmosphere to the rendered images, tinting the objects with a slight yellowish tinge. This lighting arrangement is suitable for a scene without a nebula, or, as shown here, with a pale turquoise cloud. Once again, it is recommended that the camera points towards the key light with the object inbetween the two, rather than having the key behind the camera.
|
I hope these example lighting setups give you some ideas for your own creations.
12) | Previous Step | Next Step |
The second and third lighting setups described above are very memory-intensive, and may cause computers without huge repositories of free memory to revert to 286 speeds... so are there any ways we can optimise the shadow maps to use less memory?
There is one little trick that you can apply to your lights that may allow you to reduce the shadow map size a little, and yet still retain the required level of shadow detail.
By default, shadow maps take the cone angle of the light as a basis for the area they cover. When you are rendering a single ship, this can often be quite wasteful, with the majority of the shadow map being used to cast shadows on areas of the scene that contain no objects, as you can see in the screengrab below, showing a view seen through one of the spotlights, where I have coloured all the areas that the shadow map covers, but do not contain any objects.
|
|||||||||
wasted shadow map area |
What is even worse is the fact that shadow maps are always square, so in fact, the area wasted is even larger than that illustrated above. Therefore, a lot of the memory that we are spending in order to gain a high level of detail for our shadows is actually being wastefully thrown away.
If you open the properties panel for the currently selected light, you will see two controls at the bottom of the window called Fit Cone / Use Cone Angle and Map Angle / Shadow Map Angle (depending on your Lightwave version). To begin with, remove the tick from Fit Cone / Use Cone Angle so that we can manually control the amount of the light cone will cast shadows. Now change the Map Angle / Shadow Map Angle to something smaller than what it currently is.
If you look through this light in the Layout view, you will see a dotted box appear within the spotlight's cone (as seen below). Gradually reduce the Map Angle / Shadow Map Angle until the box is slightly larger than the object you are attempting to illuminate. You may have to alter the position or rotation of the light slightly, so that the object is centered within the light cone.
|
|||||||||
optimisation level 1 |
In the image above, I reduced the Map Angle / Shadow Map Angle to 15.0° from the default 30.0°. You can now see, from the image above, that the proportion of the shadow map that will be wasted is now greatly reduced, effectively giving us higher-resolution shadows at no extra cost in terms of memory.
That's a pretty good start, but a spot of common sense will tell us that a square's longest dimension is it's corner-to-corner diagonal. We can make use of this fact, and optimise our shadow map use even further.
We can achieve this by altering the Bank angle of the light itself, until the object lies across the diagonal of the shadow map's square area. Following this, we can further reduce the Map Angle / Shadow Map Angle until the box neatly encompasses the object to be illuminated.
|
|||||||||
optimisation level 2 |
After you have optimised all your shadow maps in this fashion, go back to the Light Properties panel and gradually reduce the size of your shadow maps and test render, until the level of detail in the shadows is no longer satisfactory.
13) | Previous Step | Next Step |
Another useful tip that can save you a lot of time is building libraries of lights for use in later scenes. Here at AP3D, we always save a separate lighting scene for the projects we work on so that we can quickly bring in the lights to another scene from the same project.
Here's how to do it.
First, make sure that all of the environmental lights (such as the key, fill and kick lights) are not parented to any objects. Next, clear all the objects out of the scene, along with any lights that are attached to objects (such as lights used as engine flares etc.) When this is done, create a single null object called Scene Lights Parent and parent all of the remaining lights to it.
Now save your scene as My Lighting Setup.lws or something that means more to you personally.
Clear the scene so that you have a fresh, empty copy of Lightwave. Load up a few objects of your choice. Finally, open the Lights panel and rename the main, default light kill-me or something else that is easy to recognise.
You can now use the Load from Scene function to load up the contents of My Lighting Setup.lws into the scene you are currently working on. When Lightwave asks you if you want to load the lights from the scene as well as the objects, click YES / OK.
Open the Lights panel again, and you will see that the lights from My Lighting Setup.lws have all been brought into the new scene, with all their settings intact. The only modification you will need to make here is to find the light that you called kill-me and remove it from the scene. The position of the entire lighting rig can be quickly and easily controlled by moving and rotating the Scene Lights Parent null object that was brought in with the Load from Scene action.
Using this method you can quickly build up a library of different lighting setups you have created that you like, so setting up new scenes can be even quicker.
14) | Previous Step | Next Step |
The most important thing in lighting space scenes is to have a good range of very bright highlights, and very dark shadows. This is the reason why ambient lighting is such a big no-no in space scenes, because if there is ambient light in your scene the shadows will never go right down to black.
The best way to achieve these very bright highlights is usually to position the key light behind the object, pointing at the camera. A certain amount of fiddling with this key light will be necessary in order to get the highlights to appear exactly as you want them, with pleasent shadows coming from protruding structures obstructing the light's rays.
key light pointing at camera |
Quite often, you will find that your key light needs to go way beyond 100% intensity in order to get the highlights bright enough. In photographic / film terms, you should aim to considerably over-expose the highlights on your ships.
Once you have got your key light into a good position, you can start to lighten-up the faces of the ship oriented towards the camera with fill lights, and then pick out some nice edges with kick lights. The following series of images will demonstrate the steps involved in setting up an example lighting rig. The scene I will be using is the one used for the screengrab above, so you can see the relative positions and orientations of the lights.
This is the scene I am going to be lighting, shown here with no scene lights at all, and ambient light turned right off. The only light on the object at the moment is coming from the luminous windows. |
|
||
Firstly, I will add my Key light. This spot light has 250% intensity, and a pale yellow colour. Its position and orientation are set so that very intense highlights are achieved on some of the top surfaces of the ship. Notice that much of the side of the ship facing the camera is in total darkness. |
|
||
To brighten-up these very black areas, rather than cheat and ramp up the ambient light levels, which would eliminate the blackness of the recessed areas completely, I will add a fairly bright fill light. I have positioned and rotated this light so that it shines from the rear of the object upwards, leaving some very dark areas on the object, but giving some definition to the underside of the ship. |
|
||
|
|||
The ship now looks a little cold, so I will add a fairly dim, coloured fill light shining from the front of the ship. This light will act as a kind of interface between the harsh light of the key, and the softer light of the first fill. Its effect is very subtle, but the colour bias it gives to forward-facing surfaces helps to give more solidity to the object. With all the lights turned on, we have ourselves a pretty nice lighting rig. (Why does that last line sound like a Macguyver script?) A larger version (1024x768) of this final image can be downloaded here. |
|
||
|
That pretty much concludes this lesson, although I will probably extend this particular lesson at a later date when I think of some further useful things to write about. If you have any questions or suggestions for additions to this lesson that you feel are of sufficient general interest to be included here, use the feedback form at the bottom of this page.
© 2000 Kier Darby and Alternate Perspective 3D Ltd. |