How to Use Directional Light to Make the Sun in Unity 4.3

show more Creating the sun using a directional light provides you with in-depth training on 3D + Animation. Taught by Adam Crespi as part of the Unity 4.3 Essential Training show less
please wait ...

Creating the sun using a directional light

When we're lighting a scene we should start with the biggest most prominent light first and really get that established. And then let the other lights fill in the smaller spaces. For us in this scene, because we're working in daylight, the biggest light we're going to use is the sun. We've put one in as a working sun. A directional light. And we'll modify this, get it aimed correctly, and get the color tinted for our warm afternoon sun. What I'll do first is to zoom out, select that light and move it in a little closer. It's way out in space.

And when I select it here and press F to focus, we can see how far out it is. What I'll do is hold V for snap and just snap that light onto a building. Now when I zoom out, I can frame out my entire structure and light without being way out in space. With that directional light selected, I'll pull it up. With the directional light, it matters where it's pointing not where it is. Really, I can have this any where I want. It's infinitely wide. We can also consider it as having it Overshoot on. If you're familiar with directional lights and 3Ds Max, for example.

That is, the size of the light is infinitely big. Or we can consider it as just always having parallel rays that way. Whichever way you want to think of it. Again, it matters which way it's pointing, and we can see that by those rays coming off the transform. If you need to make a new directional light, you can always choose Game Object > Create Other and Directional Light. But I'll reuse this one. First, I'll name this light. I'll call it, sun. And this way I can recognize it easily. Now I'll rotate it. What I look for in a light when I'm rotating it over is that it's coming in diagonally in two views. That in a front or a side view, the light is streaming in diagonally, and that in a top view of bottom view it's coming in diagonal. Then I look at the major windows in the scene. I'll switch over to a wire frame. And look where the windows are. The back building actually has the most windows, and so as long as the light is coming in through most of these, we should be okay. This front building with the spawn point in it has windows on the, well it could be the south or east side depending on the way it's rotated. So again, as long as the sun streams in from those balconies, we'll be fine. This last building has mostly a solid wall, presented to those same directions we'll have the light coming in. So we'll get some good sunshafts coming through some of the windows, and we'll do our best, but some of it may be in, well in the shadow. Now I'll adjust my light. Again, I'll go in a Top view and rotate it over, pressing E to rotate, and using the global rotation for the tool handle. I'll spin this over a little bit, making sure it's not at a 45. Then I'll go back, either in a front view or just orbit down, and line this up as low as I can. I want those sunbeams to slink in through the windows, reach across the floor, and slide up the opposing wall. And I want to think of it in those very lush terms, actually. It may sound odd to think of it that way. But as directors of photography, we want to think of light as our actor we're directing. We need to add the feeling through the light in the space so the audience, the players, are presented with a mood before anything happens. Now I'll turn on my Texture view and crank up the intensity of this light. I'll put it back to about 1.1 or so, and then I'll click on the light color. Right now its white and it can look a little bit cold. What I'll typically do is bias it just a little bit towards the warm yellow. Again with the hue in the 35 range of work, and here's a saturation of a grand 5. Now, it may look like well, just another pale white, and it is but it has a little bias in that color. Remember that with lighting, lots of little nudges get us in the direction we want to go. We can't just take this light and make it orange and have it look nice. It'll be, well, orange in our scene. I'll check this out before I adjust the shadow quality, pressing Play and taking a look at my game. I've got some pretty good reach in the sun beams, especially right here. Running around the emmas and into the lobby, I can see I've got all that shadow play from those window mullions coming in across the balcony and all the way through. In this space, where it's mostly got walls in it, it's fairly dark, and so I'll need some interior lighting. This window doesn't have a lot going on. I think it's just out of view enough that we're not seeing enough of a sun shaft. Because there's a little bit of one just on the sill. All in all though, this looks pretty good. I'm getting a good shadow on the opposing buildings and some light coming in. The building across the way through the bridge also has sun streaming in through those windows, and so I feel like it's in a pretty good place. I'm going to warm it up and dim it down just a little bit more. And my directional light for my sun should be set. I'll take this light back. Pulling back the intensity to 0.9. And then I'll add a little more saturation in that color. It's still a pale orange with a saturation at 15. The values up and I'm just introducing a little warmth in there. I'll try it one more time. I'm really starting to see how the combination of the ambient light and the directional light is blowing out some of the surfaces. That's a little better. It's still a little hot on some of the brick because of the specularity, but I actually kind of like that little glow there. I've got soft warm sun streaming in those windows even with the aliasing going on because I haven't upped the quality. I like the way it's looking on the wood floor and across that brick paving. Nothing in here is terribly blown out except for just that shine. And again that looks pretty reasonable. It's okay to see some things be a little bit hot. And it kind of reinforces how decent the shadows look. After we get that major light in, the directional, we can start to work in our interior lights. Our points and spots.

Creating the sun using a directional light
Video duration: 5m 49s 6h 49m Beginner


Creating the sun using a directional light provides you with in-depth training on 3D + Animation. Taught by Adam Crespi as part of the Unity 4.3 Essential Training

3D + Animation Developer
please wait ...