Unity for Interactive Architectural Visualization

portrait, David Tracy

David Tracy

Level 1

3h 3m

In this course, David Tracy will show you how to use Unity as an interactive architectural visualization tool.

First you will learn interfacing with Unity and how to import and export your project within Rhino and SketchUp. Then, you will learn how to use shaders, materials, textures, and lighting for your project. Finally, you will learn how to create scripts to enable you to interact with your scene.

When you are done with this course, you'll know how to navigate Unity to start building your own interactive walkthroughs and visualizations.

Hello Unity!

Course Videos
Duration
Viewed

Hi, I'm David Tracy, and today we're gonna learn about creating interactive architectural visualizations with Unity. Unity is a game-creation and publishing platform, but it's also well-positioned to serve as a platform for creating interactive prototypes for design. This software's important to know, because it enables you to communicate your designs via interactive real-time walkthroughs.

8m 29s
Log in

And just for the purpose of this course, I'm gonna throw this on the desktop, so what this is gonna do, is this is gonna create a project called Farnsworth on the desktop. So Unity is a directory-based system. So instead of saving out a Unity file, you're gonna be saving out a directory full of assets, scenes, materials, textures, 3D models.

4m 36s
Log in

So, congratulations, we just made the most boring video game of all time, but we can see that our scene is active and we can see our sphere and our stretched-out cube in the game window.

So, we're gonna save our file, and we're gonna jump back into Unity, and the last piece we need here, is we need to attach our script, as a component to an object in our scene for it to run. So, I'm just going to click and drag this onto the sphere in my scene. So now if I select my sphere, I will see that the sample script has been attached.

So I have a pre built mesh of the Farnsworth house that I'm just going to copy and paste into my unity assets directory. All of the assets that we will be adding to our directory, are also gonna be included with the course files. So everything I'm doing here, you'll be able to access on black spectacles.

We're gonna need to adjust the scale of our model as it comes into the scene. One of the things we can do is we can make sure that our asset is always using a certain scale factor. So even when the link is updated if we replace some elements of our model, it's always gonna maintain that scale factor.

4m 26s
Log in

And now, if I want to transform this thing, it's going to have its transformation gizmo at the center point of the extents of this game object. So we can actually change the way that this behaves by toggling these two buttons at the top of our screen. So there's two ways to position this transformation gizmo.

3m 33s
Log in

So think of the directional light as a light source that's infinitely far away from your scene, so the rotation of which is going to be the transformation that's going to affect the lighting in your scene. As we adjust the rotation of this object, and we can do that in our game window, or in the Inspector here, that's going to affect the lighting of this guy. And if we're using a skybox for the ambient light source of our scene, as we change the rotation of this light, you'll notice that the color of the skybox will adjust as well.

Interfacing With Unity

Course Videos
Duration
Viewed

So, we're going to open up Rhino and I'm going to open this Rhino file for the Farnsworth house, which will be available in the project assets on Black Spectacles. We're going to open our Farnsworth house Rhino file. Okay, so let's close out of this.

2m 4s
Log in

So this can cause some weird rendering issues so if I select set these objects to rendered and let's apply a material to one of these guys and just apply texture here. Desktop, textures. Let's just apply this carpet normal texture.

8m 26s
Log in

Okay, so for instance if we wanted to, let's select all of our wood paneling here, I'm gonna select objects, k, and I'm going to go to the property material, and I'm just gonna, just for time's sake I'm gonna assign a material by object, I'm gonna go to its color texture, and I'm gonna set this as this primavera texture, k. And then I'm going to set the object display mode to rendered and I can see that this primavera texture is being tiled across all of these surfaces at an individual level. So we can see the shorter panels are using their own tiling and these taller patterns are using their own tiling as well.

6m 11s
Log in

So, we're gonna select this layers as OBJ groups option and then the last thing we wanna do, is we wanna map our Rhino Z to OBJ Y. So, remember when we were in Unity I mentioned that the coordinates system is a little bit different, with the Y coordinate system being world up. In Rhino world up is the Z direction, so what we're gonna do is we're gonna select this option to map Rhino Z direction to the OBJ Y direction.

All right, so I'm gonna have concerns about the back faces in my SketchUp file. A good way to make sure that we're showing the front and back faces is to switch to a monochrome face view style. So I'm gonna go into view, face style, monochrome.

One thing that's important to note about exporting to SketchUp, it's typically best practice to down save the version of SketchUp that you're using because the latest version of SketchUp isn't always supported by the latest version of Unity. So I typically export to SketchUp 2013, okay? So I'm gonna save ths file in my Unity project, in the assets folder inside mesh.

So we're gonna leave Cross-Platform Input, Editor, Physics Material, and Utility, checked, and when we're ready to import, we select Import, and what that's gonna do, is that's going to bring all of these assets into our project, okay, and so now, we have a folder in our Assets project called Standard Assets, we're gonna go to Characters, First-Person Character, Prefabs, and we're gonna select this Prefab, which is FPS Controller, which stands for First-Person Shooter Controller, and we're just gonna drag that into our scene. If we take a look at what this object is, it is a game object called FPSController. It has a CharacterController component.

Lighting In Unity

Course Videos
Duration
Viewed

So, we can create lights by going to our Game Object menu, going to Lights and selecting our different types of lights. So we already have a directional light in our scene, and this is our sun. So right now, it's just called directional light, but we could rename it to be Sun.

2m 30s
Log in

