Welcome to overlaying images.
We need to consider what are our layers when we're sticking everything together.
One of the obvious ones is the background image and that has to be visible.
In fact that is the base of our entire project.
Now we got the object itself.
This is the item we're using CGI were generating this on our computer and they were merging with the
real world image that also has to be visible.
Now the moment's whim blending the two things together.
And we're kind of getting all of the objects isn't isolated and we're getting this blend between the
two.
So we need to sort that out.
We're going to have a shadow eventually and that also needs to be visible.
However the ground itself used for capturing the shabot needs to be hidden.
So let's have a look now at how we can isolate the object by itself and give that some thoughts and
also how we can go about isolating the shadow by itself or whether we need to do something else with
the shadow as well.
Before we go over into blender Let's grab a pen and paper and work out the layers of our image.
Let's go ahead and think about what we want.
So at the end we want a composite image.
A composition that has our mountains or whatever your image is in the background an object and a shadow
that looks like it's being cast onto the actual surface.
And we've got a fake ground plane that we can use there which we don't want visible in the final scene.
How are we going to do about that.
Well let's have a look at our components what's making up this scene.
We've got a background and that's all pretty much goes all the way to the end and there's something
happening here before we render.
And that's going to be last or final combination node if you will.
And this is just conceptual at the moment we're trying to work out how to piece together our image.
Now we can render our entire scene at once which is a an object.
The ground plane it sits on and a shadow.
Okay so that's something else we can work with.
Now we could render the shadow by itself.
Now if we have a look at what would happen in in reality is there would be a shadow cast underneath
an object that's too close to the floor someone extend the shadow up to the top of the plane edge to
demonstrate that.
And then finally we can do the plane itself or the ground whatever we're doing and with with these We've
got pretty much every combination we can use to work things out.
Now the problem we have this one here is a circle in red for a moment problem with this one here it
is it would actually if we overlaid it unless we started doing something funky we would have a shadow
over the top of our object.
When we combine them so we don't want to do that.
So I'm just going to remove those bits there and we'll decide at this point that we do not want to use
that particular image.
Additionally we have to consider the render time implications itsay each one of these three images took
the same time to render.
I doubt they would.
But let's to save arguments sake.
They do then that middle one that we've decided to exclude potentially could save us 33 percent of our
render time which if it's an animation is going to be a lot of render time.
So when we can avoid rendering that is a good thing because it will save us a lot of time even if you
decided at the end to render your composite image at high resolution is still going to have to render
all of these out first.
So that's a good time saving tip there.
So that leaves us with these combinations and we need to do something with them.
We don't know quite what is at the moment but we need to what do we need to get.
We need to get the object by itself and we need to get the shadow by itself.
But and art just draw a harsh line there.
The shadow has to be occluded by the actual object.
So you've got the object by itself and I'll just do a dash here as if it was alferd out and an image
just by itself and once again here we would have an outfit out image.
So how do we get this well we can certainly just extract the objects from here.
So something will happen here which we'll get.
That's And then we can combine that.
Towards the end we to do a plus there.
I don't know whether it will be an addition or multiplication or something.
In fact what would be better of course would be an equals some sort of maths going on that would equal
that.
And again this question mark is really in equals what do we do here that equals that.
And then finally we've got the shadow all by itself but occluded by the object.
So we have the object up here and we have the plane just here and the difference between those will
be included shadow.
And so there's going to be something else happening when we combine these things together.
So there's three distinct groups here we've got this background group with something happening and I'm
just going to make that big big agree.
So something happens with this background group and then it gets passed onwards.
We've also got this group here.
And then something gets passed onwards.
And finally we've got a third group and just going to do it in a different colour so it stands out.
This group here.
So these things themselves I say group.
They can be compartmentalized and then reused if necessary.
Now will depend on the scenes you're doing but we can see here how putting them all together.
We've got three distinct groups so we've got three levels of what's known as abstraction that we've
got a lot of detail going in here but we can zoom out and make these modules much more easy to follow
and much easier to read as well.
Looking at this diagram in front of us we've pretty much done this first one if we just link in we get
the background image and we're kind of there with this one at the moment.
We're we've got the background the actual cube showing but it's affecting the entire image and not having
the cube itself isolated.
So let's go ahead now and look at that and hop on over in a blender.
Okay so I've gone ahead and opened up the scene.
We were working on before we're setting up the camera and the fake ground plane to cast the shadow one.
And I'm liking what I see so far and I even rename the file so I don't overwrite the old one.
Now I'm going to immediately append an object into my scene.
I've gone on to blend swap and I have modified a an F 22 like thing it's an aeroplane.
So let's go ahead and append it into our scenes and you can also use this if you're doing a runway and
following along.
F 22 lightning will just import that will go to object.
Or if I click happy go f 20 to append from library and under the move that now towards the camera and
there will do it's in the ground so that's just lift it up so it's not perfect.
Now because I've set everything up so is all level I can actually whiz round to the.
Front view and orthographic mode zoom in and make sure it's not actually in the ground so it would be
hovering about there.
This plane does not have wheels nevermind seats.
So let's go ahead now and with background for camera mode.
Make sure it's roughly in the right position and with shift across just a little.
OK we've got an object and we want to isolated from the background.
Let's render what we've got so far.
And again looking at this the lighting is not right and it's going to take too long so to scroll down
further sampling and turn the render down to one that will speed up that.
And finally let's sort out our lighting as well so I've got the lamp in the scene.
It's blatantly not a sunlamp at the moment so that's making some amp for argument's sake it doesn't
matter with the sunlamp but I'm going to move it so as over the sun.
And then the little line that comes out to show you the direction I can manipulate that so that it is
facing towards us.
So let's go ahead and open up the properties panel and we've still got our lamps selected and I'm going
to change the rotation to 0 0 0.
And I'm going to camp out for a moment.
And see that that is facing directly down now.
I don't want it face indirectly down I want it towards our plane which is over here.
And so I think I need to rotate it around the x-axis.
By the looks of it by minus 90 he hopes Yes that's right.
And now I just need to move it towards the camera as well so I can go back to this view and literally
by manipulating not the why these z axis has tried 10.
Yeah that's moving it toward.
So we need positive.
So now it's definitely towards us that is quite hard to see.
But the little line if I exaggerate it moving away moving towards it because it was roughly towards
us to begin with I know it is moving towards not away from finally the rotation where the sun isn't
pointing directly over there.
I'm going to make it face down slightly may be 85 and let's just render that now and see what we get
at.
That's not the desired result.
The first thing I'm going to do is get rid of that back drop because we need to focus on one thing at
a time.
If you put too many things into your pot you you won't be able to.
We need to isolate the flavours so we need to isolate these two parts of our image someone to switch
immediately over to the compositing node and let's have a back drop turned on.
Oh no let's not have the backdrop there's just use of the window down here and also render turned on
let's render our image out perfect.
We're using nodes and you may get this happen to you occasionally where you're using nodes and no nodes
appear.
Switch to the shader and switch back to your compositing node and it should all come back.
So as I was detailing earlier we need to isolate some of these components so they don't get in the way
and you can't go back and touch them over that's abroad.
You naughty naughty can't do that.
So I'm going to sell these two here make them into a group and by making them into a group and then
come out and it's called node group that's no good.
I'm going to call it background image.
We know that works are just background will be fine for the moment.
We know that works.
We don't need to play with it.
Let's get rid of it completely from our set up for the moment.
We've got this multiply here.
I'm going to leave that.
I think we're going to need multiply at the end.
I don't know.
So nothing plugged in with nothing plugged in we can't see what's going on.
Let's delete the multiply and well if we need it.
We'll pop it back.
I'm going to link up to the not the view of the composer.
There we go.
And I'm going to get rid of the viewer because I can always bring that back in with no Wrangler if I
need to.
Excellent.
So we have our friend play here.
I'm still not happy with that's the the lamp itself.
Have I actually set the lamp up.
I don't think I have moved it I made it into a sun.
I didn't use notes and I didn't turn up the strength to maybe five.
Let's switch to rended mode to see what's going on in the 3D view.
Gosh we've got a shadow there and it looks like it's facing the right direction.
And so I want the shadow to be a bit tighter and this size will make its basically diffuse the shadow
and set that to zero.
We get a really harsh shadow that's also not what I desire northpoint not one.
They go get a bit of fuzz there.
Let's try not point nought five.
Excellent.
I like how that is coming out.
Let's hop back over into the compositing layouts compositing.
There we go.
Now something is taking a while to render in the background let's just make sure everything set up sampling
renders one that's fine.
I'm happy with how this is here and we've got auto render Let's go ahead and work out how we can isolate
this.
In fact that doesn't look like it has rendered out.
There we go.
Now it has.
What's Have we got to do.
We need to isolate the object itself and because it's an object in our scene we can give that object
an idea and then isolate it via that idea.
Let's go back and open up what we've got a 3-d view here we don't need open anything else up.
I've got the F 22 selected and I can go into its object properties and here I can give a pass index
under the relations you can move it onto a different layer if you wanted to you can do that from here.
That's another way of doing that and you can see that a parent object and you can give it an identity.
I'm going to set that to one and just re render and see what happens.
Nothing looks any different.
Brilliant we haven't upset the rendering gods as it were.
So the next thing to do here is be able to pull that information from our render layer.
And it's not turned on at the moment.
So we need to go to our render layers and go down and underpasses there's a lot more options.
In this case we want the object index.
If we go ahead and select that we can see that we get index objects coming out.
Okay that's a good start.
Now how do we mask off this particular F 22.
Well we need to add in a node that's converter.
And then I see the mask so it's masking off a particular index number.
And here in highly value all we need to give it the entire scene data so that's plug in the on index
object.
And there we go.
Let's preview this.
I'm going to use noad Wrangler again.
I could plug it into the vehicle which I've deleted but I'm going to use controlling shift and click
on that and we should see if I turn back up on what's happening and we get a white image.
We've not got it set to one so let's go ahead and set it to one.
Oh now we get a black image.
What is going on here now because we didn't have this set up on the render layers yet it hasn't actually
been included.
The node has it all set up but it has not been output yet.
It's not stored that data so it's null at the moment or nothing.
So let's go ahead and re render our scene.
And there we go.
We have a mask isolating just the object.
Brilliant.
And of course that leads us nicely on to a challenge.
I would like you to go ahead and render the background and the objects together.
So finish off the node set up to show the background with the object placed upon it.
You'll need to use the idae mask to show parts of the rendered image.
You'll want to see pause the video now and give that again.
Okay guys.
Welcome back.
Let's go set up the nose now and hop on over in the blender right so we have a mask set up here that
we can use.
Let's bring back in our background.
Did I delete it.
No I just had it out of the way.
You probably won't be able to see this.
Zoom back in.
There we go.
Now I found that background low.
And we've got a viewer here.
I don't need the viewer it's just going to get in the way of this backdrop so I'm going to remove that
entirely.
And I also want the render to automatically update so what do we have before we had a mix colour mix
knows we need to mix these two images together.
We know that in which order.
Oh interesting.
Well if we just mix them 50/50 that's not going to work but we're going to have to do something with
the idae mask here.
I think it is mix we need because we need again this waiting here is an average of the two.
However if we control the weighting.
So let's just bring that back in.
If we bring the weighting it of 100 percent of only this image.
So I'll be the factor of the bottom one so I think that's the right order.
Yeah I think so.
This will be a factor of 100 percent thus showing us all of what's under this image.
And then the black will be nothing of this image and therefore show all of the background.
Let's plug it in and see what happens.
All excellent.
How about vides all come together rather nicely halimi.
Just get rid of my back drop again so we can see the node set up.
Let's see what we've got.
Let's see if we can group things together into their compartments.
So this is like an end mix node at the moment and we have the composite at the end so that's fine that's
are that's our End Point.
We've got a viewer here I can just get rid of that.
So we have our I.D. mask and our render layers.
Now I would like to group these two together.
And sometimes it's a bad idea to group inputs together.
But if you do try and group these together if we go node and make a group a blender will complain we
can't shove a render layer into a group.
And I'm not going to go about.
And this is mask.
I'm going to shove that into a group just yet.
But this is isolated are object.
The issue I've got with this of course is it's a different layer to this background so this is all one
particular group.
So we could visualize that in a different way if we want to we could put a little frame around it.
So let's go and do that now at select both of these and add a frame.
So I'm going to select those two as done and shift them.
P Ill pop a frame around it.
I'm happy with it left as the fall colours it just demonstrates that that is its own entity and also
means we can move them both around together.
Excellent.
How did you guys get on.
I hope you've managed to render your objects over the top of your photo your scene.
Of course we can get to making that look a bit better.
Later on we just need to get the components right first.
Now I did sad in one nain this for I did want to colour in this frame but I will name it so with it
selected I'm going to go over the label here and call it object isolation.
I so relate to or isolation.
That's called at isolators but the verb at the front ice or up spell that completely wrong I say relates
object and I'm going to use kamil case which is where you just capitalize with no spaces.
Isolate objects and then R has in that brillion THIS turn up the label size so we can read it.
There we go.
Isolate objects.
Perfect.
How did you guys get on.
Remember to show your work over in the discussions on the forum and I will see you guys in the next
lecture.