In this lecture I'm going to look at adding something that's going to make your characters look more
like they're imbedded in the real world.
And that's chateaus.
So when anything is drawn in the real world you'll notice that shadows have been added and they give
you the illusion that something is grounded to another object.
And these techniques used often in Artworks where obviously there's no shadow it's all drawn by somebody
but just adding that just makes so much more of an impact about the way that one object is connected
to another.
And even in this ridiculously simple illustration that I've just quickly knocked up you can see that
the egg on the right just seems so much more in touch with the surface that it's on and the shape of
the shadow also gives you an idea of the nature of the surface that it is sitting on.
Whereas the one on the left you know it could be floating above the surface.
You can't tell.
So how do we add these types of shadows into an augmented reality situation.
Because we want the shadows to look as though they're fooling across the surface of the real world not
on a virtual object because it's quite easy to cast a shadow from one virtual object onto another because
we do it all the time inside unity and in creating games.
Let's take a little look.
So first of all let's go click on our trackable.
This is the solution for the pub sing along.
I'm just continuing from there.
Let's turn on my Mocca.
Now I'm going to drag and drop my single pre-fab on to more checkable so that I've got a copy of him.
You'll notice I've also made him bigger again so if I selected him over the inspector you can see I've
rescaled him back up to 1 1 1.
The reason being is I want to be able to say this shadow that is cast and the marker I'm using is quite
dark in this case so you won't really be able to see it very well.
We need something to cast a shadow on too so let's add a plane.
Select the trackable we will attach the plane directly to the trackball.
So let's go through the object plane.
You could also attach the plane to the Singha prefab.
Or you could make an empty game object.
Attach the singer in the plane to that and then use that empty prefab to construct a new prefab that's
got two things in it which would be the plane in the center.
You don't want a child the plane to the singer.
Otherwise when the singer moves around the plane will go with it.
Now what I've got here with just this straight plane you can see I'm getting an automatic shadow falling
on and that's just from the standard unity plane with a standard tub of material sitting on it which
is just the default material.
Now in order to insure that you're going to see shadows select your directional light and then just
have a look down to the shadow harp.
I've got it set to soft shadows which is by default but you can also set it to hard shadows if you want
something that looks you know just a little bit stronger.
Soft shadows because they sort of fade out towards the edges.
They look at just a bit more realistic than the Hardshell toes.
OK so now at this point they're seeing a pre-fab that you've added as a child.
The track will just turn that off in the inspector because the trickle is going to create the pre-fab
anyway but leave the plane there.
So let's press play and have a look at what we get with that.
So if I move my Mac.
OK so now I've picked up the animator and I've also picked up that plane which is huge and you can see
as a move it around like that.
We now have a shuttle.
So the next issue is will we need to make that plane transparent and not appear in the experience so
to do that you need a new shader and the shader is called Transparent shadow.
Ruseva and it's attached to this lecture as a resource so download it.
I've already brought mine in.
It's just here what you'll want to do now.
Once you've got that in there it's just right click in your assets and we're going to create a new material.
And that material it's cool trends.
Matt sounds like something out of a science fiction show doesn't it.
And select it the transparent RACV you going to sit on that transmat Iver in the inspector with transmat
selected at the top is Shida.
You want to drop down that you're going to look for.
I.
And in there is transparent shadow.
Ruseva OK so when you've got that and you've got your new material you can drag and drop that from there
into the scene onto your plane and see what happens as I just dragged it over and back again the plane
disappears and that's because that shade is specially written to make that plane fully transparent.
But will it show shadows.
Let's find out.
So go back to the hierarchy and select just seeing a pre-fab that sitting in Knabe but not turned on.
Turn him on.
And there we go.
You can see a shadow on that plane right so the biggest test I guess is to now run this in the augmented
sense turn off the singer préfecture because remember tracking was going to instantiate it and press
play.
All right.
So let's now find.
Now go by and look at that.
We now see that playing any more.
But we're getting chateaus apparently cost into the real world which now gives him more presence in
there.
And he's imbedded which is really great OK that's what we're after.
All right.
So let's move on from that.
Let's now create a more complex saying like I was talking before 10 your seeing a pre-fab back on let's
have Alpine now go to trackable and just put out a preview as well.
Now let's also add a few other objects so we'll add a cube.
And I'm just going to move that out to maybe just behind him there and lift that up because you can
say that it's sitting below that shadow plane.
It's off the marker but that's OK because the augmented
the Mantid experience is relative to the position of the Mokka.
So as our cube and Amal's will just add something else that's at a sphere and we'll put the sphere in
there and just move that up a little bit.
I actually could have that floating just so you can see what it's going to look like in the old minted
world.
Now these things are all separate objects but they're basically part of the entire scene all the augmented
experience.
So we want to group them together and trackable.
I'm going to add another thing an empty add an empty room call this empty scene and then we will child
everything to that scene.
We still want these separate objects to be separate things we don't want them child to get up but we
want them under the St..
Now that Sayne grab the whole scene drag and drop it into the assets to create an entire scene prefab
OK.
So now we can delete the Sayne from under the trackable select the trackable and then in a drawer or
a bowl we put the same instead of the single Singham.
So let's do that.
And now all of those objects will get instantiated for us including the grand plan that has the shadows
Kaisa press play.
And let's now move our Mokka and is seen and you can see the very nice shadows.
Now of course when this thing goes off of my table top it's steel casting shadows where that virtual
plane is.
Even though the virtual plane isn't there.
So that's something you have to kind of consider is where are the boundaries of your tabletop that you're
putting your experience on because that will affect how realistic those shadows look.
But if you've got a great big table and this is sitting in the middle of it then you don't have a problem
with the extent of it.
OK.
So that's adding shadows and you don't have to stop at one plane.
If you want to have shadows cast onto a wall or something you can also put another invisible plane that
runs up along side of your wall to show that as well.