If you have materials that use specular highlights, those highlights are gonna be picked up in the material, but we can use this type of light as just a filler, so we can affect the general intensity of the light, and by using a shadow type of no shadows, this light is going to pass through a lot of our geometry. Just like our other sources, we can adjust the intensity and the shadow type. So, we could also have this light cast shadows.

Unity has a global illumination engine called Enlighten that is pretty similar to how other rendering engines do calculations on light sources to calculate the effects of indirect light. That's light bouncing off of surfaces and affecting other surfaces in your scene. In order to use Enlighten, we have to make sure that our model is set up in a certain way.

3m 53s
Log in

Of course, as we get more and more complicated with our scenes, we're gonna be adding more spotlights, pointlights, and kind of tweaking the global illumination of our scene. So let's take another look at that so we can adjust the indirect intensity. Again we can bump that all the way up if we'd like.

The Standard Shader

Course Videos
Duration
Viewed
9m 56s
Log in

So if I add this albedo color to my shader, my carpet material, you'll notice that the texturing of the carpet kinda disappears. So there are a couple of ways I can handle texturing on the material. So in other platforms you might be used to the bumpmap or height map.

1m 21s
Log in

So, emission color is a really great way to turn objects into light sources themselves. And they're also included in the global elimination calculations pretty cheaply, which is really nice. We're going to revisit the emissive texture in a little bit, but you can see that just by activating the emissive texture the indirect illumination of my scene was instantly effected.

2m 33s
Log in

I'm gonna create a new one, Create New Material, and I'm gonna name this one glass, all right? So one thing that is missing from my standard shader workflow is an area for alpha. You may notice if you click on the color picker for the albedo channel, there is a channel for alpha, so if I go ahead and adjust that, in the preview we don't see anything happening here, and in fact if I go and apply that material to my glass, and all my glass objects have this glass material applied to it, it's still not going to show regardless of what my alpha value is at, okay?

6m 58s
Log in

So this texture is not marked as a normal map, so I'm gonna fix that so that it will be marked as a normal map and then I'm just going to apply it to this object. And we can see, if we zoom in on this thing, there is some leather texturing here. It's pretty small, so what I'm gonna do is I'm gonna go ahead and adjust the tiling for my texture here, to be something like point 25, point 25.

And so what this is gonna do is this is going to, this reflection probe is going to set up reflections in realtime in a certain area of my model. Okay, so I can, so I can move this around, and I can also do this as realtime. So what this does is this essentially puts a spherical camera in my scene at a certain point and you can see that this has a certain range to it.

8m 59s
Log in

We're gonna implement an asset from Unity called the post-processing stack. So this is a really powerful set of tools that Unity has developed and is still developing that is really great for cinematic post-processing effects in real time. I search for the post-processing stack.

So if we bump up the normal map, we're gonna get just a little bit of richness to that texture. And we can always go and, remember, adjust our textures here, so we can get that a little more, let's do this, 0.75, let's do this. Something like that, that's pretty close.

Basic Interactivity With C#

Course Videos
Duration
Viewed

This function is called when the attached script is started after we press Play. So in order for this to run, this script has to be attached to a game object in our scene and when it does, when we press Play, or when we start our application, this message will be printed. So the Start function is called Once.

And then, if we wanted to use this variable so we're just going to print this out right now, we can say, the number is and then plus my int. Okay? So what this is going to do this is going to log out first the message, which is the number is and then it's going to append the value of my int.

9m 14s
Log in

What we can do with this teleport one object that we've just created is we can reference another game object in our scene to make our character controller move around, so what I'm gonna do is, I'm going to create an empty game object. So, I'm gonna move this to the far end of my scene, over here. So, that's all the way over on the far end of my scene, and I'm gonna rename this to be, Teleport 01, and I'm gonna duplicate this, and I'm gonna move this one back over to the, kinda close to the origin of my scene, 'kay?

7m 23s
Log in

If we press X, it's gonna apply the secondary material, and if we press C, it's going to apply the original material that was applied. So let's just take a look at how this could work. So I'm gonna apply this script to the wall panels first.

I'm gonna select the Barcelona daybed, okay, and I'm going to set its design option to one, okay. So if I press play, I move into my space and press the J key. It's going to disable, it looks like it's disabling the script that was attached.

So we can flip this, I'm gonna make design option one invisible at first and design option two invisible. Okay so now when I look at my scene design option two is no longer shown. I can press the J key and then it will show up.

5m 2s
Log in

And in quotes I'm gonna write mouse scroll wheel. Does not equal zero, so this is saying, if the scroll wheel is moving let's write a little comment. If the scroll wheel is moving, let's do something with the light levels.

Then, what we're going to do, is we're gonna tell the emissive texture to play. And then the last thing we're gonna do is we're going to change the emissive texture's wrap mode back to repeat. This is a little funny, but this is an old bug that affected the repeat wrap mode of textures.

So what we're gonna do is we're going to go to file build settings are we're gonna select the platform that we're gonna build for. So we're gonna say the target platform is PC, Mac, and Linux stand alone. We're gonna target Windows, 32 bit architecture then the next thing we do is we select build.

Now you know how to bring your own work into Unity to visualize spaces. Don't forget, you can always come back to this course if you need a refresher. Thanks for watching and remember to check out the other courses that we're always adding on blackspectacles.com.

icon: hand holding tablet

Get licensed faster. Become a member now.

Choose your subscription