Download (direct link):
Looking at Figure 11-21, you can see an example of how the light reaches the ground from the sun. The light starts from the sun. Some of it shines directly down on you as it passes through the atmosphere. Anything that stands between this light and the ground creates a shadow. Other beams of light get caught and are reflected by the atmosphere. Eventually, some of that reflected light makes it way back down to the ground in the form of ambient light. The ambient light doesn’t necessarily come from the direction of the sun, but instead it comes from all directions and will fill in that shadow with a less-bright light.
As sunlight passes through the atmosphere, it is bounced around and comes to you in the form of ambient light.
To reproduce this effect that occurs in the atmosphere, you must use more than one light. One light is created and represents the direct light from the sun. It casts shadows and shines on the world. A second light is created on the opposite side of the map. This second light isn’t as bright and doesn’t cast any shadows or affect the surrounding world in any other way other than to produce the ambient light effect.
146 Part III: Expanding Your Creation
You could get further involved by adding even more lights for more effect, but it isn’t necessary. Two lights will be enough for most maps to create the effect you’re looking for.
Adding a virtual sun
Before you start adjusting the light, set up the CAM window to see how the changes are affecting the level. Press F3 and F4 to activate the Realtime and Render modes in the CAM window, respectively. Render mode displays the level in a way that resembles the game itself. Realtime mode updates the rendering in real time so that as you make adjustments to the light, you will see how the adjustments change your level. At the moment, the picture in the CAM window might look a little bit dark, but that’s about to change.
Here’s what you need to do to create a simulated sun:
1. Start by adding a light entity as you did in Chapter 7 to the northeast quadrant of the map, using Figure 11-22 as a guide.
Move the light near the top of the sky, where you will pretend your sun is sitting.
By default, the light isn’t strong enough to shine onto the ground of your map from such a distance. You could drag out the distance that your light can shine by enlarging the pink box that surrounds the light entity. However, such a method would create problems with larger maps. You would have to stretch out the box for more than twice the radius of the level itself.
Instead, you can apply a special texture to the light. Light textures are really just combinations of images and short scripts that tell the light how to behave. Light textures are already available in the Light Editor window.
2. Drag out the size of the light’s falloff level to fully encompass your level.
This larger, pink box surrounds your light. Make sure the pink lines reach just outside your map in all three directions like you see in Figure 11-23.
3. Press J to open the Light Editor.
The Light Editor, shown in Figure 11-24, allows you to fine-tune the light to meet your needs. Rather than having to remember all the Keys and Values for the light that can be manually entered into the Entity Editor, you can use this window.
Chapter 11: Heading to the Great Outdoors 147
Place the simulated sunlight entity in the northeast corner of the map near the top of the sky.
■^89683276870^64657 551644(03 8432^25)6192121864 54 128|l92i25 63 20Î3 84448k 125761640 ”47.
Drag the falloff level to fully encompass your map in all directions.
25 60 .
rr - — j- — - - - — ~ - — — - — — - - -
; : -J- — -