Reorient the directional light to simulate sunlight and adjust its shadow and quality settings for each platform you plan to deploy to.
- [Instructor] This is the start of a new chapter, so let's choose the corresponding project. Go to File, Open Project, click Open, go to chapter three, and select the project folder. Unity will relaunch using this new file structure, which is just where we left it off at the end of the last chapter. I'd like to now examine the sunlight in the scene, and our scene has just a single light source called Directional Light, which was created by default when we first launched Unity.
If you try to move the directional light, nothing seems to happen. That's because the position of this light really doesn't matter, it's the direction of the light which is significant. So I'll go to Rotate, and then change the direction by dragging on this gizmo. So let's think about this site and where it is on the Earth. It's in the northern hemisphere, and north is that way. I know from examining it in Google Earth.
So that means that the sunlight has to be coming from the south, like this. We don't want the sunlight to come from the north, because that would be impossible at this location, so I need to have the sunlight come from over here, and this would represent morning, afternoon, late afternoon, evening. So anywhere in this hemisphere down here would be acceptable. Now, we're not doing an accurate sun angle calculation here, we're just trying to keep something that makes sense on the ground here.
So I'm going to actually choose this angle based aesthetically on the way that the shadows appear on the ground. So I think the shadows are rather dramatic, especially where they're coming through this awning and landing on the architecture, and if you look over here, this is rather interesting, too. So I'm choosing my sun angle aesthetically, but again, I want it to make sense for the site. So I'm satisfied with that angle. Now let's move the sunlight up above the building, just as a visual reminder that we're using this particular directional light as the sunlight.
I'll also rename that Sunlight, just to be clear on how we're using this particular light source. Now I'll zoom in here and take a look at the shadows. We can also change the color of the light right here. Now if I move this over, the color will become more and more saturated, and it will dramatically influence the appearance of all the objects in the scene. This might be more like a sunset, but I think we want to stay kind of over in this region where we don't have very much saturation, and I'm actually going to tone that down a little bit by moving this over closer to white, so that we don't have such a yellow cast.
We already have a lot of yellow from the architecture, so I'm just going to bring the sunlight over here more into the white area. So let's take a close look at the shadows on the ground. We have different options of how they will appear. Also note the shadow of the character. So right here, we can change the Shadow Type to No Shadows, which is not physically possible, of course. We don't want to select that. We can choose Hard Shadows, which are calculated quickly, but the disadvantage of hard shadows is that the edges are aliased.
You see the jaggyness of the edges? Soft shadows are better, as they appear more blurred on the edge. If you look at shadows in the real world, you may notice that the shadow edge is blurred the further away from the casting object it is. We can simulate that, sort of, by changing the strength of the shadow, so it's not so dark. I'll bring this down into the region of maybe 75 or 80%. We can also change the resolution here.
Low Resolution shadows are very blurry. You can't really even tell that this is the character over here, it's just a very blurry spot. Medium Resolution, little better, High Resolution, and Very High is perhaps too crisp. I think I prefer something in the area of Medium or High. However, instead of selecting one of these options that would apply globally, I'm going to leave this set at Use Quality Settings, and then we can control the way that the shadows appear based upon the quality, and that's editable under Edit, Project Settings, Quality.
So the way that this works is that we have different levels of quality, so you can click on the different levels, and you'll see immediately that things are changing. So the columns here represent the deployments that we can make, so we can deploy a standalone application on any of these platforms in this column, and so the Ultra setting is used for that standalone deployment, and then, this is the WebGL deployment, and it is currently specified as High quality.
So High quality has Medium Resolution shadows, whereas Ultra quality has High Resolution shadows. So you can change that if you want to. We can say, "All right, well, let's go "with Medium Resolution shadows here, "and let's go with Low Resolution shadows here," or you're free to choose however you like. I'll go with Medium and High.
Now, as I'm clicking these different options, I notice that the edges of objects appear jagged in the High quality setting, and that's happening because anti-aliasing here is disabled. I'll enable that, make it 2x Multi Sampling, and in the Ultra level, I'll boost up anti-aliasing higher, to 4x, so that it appears smoother. So in this way, you can dial in your anti-aliasing and shadow settings however you like based upon the deployments that you wish to make.
Instructor Scott Onstott starts with a SketchUp model that he cleans up and imports into Unity, where he creates the first-person and third-person characters and cameras needed to explore the model. Then he shows how to improve the building's appearance by sculpting and texturing the surrounding landscape, and populating it with trees, moving grass, and flowing water. Next, he demonstrates how to animate and script doors so they automatically open as the character approaches. Then real-time lighting is baked into textures for greater efficiency and an overview map is added to keep the player oriented within the overall floorplan. Finally, Scott tests and deploys the final interactive visualization for desktop and the web. No plugins are required to view the results! Follow along to build your own version of the project and strengthen your Unity skills.
- Importing a model
- Creating a first-person and third-person characters
- Scripting the walk
- Swapping characters
- Adjusting lighting
- Sculpting terrain
- Painting textures
- Refining materials
- Animating doors that open and close
- Configuring an overview map
- Baking lighting into textures
- Deploying the game to different platforms