Unity Augmented Reality Tutorial Lesson 01 - AR Simulation

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
foreign hello and welcome to this first tutorial in augmented reality using Unity so augment relative it's basically overlaying interactive media particularly Graphics over live video and then using a bunch of accelerometers and motion tracking video tracking we can create quite interactive environments okay so um there's lots of different ways of doing AR we can use HTML and JavaScript in the shape of A-frame Adobe do some software for this Unity which obviously what I'm doing right now and there's lots of other ways and we can output that to web-based systems or directly to sort of mobile apps uh turn on mobile phones tablets Etc okay what I'm going to be looking at today is is sort of making augment reality solar system using Unity well A reduced soil system for today so the simple steps the simple me is we're going to create a new project we're going to set up the right packages for this create they are in a simulation first because that means we don't have to worry about exporting and debugging on natural platform we can then add some appropriate assets add interactivity then adapt to mobile device simple as that this has not been doing one lesson though um so basically um lesson one we're going to look at setting up the project and just create a test scene in lesson two we'll look at the actual image tracking like you saw in the opening video and where we can look at a picture and we can then the camera will see that Unity identifies what it is and puts the appropriate model around it then we'll have some interactivity where we can click on an object in scene that'll then display some other information and then finally maybe some extra bits where we can maybe also include video footage and maybe animated models Etc and some sound effects okay um so intunes itself so I'm in unity this is the version I'm currently using because I think this is the latest long term support at the time of filming I'm going to go to 3D core now it might be tempting to go down to the AR but this includes a lot of extra libraries that can make the project size very big so I'm just gonna give it a sensible name and so AR Audits and I'll choose an appropriate folder and create project now while that's then creating what you can be doing is making sure you've got some assets ready so if we just go on to well not enough we I've already created some files and I've got most of these from the NASA website because they are free for us to use I've made from my own but either way I've got a picture of the earth a picture of Mars and a picture of the planet textures themselves that I'm going to then using in the actual project so while you pause this video now go and make sure you've got some images ready so one like I said will be for the actual tracking one will be for the texture up around the mesh that I'm going to use okay so now unity's finished creating the project for us and the first thing I'm going to do is drag those resources in so that one thing I like about Unity is the ability to do this so I can just select all of these pictures drag them straight to my assets folder now normally I would like to be a bit cleaner and put them into a subfolder but you'll see in a little while why I'm not doing that on this particular session I can do that later okay so the first thing to do well the second thing to do now is to incorporate the correct um files so I'm going to go to the package package manager so windows and package manager so we need to bring in just the things that we'll need for the simulation at this point if you want to do iPhone development you'll have to include some extra files later okay so if you're on a slightly older version um you might do this manually I'll share to that in just a moment but I can go into Unity registry again I'm not going to click on the AR package I'm just going to scroll down here and I'm looking for the XR AR foundation so we've got Foundation now I've got 5.0.7 um if you've if you've only seen version 4 then you will have to go on to um this ad by name and then you would physically type in I'm just going to bid lazy and copy paste this and you would physically type in oops oh press one button now by name and you type in this followed by the 5.0.7 and then it will add it manually I don't need to do that I can just click on AR foundation and install this should shouldn't take too long foreign do I want to restart and for this instance I'll just press yes okay here it is restarted so now I'm going to add the second package so our second package is going to be the AR course we just have the AR Foundation and provide them yep they are foundation and I'm looking for the AI Core so I'm just going to scroll down have a look for that okay I forgot it was called the Google AR course so I'll be developing for Android by the end of this not iPhone uh bro I think you do the AR kit for for iPhone so I'm just going to click on that same again 507 if you've not got access that you've only got access to version four then same again up here and add the car manually okay so I'm just going to click on install bring this in for us okay so that's now both of the main package installed so that we can do the simulation and then ultimately the Android development so I'm just now going to close package manager down I'm going to go into our project settings so I start with build settings um yeah I'm gonna go for Windows for now obviously later I'll do Android and then we'll click on player settings um so our first bit is and when we're going to now we're going to go on to the XR plugin management I'm going to enable XR simulation I'm going to check out the other things are intact yeah that's fine don't need that exhaust emulation yet that should do so that was the main bit just clicking XR simulation okay so I can close that down close that down I'm now going to go into window XR and choose AR Foundation XR environment so now it's going to give us a basically a default scene for us to play with so where it sees an image we'll be able to then do AR things now at this point this is now going to be kind of up to you if you want you can install sample environments it gives you lots of things to play with I'm not going to do that for now I'm just going to go in with a with a very basic environment to play with Okay so what do I need to do next if I was to just press play on this now oops we've gone up a little bit bring that back down oh that's fine I'm going to drag this onto our main menu there we go so now we're going better properly so if I just press play now nothing fancy should particularly happen right there we're not seeing anything at all so what I know we've not done so right now it's using the main camera so I'm just going to get rid of the main camera and I'm going to add AR session so if I go into XR AR session and that's what will give us some of the scripting to handle this and then I'm also going to add our XR origin so XR origin mobile AR so this now gives us our AR camera and a few of the little bits and piece of now if I press play we should I say we should see oh there we go so now we've got our environment I'm using my right Mouse to just zoom around I'm using wasd to kind of move around so you do need to hold the right Mouse button down for wasd to actually work and I can use cue any sock up and down so make sure you're comfortable with that because now basically you've got a system ready to go without AR okay so to enable our simulation so we can start working with it we need to edit this seeds we can add our own images IE Earth and Mars um so I'm going to go on to in fact if I just click on there we go if I just click on edit environment now you can see it's grayed out I can't do I need to duplicate this default simulation so I'm going to duplicate it it's going to ask me to give it a new name so I'm just going to call it um test AR zero one just in case I want some multiple tests so there we go I'm now to the edit mode that's important that before we try and run this we do click back out of edit which I'll show you again in a moment now I don't particularly like the simulator view because it's two separate images and it can get confused so I'm actually going to delete that I'm going to add um a empty nope I'm going to create an empty and I'm going to call this tracked image01 I'm going to go on to my control panel where we are now going to add I'm going to add we're going to add a simulated tracked image now you can see it's asking this for a texture so I'm just going to drag Mars onto there so I'm going to drag the mouse picture now that isn't the actual picture as you see we can't see it there just that it knows this image is looking for I'm also going to change this to scale one and one I had some difficulties with it not working and that's just the size thing so now under tracked image I'm right clicking and I'm going to add a quad so this quad is the actual picture we're going to see in scene so there's our quad so I can just drag my picture of Mars onto it there we go now got a mask picture I'm going to click back on the tracked image so I'm leaving the quad Alone um it's really easy to Clumsy click and do the wrong thing so I'm just going to click on the scale I'm going to shrink this down a little bit I'm going to do you know just for now I was going to create a proper little scene for it and make it look like it was on a wall but for now I'm just going to put Mars just there okay so we've now got tracked image with Mars and the name is very important Mars with little M the quad's got the Mars texture on I'm now going to come back out of our edit out of any mode back in scenes by just clicking scenes so there we go we can now see we've got our Mars picture now if I expand on this I've got the extra origin camera and Main camera if I press play it should come up with tracked images so it knows it's looking for something so it's got trackables if I just come around a little bit okay it's not quite detecting it just yet because we still need to add a few more things okay so our next step is to right click in the uh assets window I'm going to create an XR reference image Library so this is going to keep track of all the images that we want to use as tracking references so I'm just going to leave it that default name I can say add image I'm going to drag my Mars picture onto here so again still important same file name and I'm going to say keep texture at runtime I've also heard that if you specify the size of it that can make it more accurate so if you know exactly how big your real printout is going to be then you can specify that and it can help with the tracking but after in a simulation view it doesn't matter right now okay so now I've got that the next bit to do is starting to link these together okay so we're going to click on our XR origin we're going to add component I'm going to look for our tracked image manager so we've got the serialized Library nothing image Library so I'm going to drag the image Library onto here now if it finds an image in image Library it wants to display a prefab a prefabished a prefabricated object and we haven't got one of those so we're going to quickly go and make one so I'm going to click back in our little arrow I'm going to click on edit environment I'm going to create a sphere so I've created a three object 3D object a sphere I'm going to make sure this is zero zero zero coordinates because it will be all relative later I'm going to scale this down a little bit this is going to be our planet so I really wanted to be a similar size to the picture I'm going to drag my Mars texture onto it so I've got a little mask texture I'm just going to call this Mars and this is where the the spelling and naming is really important so I've called him to Mars the exact same as what my image is otherwise it won't know how to connect them later so now I've got Mars I can drag Mars from here so I'm just checking yeah but still zero zero zeros that's fine I'm gonna drag Mars down to my assets folder and that creates our prefab so now I can come back up here and just delete because it exists down there so I'm going to come back up to scenes back onto test and just click back out so no longer in edit mode and now we've got our prefab so I should be able to drag Mars over to there so now what it sees this picture it knows displayed that model okay so if I press play there we go we can see it's got the planet as we move around it's just there okay now we can also see it's sort of now we know we're gonna be honest we can't see anymore but Unity sort of does a best guess based on where it's spawned in it keeps those coordinates relative which is really useful because it means when you're on your phone if it loses tracking for a moment it'll still stay there okay so that's how we've got our Mars and if we want to do earth and I'll quickly show you how this won't work for multiple images and if I come back into our edit environment I'm going to just very quickly duplicate this one so right click duplicate I'm going to just rename this to image two where it's got the Mars I'm also going to add Earth I'm going to click on the quad and drag Earth onto this image so now we've got Earth instead click back on tracked image and I can move it aside if I come back out with the edit mode we've now got Earth and when I press play so I've forgotten to do one step that's fine because we'll all make these mistakes so you can see it's seeing Earth which I'm surprised that's actually worked but it's putting Mars there because it's just seeing something from the image Library which in this instance isn't actually there yet so this wouldn't work on a mobile phone if I click on reference images add image drag Earth on um it still doesn't know what to do with it because it's only got Mars there so in our next lesson we're going to look at how we can add multiple um images multiple models and prefabs so it'll can choose the appropriate one like you saw in the opening video okay so I shall see you in the next lesson when we look at multiple image tracking and as always if you've found this video useful please like Please Subscribe and I'll see you later
Info
Channel: lightsandclockwork
Views: 11,624
Rating: undefined out of 5
Keywords: Unity, AR, A.R., Augmented Reality, Tutorial, Lesson, Simulation, Android, Mobile, Development, Lights and Clockwork, lightsandclockwork
Id: 02YRwQsaFeg
Channel Id: undefined
Length: 15min 57sec (957 seconds)
Published: Sun Sep 03 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.