From the course: Matterport 3D Scanning and Visualization (2018)

Matterport in Unity - Matterport Tutorial

From the course: Matterport 3D Scanning and Visualization (2018)

Start my 1-month free trial

Matterport in Unity

- When you first open up Unity, you'll have some different interface options here. What I want to get us into is right into the VR aspect of it. So what I can do is go up here to assets, then I can say import package. So I have a package that I've actually downloaded, which is the Oculus package, so we're just gonna jump over there to my downloads, and Oculus Utilities, and this Unity Oculus package will allow us to enable our Oculus Rift and have some of those features and scripts already built in for us. So all those show up here on the top left. There's a whole bunch of them, and these have been programmed by people all over the world, I'm sure. So we'll just say import. And I'll just say yes to that plugin option. And we'll go ahead and restart Unity. So now down here we have this Oculus package with the VR option. And there's all these options. So what we want to make sure and do is turn on the VR option so that our Oculus headset actually works. To enable the native VR support in Unity, we need to go up here to Edit, and then down to Project Settings, and then up to Player. Now over here, Unity defaults with services on, so you just tab over to Inspector and you'll get these options. And so, you can just go down here to XR settings which is the new version of the way we talk about VR, virtual reality, AR, augmented reality, and MR, mixed reality. They just call it XR now, and that's been updated in the code in Unity, so you can just say Virtual Reality Supported, and once that's checked, you should be good to go. You can just do a quick check on that by hitting the play button here. And I have my headset attached so I can see that yes, it is working. So this play button up here is just, it brings you in and out of VR mode. Now note when you are in the play button and you make any changes or edits to Unity, those do not save. The only time you can make changes in Unity and have them save is if that is off. That's a very important point, so you could be doing a lot of work in the wrong sort of mode, and end up switching that off and you have absolutely nothing to show for it, so, word to the wise. Now, moving on. The next thing we can do is we can drag and drop our objects in, so we're gonna go to our assets. We have a couple ways we can do that. We can import them, and we can also drag and drop them, so we'll try the drag and drop and see how that goes. So I'm gonna navigate here to some files that I have from Matterport, some assets. So I have some here that I downloaded, and I'm just going to bring in this OBJ file, this object file. So I'll slide this over here, this is from one of the scans we did. I can just drag and drop it right here, and what it's going to do is it's going to say "hold on," and then it's going to load that asset. Go ahead and minimize this. So that asset's in here now, and we can see it as a model, so I'm gonna go ahead and zoom out. And we can see this thumbnail here. And then down below you can see that there's all these different parts of the model. It's the mesh that's been broken up into pieces, and each of those has assigned to it a specific texture, so when we import the textures as well, we can assign those textures to these as different materials. So all I have to do to bring this model into my scene is I can just drag it from here and drop it right there, and then I can change the rotation of the X. It likes to come in flipped from the Matterport models into both Unity and Blender, and so now we can view that model here. Now the only thing left to do is to photo texture it, but you can see the mesh model's not too bad, especially if you can appreciate that this was created from photogrammetry. In other words, from a very low-grade infrared sensor and from actual just stereoscopic cameras, and to create a model with this kind of detail and clarity, I think is pretty remarkable in the technology world. So the next step we can do is we can assign textures so we can look at these and we can start replacing those, so what I've done is I've prepared another model, so we don't have to go through the material, sort of labeling one by one and assigning those, and just show you sort of the finished result. And here is the photo textured model. So, not too bad, epecially from at this vantage point. So we can see that the bedspread came out really well, and there's good lighting in here, which simulated the actual environment, plus we have Unity lighting going on, so that's nice. So we do have some photorealism for sure, and what I'm going to do is I'm just gonna flip this into VR and show you what that looks like. And you can see the textures have been applied. We're actually feeling like we're in the space. It's pretty realistic, and that's just right out of Matterport. Now, if you were a modeler, and like to get into this pretty extensively and make sort of a gaming environment, you could actually just trace over this model, you know, clean it up, reapply some photo textures and so forth, so you would have a lot of versatility, and having this model like pre-made for you through this scanner that only takes minutes to get through a space in some cases.

Contents