Description
Key Learnings
- Learn how to prepare a Revit model for VR export
- Learn how to bake materials and lighting in 3ds Max
- Learn how to set up a rendered model in the Unity game engine
- Learn how to set up social VR using photon VR
Speakers
- IMIffat MaiIffat Mai is the Firm wide Design Application Development Manager of Perkins and Will. During her twenty plus years of working in the AEC Technology field, Ms. Mai has shown leadership in making strategic technology decisions, developing innovative solutions and integrating cutting-edge technologies into AEC design workflow.Her recent focus has been in weaving Virtual Reality, Augmented Reality and Mixed Reality with Building Information Modeling into professional Architectural practice. Ms. Mai leads an innovation team in developing immersive AR and VR experience that enables design team to engage project stakeholders and expedite design review process on projects. As an authority on Innovative Technology and BIM custom development, Iffat has presented at various technical conferences on topics related to Computational Design, Custom Revit API and Python development.Ms. Mai holds a Bachelor of Science degree in Architecture from Massachusetts Institute of Technology.
- SCSimon ChavezVisualization designer at the Perkins+Will Seattle Office. I graduated with a degree in Virtual Technology and Design in 2015. Render engines and game engines are my passion and I enjoy making the virtual that much more real.
IFFAT MAI: All right, I think we're going to go ahead and get started. Is everybody awake? [CHUCKLES]
AUDIENCE: Yeah!
IFFAT MAI: All right. Thank you for waking up for us. Welcome to AU. For many of you, probably this is your first class for AU. And thank you for taking the time, waking up early, and joining the party in social VR. My name is Iffat Mai, and--
SIMON CHAVEZ: Simon Chavez.
IFFAT MAI: And we'll just do a quick introduction of ourselves. Let me see if this thing works. Hey, it works. OK, my name is Iffat Mai, like I said. I'm with Perkins and Will. I'm part of the Digital Practice group. And I'm based in New York City. I'm the firmwide development manager. So what I do is I do a lot of coding, develop Revit API tools, and as well as virtual reality, augmented reality tools. And just in general, I get to play with a lot of cool, high-tech gadgets. And Simon?
SIMON CHAVEZ: Yeah, I'm Simon. I'm the visualization designer in the Seattle office of also Perkins and Will. I have a few years of game development and game engineering behind me. And so I get to do a lot of the game engine and virtual reality stuff that they want me to do.
IFFAT MAI: All right. OK. So before we get started, I just want to, with a quick show of hands, to really know my audience and the level of skills you guys are. So how many of you are familiar with Revit? Ah, so that's the easy part. good. That's what I figured. All right, 3d Max? All right, quite a few of you. And Unity gaming engine? All right. Oh, that's pretty good. All right, VR, how many of you? All right, everybody's into VR.
SIMON CHAVEZ: That's why we're here.
IFFAT MAI: And programming, coding, sharp? All right, so we'll go easy on that.
[CHUCKLES]
Thank you. And so the class today is all about social VR. And so we're going to go into the what, why, who, why, and all that. But really, it's about how, because this is a hands-on on demo class, so we're going to really focus on the how.
And the learning objective is really telling the story on how to take our content, which is typically a BIM model and dress it up, make it look real pretty, and bring it into the gaming engine, and make it a social VR, which is a multiplayer VR. OK.
So what is social VR? Another name for social VR is multi-user or multiplayer VR or network VR and many other associated names. But you get the gist. It's really all about bringing multiple users into the virtual world. Facebook is famous on promoting social VR. And this is like what they were advocating for.
But for architects and for AEC, we're not so much interested in playing poker in the virtual world. But rather, bringing our design team into the virtual world together, simultaneously, in an immersive situation where we can review and collaborate and review our design. And especially when things are on different scales, larger or smaller, that we can do that.
Real quickly about the VR that we're doing currently in design. So most of our project team are actively using VR in the design phase, in all different phases, actually. So in from pre-concept, where they're designing their different individual canopies. They will review it as they're designing it and changing it, making the design changes, and experiencing it firsthand in VR.
Or they would do in the more of a finished phase, where they know the finished materials, and they know their layout, equipment. And they wanted to test it out in a more interactive VR environment, we also do that so that we can do a virtual mockup and test out to confirm our design layout.
This is a more typical scenario of how we do VR. I don't think you guys can see it. Typically, we have one person in the VR setup. And he'll have his colleagues designing and discussing by looking at a larger screen. So that's a more common thing. Or it will be one of the designers going through the design while the rest of the team are sitting around looking at the large screens and having a discussion. Oftentimes, they will take turns and wait for their turn. But it's only really one person at a time.
So how do we deal with the situation when you have distributed teams, where most of our teams are actually collaborating from across different offices. And they may be not only in different cities. They're sometimes in different parts of the world, and different countries as well. So for us, it was very important to establish a platform where we can still utilize VR in an immersive way, but bringing the project team all into the virtual world at the same time so they can immerse and experience and have a discussion and collaborate in the virtual world together.
So without further ado, let's dive right in. So what is a workflow? Well, in essence, it's really take your BIM model, dump it into the game engine, because it's much better than just going in through VR, and there you go. But because we're architects, it is very important for us-- the materials, the lighting. And things got to look good, right?
So if you just do straight from a model to the game engine, oftentimes you get this white model, which is probably OK at early concept design, where materials and lighting is not that important. But most of the time, we really need the render process. So we'll take it from Revit, which is the modeling software, into Max, which is our preferred rendering software, and then into the game engine. In this case, it's Unity. And then all the magic happens inside the Unity, where we will throw in the setup for the VRs and the networking information.
OK. So without further ado, let's go into Revit. most of you are familiar so I won't go into details. There's a lot of more information in the handouts. But the answer is take the Revit model and bring it out as an FEX file. Well, that's easy enough said. But how many of you have tried to do that and failed? [CHUCKLES]
All right, typically, you get a big error message, either things are too big or too complex. So the objective is really try to minimize the size of your FBX. Minimize the count of your polygon as much as possible so that by the time it gets into the gaming engine, it will run nice and efficiently.
So here's some quick tips for you. And most of you are a Revit expert already. So we recommend making a detached copy of your Revit model so that you don't mess up the main model.
Delete anything that you don't need, you don't see. If you don't need, you don't see it, you don't need it. Use Visibility Graphics if you don't want to delete it. So you guys are probably familiar with that. Just kind of like the layers. You turn it off.
And Section Box, right? So let's say you're doing a design VR experience just for the lobby area. You can put a Section Box there and eliminate everything else outside what you need to see. So you only need the lobby and whatever is inside the lobby. And then you export it out to FEX. If that still fails, we typically will recommend going back and break that remodel into subgroups so that the file becomes much smaller so you can bring it out as an FEX file.
All right, so now you have the FBX file outside of Revit. And you go into 3d Studio Max. And in Max, what you really want to do-- there are two ways of bringing FBX into the Max. One is linking. One is importing.
And I believe our preferred method is importing, even though linking has a lot of advantages, especially in the early phase of design. There's a lot of going back and forth. They are not quite finished. So it might be beneficial to do linking. Linking definitely gives you-- I'm going to use my laser-- the ability to use a preset while you're linking it in to combine the Revit entities by materials. So you can group them by materials, whereas import does not.
However, import is actually our preferred method, because it gives you a lot more flexibility in how to massage the model so that you can optimize it and use it better for the gaming engine. So If you import it into FEX, you can use the preset of-- oops, what did I do?
SIMON CHAVEZ: Hold it down.
IFFAT MAI: Hold it down? Ah, there we go. OK. And yeah, so your import, you select the Revit option. And the objective of bringing it into 3d Studio Max is really to optimize it, to clean it up, optimize it, make it as small as possible. So what we recommend is take all your meshes and change it into Editable Poly. And don't forget to do the Quick Weld inside the Editable Poly.
There's a Pro-Optimizer that's built-in in 3d Studio Max. So you aren't even going to have to download that. And it's under the visualizer. After you run those two, you can further examine your model. Oftentimes, you might have some object that has, let's say, a lot of high polygon count on just a single object. And you really need it, so you want to run a script. And the script is-- there we go-- Vertex Cleaner. All the scripts that we're recommending here are all free, because we know you don't want to go out and have to purchase anything. So you run the Vertex Cleaner. And that would really optimize the geometry.
So once that's all optimized, you want to group them. Select the object. Group them by proximity or materiality. And then run another script-- oops, here we go-- SmartScripts Attach/Detach for grouping. All right. And those are the two scripts that we recommended. And there's the link. You can download it. It's free.
OK, so the idea is really reducing poly count. We can't emphasize that enough. Make it small enough so that you can really run it smoothly inside the gaming engine. Case in point here, we have a closet with a wire shelf. And you probably can't read it, but all the way on the top here, the polygon count of just those wire shelves is over a million triangles. So that alone will blow your model up. So if you don't need to go into the closet, you don't care about seeing those wire shelves in the closet, delete it.
Scene converter, next thing is materials. So Autodesk uses Autodesk materials, which is great in Autodesk product. But in the gaming engine, they typically will use Standard materials. So that's an important part that you wanted to convert that. In the past, you had to do it manually or purchase an AMC product to do that.
Since 3d Studio Max 2017, there's a Scene Converter function which allows you to load up any script. And it actually comes with a script that converts directly from Autodesk material to Standard material. So you don't even have to buy it. That's great. And so you want to change the materials to Standard.
And the texture, if you have any texture that you're not baking, which we'll talk about baking in a little bit, you want to make sure the path is referenced in a way that once you get into Unity, you can find it. So that's important. So either put it in a texture folder. Or just move it right into Unity before you send it out as an FEX file. OK. So now we're going to get into lighting and materials. And I will transfer to Simon.
SIMON CHAVEZ: Thank you. And down goes the next, right?
IFFAT MAI: Yeah.
SIMON CHAVEZ: All right, so now that you've set it all up in Max, let's just get the lighting going. In some game engines, they support IES lights. Unity is not one of those game engines. So if you ever want nice-looking fall-offs or any kind of realistic lighting, it's always best to do that in 3ds Max.
It's a pretty simple process, actually. You throw a UVW map modifier onto the mesh. And make sure that there's no overlapping sections of that inside the UVW map. Then you hit zero, which is the hot key to bring up the rendered texture menu. And it just has a whole bunch of options. You can select what kind of texture you want to bake out, where you want it to save, what resolution you want. You just follow those prompts.
And at the end, you just hit Bake, and it will, as you see here, bake out that texture. These ones have the materials included, as well as the lighting. So once you bring that into the game engine, you won't even need lighting.
If you are doing that workflow, it's best once you're in the game engine to apply the textures, apply the materials. And then change the texture or the shade or type from the standard shader to an unlit texture shader. It's more efficient. It's better. You won't get multiple shadows.
All right, so now you've imported that. I don't know if you want to take over now. OK. Well, so now that you have imported the Max model, and if you're not doing any of the light baking inside of 3ds Max, you'll just do that here now with the materials. You'll set up the materials. You'll set up navigation mesh if you need to in order to allow the players to move around the space in VR.
Then we'll import the Virtual Reality Toolkit from the StoneFox. And the SteamVR or the Oculus SDK to really enable VR. And then we'll make the player. And then we will finally set it up in multiplayer.
So Import New Assets. And from there, you will select the FBX asset that you exported from 3ds Max. Here is what it looks like. I just imported it really quick. There's no materials applied. There's no lights. It looks like a pretty basic scene. Then from there, we'll do the lighting.
So you can leave the Sun or the Directional Light in real time, because that's always nice to be able to move around. When people are in the scene, they might want to see it at different times of day or different areas. And then any other lights you want to be adding, any ceiling lights, you'll make an Area light, because those allow you to set an actual physical size to them. Instead of just an infinitely small point light, they allow you to make a light panel. Just be sure that you adjust it for feet and inches inside Unity. And then you can change the color of those lights as you need.
And then any dropdown lights you will use point lights. And you will set those to bake as well. The Area lights are always set to bake. You don't have the option of running those real time. But that's a simple step. And we'll get to that later. Actually, we'll get to that soon. [CHUCKLES]
So you can, in Unity--
IFFAT MAI: Do you want a demo?
SIMON CHAVEZ: Yeah, actually, I will pull Unity up.
IFFAT MAI: All right. We're going to switch over to the demo. We're going to get it out of the PowerPoint. And I'll tap 2, our Unity. Is it up on the screen? Yep.
SIMON CHAVEZ: Yes, cool. Thank you. So in Unity, you simply go to the window. And then from there, drop down to Lightings and Settings. And I have those pulled up right over here. Initially, it's floating somewhere here in space. And you can just drag that to wherever you want.
So setting up the Skybox is pretty simple. You can select it right here. And then any HDR image you bring in, you can select here. So actually, I will go outside so you can see really quick. So there's the default sky, not exactly what we want to show. And here you can just select any HDRI that you might have on file. So yeah, we'll leave it there.
IFFAT MAI: And I think if you're doing like a city scene, and if you have an image of HDR of the surrounding buildings, you can also bring that in. And it'll just map the surroundings.
SIMON CHAVEZ: Yeah, it's quite popular to actually fly a drone up to the specific height of whatever floor you want to show, get a wraparound image. And then you can import that. And it looks quite good.
All right, so now that we've set that up, and I have put some lights in the scene-- they are all here. You can just see their transformed positions, because they don't have any physicality to them. But once those are all set up, you can just go over here into the Lightmap Settings. And it's a lot of technical stuff. You don't need to fiddle around with that too much. I often just set the default, it's set to, I think, Medium to start, maybe Low Res. I can't remember. I just set that to High Resolution. And then I hit Generate Lighting.
Auto Generate is generally selected by default. But it doesn't save the maps out in the same way. So it's always best to unselect Auto Generate and then Generate Lighting yourself whenever you make changes. And then you get still a white model, of course. But we have lights in the scene, as you can see. Oh, glass. This is me too. OK.
IFFAT MAI: [CHUCKLES]
SIMON CHAVEZ: All right, so setting up the glass material is pretty simple. There are a bunch of shaders on the Unity Asset Store that you can get-- some for free. Some cost money. I recommend browsing those, because they're all written in the open shader language. And it's generally not worth the effort to try to learn all that yourself, unless you're already familiar with it.
But we're not going to tell you to go pay money. So what you can do is you can select either one of the assets in the scene that has the glass material applied to it. Or down here in the Project tab, you can just put in the name of one of your glass shaders. And here's the one we'll use. Here in the Inspector tab, you just go to the Albedo color, and you just adjust the Alpha, the transparency of it. Now as you can see, it gets more and less transparent as we slide that.
And for basic glass, that's pretty much all you have to do, as well as bringing the smoothness up to 1, 100% smooth, which you can bring a map in if you want any scratches, but--
[TAP]
[THUD]
--my mic to fall.
IFFAT MAI: [CHUCKLES]
SIMON CHAVEZ: OK. OK, we can hear me now. OK. Yeah, if you want smooth glass, that's-- or simple to make glass, that's all you have to do. And that allows you to bake any lighting, and more accurately, quickly.
So yes. Sorry, I had to consult my notes there. And it's still showing the tab. OK. All right, so once you have set up your lights, put your glass in, it's time to-- what's that rumbling mean?
IFFAT MAI: Oh, don't worry about that. [CHUCKLES] It's just the HVAC. [LAUGHS]
SIMON CHAVEZ: Gotcha. [LAUGHS]
IFFAT MAI: No earthquake.
SIMON CHAVEZ: Anyway, you can select everything in your scene that you want to light bake in this example.
IFFAT MAI: You're still in the PowerPoint.
SIMON CHAVEZ: Thank you. Oh. Can we see me now?
IFFAT MAI: Yeah.
SIMON CHAVEZ: OK, great. So you select everything that you want to light bake in the scene. In this case, that is our whole building. Select all the meshes. And then up here, you can see this little static box. Wow, that didn't maximize it at all. You can just click that check. But specifically, we're checking this Lightmap Static. And that will tell the game engine that nothing that you've selected is going to move. And so it's safe to bake lighting onto that.
OK. Next, lighting is all set up. That will take some time, depending on how large your scene is and how many meshes are included. But once that's done, we can set up the Nav mesh. Now you don't always need to do. This will depend on what kind of player navigation you select. And we'll go over that a little bit later.
A lot of them just allow the player to teleport around without having to set up the navigation mesh. But it's often nice to include so you can avoid any situations where a client or a team member might accidentally teleport outside of a building, or teleport up on top of a table, or anywhere that you don't actually want them to be able to reach, which is also a pretty simple task. And it's almost exactly the same as the light baking, where you select everything in your scene that you want to be navigable. And you go to Window, Navigation. It'll bring up the Navigation tab.
And here you can adjust the Agent Radius, which is just how close the players can teleport to obstacles, such as walls and tables. Agent Height, if there's any spaces, that should be too short for them to reach under. I don't often think that's the case. And then you can also select individual assets like this table here. And instead of setting it to Walkable, you can simply change that to Not Walkable.
And then when you hit Bake, it will take a moment. No, it won't like that. And it will generate this blue mesh here that you can see. And that is where the players are allowed to walk or to teleport, rather. They can still walk physically past those boundaries just because that's what virtual reality lets you do. But they won't be able to teleport past. So they won't be able to reach this area right here.
If we want them to be able to reach those chairs, we can drop the Agent Radius. I'll just try that. And Rebake. And it's a really quick process. And there you can see, they can walk around objects a lot more realistically. And there's the instructions for that. So again, recap, you select all the building objects, set them to Navigation Static. Adjust the agent size, and go ahead and Bake. Is it?
IFFAT MAI: Yeah.
SIMON CHAVEZ: All right, so setting up the virtual reality portion of this, first depending on what headset you have, you'll either download the Steam VR or the Oculus SDK asset packages from the Unity Asset Store. Once you've downloaded those, you can install the Virtual Reality Toolkit, which is also on the Asset Store.
IFFAT MAI: Now why are we using the VRTK?
SIMON CHAVEZ: VRTK includes a lot of really useful scripts that in some people's opinion, should have been included with the SteamVR or the Oculus SDK. They include navigation scripts, interaction scripts so you can pick stuff up without having to do all the coding yourself.
IFFAT MAI: And how much is this going to cost me.
SIMON CHAVEZ: Totally free.
IFFAT MAI: Oh, that's good.
SIMON CHAVEZ: Yes.
IFFAT MAI: I like free.
SIMON CHAVEZ: So there's a bunch of ways to make a VR-ready player. The way that we prefer is just a shortcut. The Virtual Reality Toolkit includes a whole bunch of example scenes to show off all of its capabilities. There's at least five different ways of teleporting included with it, several different ways of interacting.
So what we like to do is look at an example scene.
IFFAT MAI: Why don't you just show us?
SIMON CHAVEZ: Try to open it, yeah. Can we see stuff? OK. Yeah, so what we like to do is just open up one of the included example scenes. In this case, we'll just grab the Basic Teleporter and save changes. Not much here. Let me zoom in. All right. So you don't need much, really. What we end up doing is we need the camera rig and VRTK from this. And you can just copy the scripts over.
But a quicker way is to create an empty game object. Reset its transformed positions. Rename it to something like Player. And then you drag the camera rig and the Virtual Reality Toolkit onto the player. And once that's done, we can delete the old one. You can just drag that into the Projects tab. And that'll create a prefab. So once you've created that prefab, you can open up your scene, your FBX that you imported.
One second while it loads. OK. You can open the scene you created. And-- [CHUCKLES] sorry for the navigation there-- you can simply drag that Player prefab into the scene. And it will include all those scripts. Oh, and of course, delete the existing main camera. Once Unity makes a new scene, it'll include a main camera. That will confuse the headset. So go ahead and just delete that.
IFFAT MAI: OK. All right. So next-- where's the clicker? All right. So next is Avatar setting. For those of you who have experienced VR, you probably don't need to worry about the Avatar setting, because you're not going to see anybody else in the scene. But when you're doing multiplayer VR, you're going to be there with other people. And they're going to see you, and you're going to see them. So the question is, what do you want to look like? And what do they want to look like?
We typically just set up one generic avatar. Of course, people like Facebook and Oculus actually have an entire avatar creator set up. But really, all you need is a definition, a 3D model to represent your head, your left hand, and your right hand.
So a lot of times, people will use the headset model. And that is available in SteamVR. In the handouts, we actually have the location that you can find the OBJ file, and as well as the model for the controllers if you're using the Vive. If you're using Oculus, you can find the Oculus model for the controllers.
For us, we just didn't really want it to have any kind of Avatar that looks like human. So you have that uncanny valley creepy look, right? So we just went with a simple box. And we threw in our logo, and I think that's good enough for the head.
What you want to remember is you can just use any model. But the most important part is that you want to make sure the Y is up and the minus Z is forward. And then you want to make sure you save it into a folder called Resources, with an S. All right.
, Networking, so Unity actually comes with a networking feature which is pretty extensive. However, we chose not to use that, because we really wanted a more flexible, cloud-based networking platform. And Photon VR is another plug-in that it's actually one of the most popular multiplayer gaming platforms that is available for-- actually, it's for free for up to 20 people, simultaneously, concurrent users. If you want more, there's a paid version as well.
And the reason why we chose that over the Unity is mainly because of these other factors. So the hosting situation with Unity, you typically assign one of the players to be the host. And oftentimes, that causes problem with the firewall. And you have disconnect issues. And if the user disconnects from the session, everybody else loses their session.
Connectivity is huge. So you want to have a consistent connectivity. As long as all your players has access to the cloud, then you all have the same connectivity. So it's a lot more reliable with the Photon network. And the performance is a lot better, because you don't have to deal with a firewall, and what have you. And there's no delays Whereas if you have the Unity networking, you have a player assigned as a host. Then you're going to have some sort of a delay.
And then the Master server that the Photon offers allows sets up a lobby. And then it will automatically assign-- it's kind of like a traffic cop assigning people into the different rooms that they need to go. And the best part of it is that it's free.
OK. So you can go to the Unity Asset Store, and you could download the Photon. And if in case you want to include the Chat feature so that you can also communicate online. you can download the chat. And what you want to do is just go straight to their website, create an account for yourself. And it's free.
And once you've done that, you'll then have the opportunity to create an app. You'll have to create one for the networking and one for the chat. And I've kind of-- oops- whited out here. But you will get an ID for yourself, for the networking, and for the chat.
So the way the Photon VR networking works is that you'll create your application. Then you'll have a connection script that will allow you to connect to the server that the Photon runs on the cloud. They will create-- they will spin off a dedicated server for you. And as you log in remote, and it will then assign you to different rooms.
So Photon really takes care of all the networking needs. Once you have it installed, set up your account. And you implement the script that we're going to be showing you. The photon network will take care of spawning the players, and also taking care of the communication between the different players, and transferring the state synchronization, and using the Remote Procedure calls. And don't worry if you don't understand what some of these things mean, because it will take care of it for you.
All right. So once you have the Photon package installed, you will see this under the window, the Photon Unity Networking. And in there, there's a PUN, which is Photon Unity Network Wizard. And in the wizard, there's a Locate Photon Server Settings, which will then pull up the screen. And then you just need to put your information in the app ID for your network and voice ID for the chat part.
So it's really simple to set this up. Unlike Unity, it really just has one or two things to do. And what I'll do is I'll talk through it, and I'll demo it, because it'll be a lot easier. So what you need to do is create Network Manager. And you create an empty placeholder, the game object. And then on it, you just throw two scripts on it, which we'll give you the attached files that you can download as well. One is the Net Manager. And the other is the Photon Voice Settings script.
Then the script of the Connect, basically, it just tells you, once you start the game, you go ahead and connect. And once you connect, you look for the rooms. If you can find the rooms, then you go into the lobby. And then if you can't find a room to join, that means it hasn't created. That means you're probably the first person to join. It will automatically create the room. And if you create the room and you are able to join, ta-da. You're successfully in.
Once you're in, this is the part that's most important in instantiating the game. So you're in. It will instantiate you. It'll create you as a object. So whatever you want to create, this is where your custom codes will go. And the command is really one line, which is PhotonNetwork.Instantiate. Put in the pre-fab that you defined, which we created earlier as an avatar. And specify the position and rotation that you want it to appear once it's in.
OK. So can you toggle over to Unity? And then just open up the Net Manager. All right. So can you go to the Unity real quick?
SIMON CHAVEZ: Oh, OK.
IFFAT MAI: All right.
SIMON CHAVEZ: Or do you want me to go to the prefab?
IFFAT MAI: Yeah, go to the player.
SIMON CHAVEZ: OK.
IFFAT MAI: Ah, OK. Down, the last one, I think.
SIMON CHAVEZ: Oh, you're right, wrong player.
IFFAT MAI: There we go. All right, so we have already created a Network Manager. If you click on the Network Manager. And in the Network Manager-- actually, you know what, let's go ahead and create another one.
SIMON CHAVEZ: OK.
IFFAT MAI: Yeah. So we'll just walk you through the steps. It's really easy. So even though we already have one, we just want to show you how to do it. So he created an empty game object. And he's going to rename it to Network Manager 2.
SIMON CHAVEZ: Yes.
IFFAT MAI: All right. And as you can, over here it's empty. So you're going to hit Add Component. And we're going to type in Net Manager. So we pull out the script. And then we're going to add another voice component, @componentvoice. All right. And to look at the script, in this case, we have already assigned it to Visual Studio to be our editor.
So if you go to the Network Manager, Yep. That's the Network Manager file. The important part is we declared three game object here. Anything You declare as public, it will appear in the Inspector screen. So then it's dynamic. And the user can interact with it, right? If you don't make it public, then you'll have to go into the codes and define it explicitly.
All right, so we created that code to have the head and the left hand and right hand and allow the user to dynamically assign whatever prefab you choose to use. All right. And then the rest of these code, we're not going to go into it. But basically what I described on how to join the rooms and what have you.
The last part is joining the room. And like I said, PhotonNetwork.Instantiate. And in this case, we just want to instantiate those three objects, which is the head, the left hand, and the right hand. And we gave it a Vive manager to organize the position and the orientation that the model would come in. All right, go on to the next page. Yeah. So that's we talked about. And next slide. OK.
And earlier, we created the avatar. So you would then go into the Resource folder and grab your avatar and physically drag it into the slot where it says, the Head and the Left Hand and the Right Hand and you're done. You just basically associated it. OK? Again that's the code. So that wasn't too bad, right?
So now you have a network situation. You have your VR set up. Of course, Mark Zuckerberg has showed his selfie. So we want to add that too . So that was really, really easy to do. There is a Render Texture inside Unity. So you want to pull that up?
SIMON CHAVEZ: Yes.
IFFAT MAI: And basically what the Render Texture does is it streams anything that you assigned into from a camera. So you create a camera. You associate that with the Render Texture as a target. And then you assign that texture onto any surfaces. And it will stream anything that the camera sees onto that surface. So we could use that to create a simple display screen. So in this case, he has a selfie stick and a little display screen representing, I guess, the selfie camera. Right?
SIMON CHAVEZ: Yeah. Making the camera now.
IFFAT MAI: All right, so he just created another camera. And in the camera, you go into the property of the camera. There's a target on the texture. So we're going to drag in that Render Texture that we did. So now the camera target is associated with that. It will stream the output of the camera into any texture that has the Render Texture that we used. OK.
SIMON CHAVEZ: Dragging it out a little bit so we can see it better. OK, so now, yeah, the Render Texture is applied to this plane. And if I move the camera around, then it simply updates the texture.
IFFAT MAI: Very easy. And basically, what we did was we did exactly that but in code. And we added a few things. We associated all that function with a trigger on your controller so that if you press your trigger, it will pull up the selfie stick and take a picture for you. We also added the function to take that image and save it out to a PNG file. So you can save it out as many selfies that you want. And you want to go back to the PowerPoint?
SIMON CHAVEZ: Yes.
IFFAT MAI: OK. So there's the code. Obviously, you can't see it, but it is in the handout. You have a better view of it. And there's a forum that actually talks about it extensively if you want more details explaining all the different features. And that's our selfies. And once you have multiple users in there, you can take a group selfie as well.
OK. So that just quickly summarizes all the things that we've talked. We talked talk about a lot of things. We started with Revit. We took out content. We exported out an FBX into 3d Studio Max. We dressed it up to make it look pretty. Did a lot of light and material baking, brought it into Unity for further refinement in terms of light and material, because we're architects. we want things to look good.
Then we brought it into Unity and set it up for you. The VR, using VRTK, and we added Network using Photon VR. And mind you, both VRTK and Photon VR are free. So you don't have to pay for it. And last but not least, we throw in a bonus of a Selfie function. And so that's about it. Thank you.
[APPLAUSE]
We have some time. Thank you very much. And if you have any questions, go ahead.
AUDIENCE: Are you going to upload the [INAUDIBLE] to the app?
IFFAT MAI: Say that again.
AUDIENCE: Are you going to upload the [INAUDIBLE] to the app [INAUDIBLE]?
IFFAT MAI: Oh, they might not be on the app. It should be. We uploaded to the system. So I'll double-check with them why it's not showing in the app. But we do have the handout. And if in case you want it, you can leave your email address, and we'll be happy to email it to you in case it's not on the system. Yes.
AUDIENCE: That's quite a workflow. When all the-- behind the scenes the steps are taken care of. What are we looking at here as far as the time? I have a better model that I wanted to show up here for eight people meeting on Monday.
IFFAT MAI: On Monday.
SIMON CHAVEZ: So the question is, what kind of time are we talking about with this whole workflow? And of course, it's quite intimidating to look at. And the first time you put it together, it can take some time. I mean, fortunately, it won't take as long for you to put it together, since we've got all the scripts compiled and did a bunch of that work. But it'll still take some time. But the thing is, after you set it up that first time, it's a nearly instant process, other than, of course, spending time exporting it and making it look pretty.
At this point, with the player and the network set up, it generally takes me half an hour if I'm doing a Revit to Unity workflow that doesn't involve any texture baking. And then it'll take about 20 minutes once I'm in Unity to bake the textures there. Of course, you can make that process a lot longer, especially if you are doing the texture baking in Max. That's really just a preference of how good you want it to look and how much time you want to spend on that.
But yeah, the actual getting it set up, once you've done it the first time, you have a pre-fab that you can just always drag in. And you never have to worry about that again.
IFFAT MAI: Yeah. And typically, what we do is everything we've done here, we made it into a template. So all the project team can just grab a template and then just bring in their model. So it saves them half the time. Yes.
AUDIENCE: Why did you choose Unity over another engine? It's like [INAUDIBLE].
SIMON CHAVEZ: Mm-hmm. Really, there is no specific reason to use one engine over another. You can honestly pick whatever you feel the most comfortable with or whatever you like the most. We happen to use Unity here because I was already familiar with Photon for Unity. And we wanted to set this up quickly.
And more realistically, we wanted to set it up simply. So you didn't have to do a whole bunch of upkeep. You didn't have to mess around with blueprints to make it work on a per project basis. But if you like Unreal, Stingray, Lumberyard, CryEngine, you can pick whichever one you like. Photon I know works for Unity and Unreal. Every game engine, of course, has their built-in multiplayer method. And if you want to find a Photon-like one for a different engine, you just have to do a quick Google search.
IFFAT MAI: Yeah. And also, I think Unity is one of the most popular game engines out there. So if you're looking for something to customize, odds are you'll have a better chance of finding tutorials or tips on the forums on Unity.
SIMON CHAVEZ: Plenty of supports.
IFFAT MAI: Right. So is that it? Any other questions? No? All right. Well, thank you very much.
AUDIENCE: Good job.
[APPLAUSE]
Downloads
Tags
Product | |
Industries | |
Topics |