Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
Interested in game making? Start in Unity—a game engine for mobile and desktop games and real-time simulations. Author Adam Crespi shows techniques used in game development with Unity and introduces the basics of scripting and game functionality. First, learn how to import models and textures, organize your project and hierarchies, and add terrain, water, and foliage. Next, Adam explores how to use lighting to bring the game to life, and add rendering, particles, and interactivity. The end result is a sample game with a lush environment, fully animated characters, and some basic interactive gameplay.
Materials and shaders can go a long way in helping the lighting look correct in a scene. Beyond simply colored in the right way and shining, maybe with a reflection, we have a class of materials called self-illuminating, and what these do is look like they're giving off light. This is really important when we're trying to light a space that the light fixtures look like they're on. And they add a tremendous amount of believability if the lights that appear to be on are pretty close to illuminating the room. Or, at least so we think. I've made a can light, and it's a surface mount can.
What those are, are cans that are stuck to the ceiling versus recessed into it. We're going to put these all over the gallery and we need to get the materials dialed in so that they look like they're giving off light. Whether every one of them actually has a light or not is really up to us in how we light the space, but they need to look at least softly lit. I'll go into the Meshes folder in the Assets and there's Can Light Surface Mount. It comes in with a scale factor that needs tweaking as it's very, very small at the moment. I'll put this scale up to one and generate light map UVs.
Then I'll scroll down and change the material naming from the Base Texture Name to From Model's Material. This has two materials assigned, a bronze, and underneath, a gradient where it's supposed to look lit. By changing this over, I'll make sure I get both materials in. And I'll hit Apply, and let those changes take effect. Now in the materials folder, in the meshes where Unity creates automatically materials upon import, I've got a leftover from something or other, WhitewallCS and then Lit_Bulb and Bronze.
Actually this leftover was here from the initial import and then once I changed over how Unity was perceiving those materials, it was still there, it just created two new materials for me. I can delete the WhitewallCS by pressing Delete. And now I'm ready to adjust these lit materials. What I've also done, and I'll look in the texture folder to show this, is to update the white wall material. Here in the building textures is my WhitewallCS and I'll enlarge the preview and take a look at the alpha channel. Instead of merely black in the alpha, now it has a specular channel and what this does is gives the wall a little bit of a sheen.
The vent has a little bit more of a sheen, and the baseboard is a little shinier. Up in the top left we can see a gray and white gradient and that's actually what will determine how this light looks lit in that bulb section. The square to the right of it then is a brushed, shined surface that will give the bronze in there, whenever I use it, a little bit of a striping in the specular highlight. I'll jump back over to the Meshes directory. Pick that can light surface mount, and drag it into the scene. I'll pull it actually right into the scene view and this way I don't have to hunt for it.
Because we're going to place this object as a prefab, and then let it batch, or define once and just reference the definition, we can actually place it in verses actually taking the place it was in Maya, which is actually flung out into the lake somewhere. Now with this light in, I'll pull it up and snap it on to the ceiling. I'll zoom out in my scene view, switch over to a wire, and hide a few things to make it easier to see. I'll pick the oak, the plane and the terrain and the cattails and uncheck their visibility again.
Now I'll pick my can light surface mount. Press F to focus in on it. V to snap, and snap it up to the top of a wall. Then I'll pull it over on the ceiling. I'm not sure where it's going to land yet, but at least want it up on the ceiling in the right place. I'll switch back to a textured view. And there's the start of my can light. Here's how the materials will work. With that can selected, I can see I've got two materials, lit bulb and bronze. I'll take the lit bulb material, which is just applied to the faces inside that can, and change its shader, choosing Self Illumine and Diffuse.
I don't really need this to shine and it's going to look totally lit, so it wouldn't really show a specular highlight or reflection. So a diffuse is the simplest possible shader to use here. By changing to a diffuse, I get an additional slot here in the material. It accepts another alpha channel. And this is where I can define where it looks like it's emitting light. I'll go in and pick by clicking on the select button that same white wall. Scrolling down and picking WhitewallCS. Now the whole material looks lit and we can tell here in the sample sphere that the wall is actually softly glowing.
That's okay, because I've assigned by polygon just these lit faces. If you have a more complex object, you may want to make sure that your alpha channel is really set for self illumination. That is, if it shouldn't look lit, it should be black. My light is pretty good. But I need to eliminate that bronze material. I've already defined a bronze that I'd like to use. And so rather than have yet another bronze, I'm going to borrow one of my existing ones. I'll open up my Materials folder. And there's a brushed bronze. This brushed bronze actually uses that same texture.
So, what I'll do is to select that can light, and drag this brushed bronze right onto it. It lands in the place where that bronze was. I'm making sure to hit those polygons that I already had assigned the bronze to. Now I've got my same brushed bronze material on the exterior of the can light. But I still have the Self Illumine shader on the actual lit bulb. And when I deselect it, it looks at least like that can light is lit. I'll press play and take a quick look at it, but before I do that, I'll make sure I turn on the shadows in my directional light.
Dropping down under Shadow Type and choosing, oh, Soft Shadows for now. This way I'll get some shadow through the window and won't get inadvertent light around the top of the can, or in other places where light might leak. When I play my scene, I can see the can light in the distance. I'll zoom down to it and take a look up. Now, obviously, this scene is not lit inside yet, but it definitely looks like that light is on, at least from the lightbulb. And so, when I get a light in on the floor here, it'll really reinforce that yes, this part of the gallery is lit by that can light.
And I believe it because of the self lum material.
There are currently no FAQs about Unity 4.3 Essential Training.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.