From the course: Unity for Architectural Visualization

Building an interior scene from prefabs - Unity Tutorial

From the course: Unity for Architectural Visualization

Start my 1-month free trial

Building an interior scene from prefabs

- [Instructor] In this section of the course, we're going to be working on our newly created main scene, which we created in the previous section and building up our architectural visualization. The first step in that process, when we've created our scene as we have right here is to begin adding our models, the models themselves representing the environment. To do that, I'm going to move to the meshes folder here inside the project panel, and then select our lobby mesh. When I choose the lobby mesh, you can see that actually includes the entirety of the building, and we're going to to be focusing our attention specifically on the lobby section of that mesh. So I'm going to drag and drop that into the scene to add an instance of it into this scene. Now, when I select this, when I've added this to the scene and it's selected, you can see from the inspector and the transformed component for the X, Y, and the Z fields. That position is slightly strange, and for you, it will probably be at a different position still. I'm going to put this to the weld origin by simply changing the values of X, Y, and Z to zero zero, zero, and press F on the keyboard to center that into my view. And you can see the environment here. Now, you can see, in addition to the environment being added, that the lighting is enabled for this scene because we're getting some shadows on the building over here. And I don't want the lighting just yet. We will be dealing with the lighting in a later video, but it's not something I'm going to focus on here. So I'm going to deactivate the scene lighting. To do that, I'm going to move to the lighting toggle here and click that to deactivate scene lighting so that we have illumination throughout, and we can see that model clearly. The next thing you'll notice about this model is that when it's selected, the pivot point of the object is actually located all the way over here. Now, for you when you select this, it actually might appear in a slightly different place. And if it does, that's probably because here, you have these pivot points change from pivot to center. So here, we don't want it to say center, we don't want this to appear at the object center, the average center, we do want to be able to see the pivot point that's saved inside the mesh file. What I want to do though, is I want to change this mesh so that we can put its pivot over to this point, ensuring that our mesh is centered at the weld origin and that it isn't offset like this. So to do that, I'm going to expand the lobby mesh. And you can see that underneath it, we've got a ton of additional meshes here. We can see all the doors, you can see the ducks, you can say lots of other stuff here. I'm going to grab all of these meshes by selecting the top one, holding down the shift key on the keyboard and selecting the bottom one here, so all of these meshes are selected. And then I'm simply going to reposition them here so that they're positioned up to about the center of the weld, maybe somewhere around here, and just raise that up just a little bit. So that now when I select the parent, we've got this at kind of like the center of the scene. And I think that's looking about right. It's slightly beneath the weld here. So I could grab these just again and just lower them just a little bit to around about there. So then now when I select the lobby, you can see that pretty much matches up here with the center of the mesh. That's great. Now, the next thing you'll notice is that behind the mesh, we have our massive user interface visibility here. And I don't want to accidentally select it or change it while I'm working. So I'm going to deactivate it's selectability and its visibility here in the viewport. To do that, I'm going to disclose up the lobby mesh and find the canvas object that's part of the UI here. You'll notice that to the left of the canvas, we have the touch icon for being able to select it and the visibility icon for being able to view it. I'm going to deactivate both of those. And additionally, I'm going to do the same for the event system. That leaves them still in the scene, so they are actually still there, and we do want that. In fact, if I go to the game tab here and you look, you can still see that we have our watermarking feature here on the top right hand side. So I do still want those things, and they are there, but I just can't select them accidentally. That's great. I'm going to go back to the lobby here so that I can start to work on this environment. Now, I'm going to have a look around the lobby environment here and move around to the front section. Because we're going to be focusing our attention here inside the lobby. And I'm going to move into the lobby here. And we've seen this before. We have our lobby area with the staircase and so on. Now, there's some things about this lobby that I do want to change. For example, I'm first of all going to select the lobby. From the inspector here on the top right hand side, I want to make sure that I activate the static checkbox. The reason I want to activate that is to tell Unity that these objects will never move during the course of the visualization. So that's going to account for everything, the floors, the ceilings. By activating static for these objects, we can optimize our lighting and our quality further along the line. So I just want to activate that now so I don't forget to do it later. Okay. Now, in addition to activating the static checkbox, one of the things that I will be doing is I'm going to be grabbing these different door objects inside the scene and deleting them, and then replacing them with the door prefab that we created previously. In an earlier movie, we actually created a prefab from this door. You can find that here inside the prefabs folder. And here you can see the door. And I'm going to be it and replacing it with those. I'm going to do one here, and then I'm going to do the rest off screen, so you don't have to watch me replacing each and every door with the prefab. I'm going to select this door just by left-clicking the door here. And make sure that I grab the entirety of the door by selecting it from the hierarchy and then right-clicking that there to display the context menu and from the menu, choose delete to remove that from the scene. Now, when I try to delete this, as it stands right now, it tells me that you can't do that, and that's because the parent object, the lobby, is part of a prefab and has a connection to the original mesh. And we can't go inside and start changing things around. But we can easily fix that by grabbing the lobby parent, right-clicking, and choosing unpack prefab completely to make that a separate and independent mesh here inside the scene. This means that we can then select the door mesh as I'm doing here. Make sure that I get the right one. So here is the door mesh, right-click and choose to lead to remove that. I can then go to my door prefab, which is the door here inside the prefabs folder of the project panel, and drag and drop that into the scene to add the door mesh. Now, I can move in a little bit closer here if I press F to kind of frame that. And just move that up and maybe just bring that forward. To position this nice and neatly, I'm going to be using vertex snapping. To do that, all I need to do is hold down the V key on the keyboard. And with the V key held down, I can move my mouse around and select different vertices on the door mesh. And I just have to click and drag it to the corner that I want to align it to exactly. Click drag, and there we are, done. Now, I want to center the door slightly further into the wall to reassess it to maybe about there to just put that door into the wall here. Great. That's now aligned where this is. Now, the process of replacing the other doors with the prefabs here inside the environment is basically the same process. So I'm not going to do that on screen. The last thing that I do want to do with the imported mesh is when I take a look at the important mesh from here inside the hierarchy, you can see when I select the lobby that we actually have a range of different objects. We have all the doors scattered throughout the entirety of the environment. Along with all the ducks here, we have the lobby areas. You can see we've got some floor areas, we've got some rails, we've got some wall art, we've got structural framing. And if I double-click on that one, you can see the structural framing actually runs throughout the entirety of the building, it's not restricted to the lobby. We have fundamentally two different types of objects here that we're working with. Those that are part of our visualization, which is going to be inside the lobby, and those other objects that are part of the rest of the building. So I'm going to get some further organization into our lobby here by creating two empty game objects that's going to act as containers for these two types of objects. To do that, I'm going to right-click on lobby, choose create empty. And I'm simply going to name one lobby here. And I'm going to, again, right-click on the lobby, choose create empty, and then I'm going to call this one external. And then what thing to do is move throughout this entire hierarchy here to identify the items that are part of the lobby and those that are not. So in this case, for example, you can see that when I select windows, it does actually select all of the windows throughout the building, even these windows around the back here. But notice that it doesn't select the windows around the lobby area. So I'm going to drag and drop these windows to the external section. But if I select other types of windows, for example, windows 0.17, you can see that's up here, but that window is actually visible in the lobby. Down in the ground area, by the staircase, I can look up and look up at the skylight windows here. So this actually is part of the lobby. I'm going to drag and drop that into the lobby area to organize it. And I'm going to do a similar thing with the other windows that we find. Now, I just happened to know that all of these separate window areas here, they're all part of the lobby. So I'm going to select them all and drag and drop them into the lobby area. Now, I know that the wall art, if I double click that, that is a painting inside the lobby. So that too is part of the lobby. I'm going to drag and drop that into here. And at the end of this process, at the end of this organizing, we're going to have two fundamental groups, lobby and external. And I'm going to be dragging and dropping all these different items into the relevant areas to marble lobby and the external, so that in this lobby group, we have all the different meshes here that belong to the lobby. This isn't a strict system, and you don't have to do this, but I do like to add this extra organization into the project. In the next movie when we pick up where we've left off, I would have organized the lobby and the external sections, and have also replaced all these doors with our prefab doors, ready to move to the next step.

Contents