Augmented Reality in iOS
The course is part of this learning path
This course explores augmented reality and how to use it to bring some visuals into our lives, into our living rooms. For example, at the end of this section, we're going to build an app that we can show the Earth, the Mars, and the Venus inside of our living room just like it's real. So, we're going to learn how to do that in this section. If you're ready, let's get started.
Hi, within this lecture we're going to finalize our Solar System App with finding some planet textures. In order to do that, I'm going to go over this opengame.org one more time and I will see if we can find some world textures like Mars textures or Venus textures to show in our app. So, we can just start by searching over this website. If that doesn't work, of course, we can move to other websites as well. So, I'm going to go into Browse Textures and under Textures I'm just going to search for world or planet or galaxy so that we can see the options that we can get over here. So, we have some kind of options but I believe they are not good. So, we're looking something like this, like a World map but in a flat way so that we can wrap this around our sphere and it would look good. But I believe this is not the one that we are looking for. So, let me go over to Google and I'm just going to search for planet textures, okay? So, if you do that, you will see a lot of options over here as well. And there's a website called Textures for Planets. So, it's simple planet textures, okay? Textures for planets. So, if you come over here to downloads, I believe we have the option of downloading a software which is not we want but we can go for this texture packs. And over here you will see some packs like a habitable world pack or inhospitable world pack. For example, in hospitable world pack I believe we have Martians, so I'm going to download this, and over here there is an terrestrial world with clouds. So, let me download this as well and we will see what we get in those textures. So, this is one of them. So, let me bring those in. And if you cannot find them online, you can just use mine over my GitHub account, okay? So, let's see the Mars, and yep, I believe we can work with this png. As you can see this represents the Mars and Venus. So, we can use that. So, let me name this Venus and let me name this Mars. And let me delete this because we don't need it. And let me come over here. So, it kind of looks like Earth. I don't know what it is actually, but we can use it, right? Because it's looking good. I believe this is World map. So, we can go along with this, and if it doesn't look good, of course we can just find another one and just change this later on. So, I'm going to go for this one. So, let me bring in this by changing its name to 'world' and let me bring over here and take everything in here and I believe we don't need that. So, let me open my art.scnassets and bring all of these visuals in. Now, rather than creating this sphere I'm going to create the World, Mars and the Venus, okay? So, let me comment this out. Of course, in your own time you can search for other planets as well. So, for a World I'm going to give radius of 0.1 and I'm going to say "world.png". So, this will have the SCNVector of, let me choose this, for x I'm going to go for zero, for y 0.1 and for z -1. So, right now I'm just going to create the others. But of course I have to change this my sphere to work. So, if you create Mars, for radius you can go something like 0.2 or 0.3. But I suggest if you're really building this app for educational purposes for like kids, okay? You have to see if you can find the real dimensions of World and Mars, for example, if Mars is twice as big as World, you can go for 0.1, 0.2 in this case. So, I'm going to say "mars.png" and for vector, I'm going to open this and I'm just going to move this a little bit further away from World and again, you can actually decide to do this relative to their own sizes, own distances in the real solar system, okay? So, let me add this to our scene and rootNode.addChildNode and rather than world, I'm going to go for Mars, and let me create the Venus. So, let's call this createSpere. And I don't know the actual size of Venus or her relative size to the World. So, I'm going to go for 0.15 and call this "venus.png" and for vector, let me just move this further away from Mars as well. And again in a real app you would just calculate the distance between Earth and Mars and Mars and Venus and make this relative to the actual distances, okay? And let me call the same zatz like -1. And we will add this to our scene as we have done before. So, moment of truth, let me run this on my iPhone and see how it looks like in our living room. So, here we go. Now, I have the Earth, I have the Mars and I have the Venus. And as you can see Mars is much bigger than the Earth and Venus is much bigger than the Earth again. So, Mars is the biggest one, I believe that's the case in real life as well. And we can see the top, we can see the bottom and we can see every aspect of this sphere. So, this is actually very cool and my dog is still sitting over there. So, here you go. Now, we managed to create this solar system app with just field lines of quote thanks to the AR Kit. You can actually create this as an educational app so that you can just publish it on the App Store or you can educate your own kids. I don't know. So, I hope you enjoyed this one. We're going to stop here and continue within the next section.
Atil is an instructor at Bogazici University, where he graduated back in 2010. He is also co-founder of Academy Club, which provides training, and Pera Games, which operates in the mobile gaming industry.