All right. 1
So that was pretty simple, right. 2
And that's all thanks to ARKit. 3
So let's use it to create something else. Instead of using a cube, 4
let's create a sphere this time. So we'll call it sphere. And instead of using SCNBox, there's something 5
called SCNSphere. 6
And all we have to do is give it a radius and let's say maybe 20 centimeters in radius. 7
So that's about 40 centimeters in diameter. 8
I think my room can handle that. And instead of adding the material to the cube, we'll add it to the sphere 9
this time. And also change the geometry that's associated with the node to our new sphere. 10
But this time, I want to make it a little bit fancier. Instead of just having the UIColor red which is 11
nice enough if we're making a dice, 12
but let's go crazy, 13
let's put the moon into our living room. 14
So even though it sounds pretty crazy, it's actually really easy to do. 15
All we need is just a Texture map. And there's a website called solarsystemscope.com. 16
And if you go into Textures, you'll see that they have loads of high-resolution images of a whole bunch 17
of planets, Earth, or sun, moon, stars, Milky Way, and fictional. And you can download them for free. 18
So in our case, we wanted the moon. And why go for high resolution, if you can go for extreme resolution? 19
Well, obviously, if you're deploying the app into the App Store, you might want to make some considerations. 20
But right now, I just want an extreme resolution moon in my living room. 21
So I'm going to download this 8K file. 22
All right. 23
So once you've got it downloaded, you can actually see that this is just a flat map. 24
It almost looks a bit like, you know, a world map 25
if you had a picture of the earth. It's just the representation of a sphere laid down flat. 26
And this is what we're going to use to essentially wrap around our sphere and make it look like as if 27
we have a moon in our 3D space. 28
So find that moon image that you downloaded. 29
So I think it's called moon.jpg. And you're going to drag it into your art.scnassets folder. 30
So just click and drag and there we go. 31
It's incorporated. 32
And then, instead of using UIColor, I'm going to show you how easy it is to add a Texture map to are 33
3D object. 34
So in this case, instead of having on diffuse property being a UIColor, I'm going to just use UIImage 35
named. And remember that because it's resting inside the art.scnassets folder, 36
it's actually not at the same hierarchy as our ViewController. 37
So we're going to have to navigate into it, just like the way that they did here with the ship. 38
So, in fact, I'm just going to copy that and paste that in. And instead of ship.scn, I'm going to 39
change it to moon.jpg. 40
So, now we are draping this moon.jpg Texture map onto our sphere, and we're going to place it at 41
the same position as before with our box, and then we're going to make it appear on our sceneView. 42
So let's give it a go. 43
And there you have it, 44
the moon in your living room. 45
So I hope you enjoyed that, creating boxes, creating spheres, giving them Texture maps, giving them colors. 46
Now in the next lesson, we're going to be getting on with our real task which is creating our 3D dice. 47
And I'm going to show you how you can import other people's 3D models, so that you can easily use them in 48
your project. 49
So I'll see you there.