Welcome to texture's with transparency in this video you will learn how to use cycles nodes to apply
transparency to your image and use groups for nodes for simplicity and then use those node groups again
on other materials.
So let's hop straight on over in a blender.
So this is where we left off before and of course I'm now going to guide you through.
First of all the solution to the last challenge and I'll talk through the workings as I go.
So I'm going to make this a lot larger here.
All I need to see is a thin sliver of the material at the top.
So I'm going to get rid of this tangent nodes that I've added and I'm going to add in now the first
thing we need to interact with light how light is interacting with a surface that's going to be a shader.
So I'm going to add a shade darker shade a shade.
There we go.
And it's how it's going to be transparence.
Along here we've got a transparent B sdf.
Now some of you might want to know what B S D F stands for.
Well it stands for bi directional scattering distribution function.
And if we have a look at the wikipedia article for it we can see it's a series of Count relations of
how light interacts with surfaces where it hits them.
And there's loads of other types of interactions as well.
Do you go ahead and read this wikipedia article for more information on how it actually works.
But suffice to say it details how light interacts with a surface.
So let's get rid of that and hop straight back into a blender.
So we need to link both of these outputs to the surface.
Now the surface determines what's the actual surface of the middle of the geometry is going to look
like here.
So if we try and link them together we'll see we get one or the other.
Now the good thing there is it does look like when we had transparency and just transparency we it goes
transparent so that's a good thing Hello that is working.
Now we've got to mix these two together and they're both shaders So we need to mix a shader.
Now I'm going to go to add and shade and then let's say there's something called mix in here.
There is mix shader.
So if we select that and literally we can pop anything on top of something like that and it puts it
in.
Now before we connect the other one let's just move this factor up and down.
Okay so I can see there that when the factor is at zero this top one is 100 percent.
And as we go down it gets less and less and less and eventually becomes black which is zero.
So that means it's got nothing of this one and 100 per cent of this bottom one.
So with that in place Let's disconnect that for a moment and play with the other one that's this one
in and see what happens.
So again with it's at 100 percent of the bottom one here it's black.
There's nothing going on.
And if we move it all the way this way.
It becomes all black and white still so we still got the alpha channel plugged into the colour let's
read link the colour to the colour so we can see what's going on so we can see here it goes from 100
percent the image itself all the way down to nothing because there's nothing plugged into the bottom
one.
So let's go ahead and plug in the transparent shade and see what happens.
So let's move this backwards and forwards.
So we can see we're going from 100 percent of the diffuse to a hundred percent of the transparence.
That's not quite what we want to do.
Let's try these round the other way.
And moving them up and down that won't replug them in looking going to swap these round here and see
what that does it swaps it around for us.
So we go to 100 percent of the transparency to the image itself.
Okay that's starting to look better but we need to control this not on an overall scale but on a pixel
wide pixel case.
Now what we can do is we can use this alpha channel which we've already seen creates a mask a black
and white image.
That's what it looks like.
So if I plug the alferd channel straight into one of these shaders and remove that then we can see here
that the alpha channel itself just gives black and white how we can use that to control because it's
a great node it's output in a value for every single pixel here.
We can use that Alpha channel here to plug in to the factor.
Excellent.
Let's remove it from the shade of air and let's link these back up and see what effect we have.
Right that doesn't look quite right at the moment.
Let's try reversing these round.
So let's put the diffuser on the bottom.
Ah ha.
Brilliant.
That's looking much better.
It's completely transparent.
I think I'm going to move over the top of this one here and lift it up.
Excellent.
So we're seeing straight through it.
That's absolutely brilliant right.
So now we've got a nice little set up here with these three areas here.
We've got these two shaders being plugged into a mix shader And that's.
I'm just going to reorganize it here to make it look a little bit better.
Yes.
Lines crossing over everywhere.
I think I'm going to be able to avoid that that easily.
But what we can do now is we've got essentially a system we've set up a series of nodes here to do a
task and that is to make a background image transparent.
Now if you had hundreds of images that you would go to do this too you'd want a quicker way of doing
it without having to add to shaders to your defence one that comes automatically.
And we can do that by grouping.
So holding down shift I can select the others in our group that we want to make.
When I go down to node I can go to make a group and we can see here its control and G.
Now when we go into the group we can see it's got a group inputs the actual shaders themselves and the
group outputs.
Now it's very important that you tend not to put in input nodes i.e. this image texture or output nodes
with in a group itself.
Now in order to get back we can tab out because that will go between the two screens.
However what you can do is put the groups inside groups and if you do do that you can't just tab out
it or take you to the next level down.
And on the header bar of the know this this little up arrow so it would not use nodes.
Take a little drawing pin and then this bakara And that will also take you up a level which is brilliant.
Now this looks a lot better.
Its much more clean with back down to three nodes so its easy to see whats going on.
Now as you can see there's little arrows next to the names of these groups that you can collapse down
if necessary if it starts getting really busy very useful.
And of course what you can do isn't named this node group.
Some think more useful.
So if we open up our properties and we can see it's called node group and I'm going to be calling It's
trans make image essence.
Now I have named it when I needed it to use it again.
I can go down to add and go to search and I can go make Inish transparencies actually now in the file
and I can use it again and again and again if I bring this up make image transparent.
There it is.
And we can open that up and see that ARG group still exists.
Brilliant.
Okay a bit of a transition there.
I am Michael from the future and I'm here just to make sure that you guys are fully informed.
We've had a couple of questions and hopefully this will help clear up and give you guys further knowledge.
I've started a new blender file here.
I'd like you to do the same Make sure you saved your work.
And we've got the default cubin so now we're going to get rid of that.
Hit the x key and delete.
Now that's gone instead of going add.
We scroll down just a little images as planes.
This time we're just going to have a simple plane right at the top.
There we go.
Okay now we have the plane in the sea.
We're going to was sign everything manually and see how that comes across.
So I'm going to have to create a new window.
I'm going to make the tool shelf and propertys panel disappear and drag a new window so we can see what's
going on.
I'm also going to switch this view ports on the left over to rendered mode.
And it goes that's rendering ready to go on this side.
We need to first of all give this material we don't have a material just yet.
So let me pole open the propertys panel and go to materials.
I'm just going to click on you.
It's got materials 0 0 1.
Let's call this grass.
There we go.
Now I'm just going to make that disappear a bit more so we've got some room here.
We're going to switch this viewport across to a different view point we're going to go to the node Ed.
And where we've been before.
Now we're going to have to build this up.
Bit by bit we know all the components that we need.
But there is one extra.
So what do we need.
We need to diffuse shader we need a.
And before I go and add this in if you do want and little micro challenge pause a video and see if you
can populate the other bits that we need.
If you've done that great Welcome back.
Now are we going to need a mix shaded to mix these two together.
We are also going to need a.
That's right a transparent shade.
I'm going to put that transparent on top because it's going to plug into me top.
Oh I put that in the wrong place.
I'm looking at the wrong part of the screen that's linked these back up so we've got this coming through
fine.
And we needed to control the fuse by an image says go ahead.
I'm going to use the menu this time and actually search for image.
There we go image texture.
Plop that in there and we're going to link the colour into the colour here.
And the Alpher into the factor that looks good so far.
Now it's gone pink over on the left hand side.
And that's because it doesn't have a texture.
So the kind of standard colour when it doesn't know what to do we go ahead and open up a texture and
I'm going to go to where I've stored my assets.
Now at the top of the head were beheaded bar basically for the file viewer.
We've got these thumbnail views and this is a great way of having a look at these are done which will
I'm going to pick.
I'm going to pick grass blade 7 for this example.
And we can't see anything.
And this is set up exactly how we had it before.
But there's one thing that the insert images Plains is doing which even though it looks the same is
slightly different.
Now at the moment we're not explicitly telling blender how to map this image to that plane.
Now to you and I it's obvious it can only exist one way on that plane.
Perhaps if you rotated it round but essentially it's still be the same blender needs a bit more help
than that so we need one more note.
So let's go ahead and add in is a type of inputs because we're telling blender information and it's
called a texture a walnut.
If we go ahead and put that in there at the moment we can't see anything.
And we don't have many of these other options available you'll see here there are lots and lots of options
generate normal uv's object camera window and reflection by all means play with those.
But since we have a very simple plane it certainly doesn't need unwrapping.
We can get away with using generated if we link up the generated to the vector.
Suddenly our grass will appear.
So if you go through manually you may have to put this texture coordinate in as well.
Or indeed if you alter something or give it a different type of mapping you may lose that.
This is done automatically when you add images as planes even though it doesn't look like it does in
the node editor.
So a slight subtle difference there.
And of course now it's time for a challenge.
I would like you to apply transparency so make your three shaders into a group if you've not done already
and then apply transparency to the other P N G files you have imported using the group you've just created.
So I'd like you to pause the video now and give that a go.
OK guys welcome back.
Let's hop straight on over into blender.
Okay so now that we are back over in blender I'm going to go up a level and I don't need this one here
I was just the demonstration so I'm going to get rid of that.
Some are just going to grab this other image and move it.
And you'll notice there it doesn't look the same as it does usually and that's because I've got my pivot
points at the 3D Curson was going to send it back to medium point and then it sits on top of the origin
itself.
Brilliant.
Now that that's there we can select the other image how we're going to get rid of this diffuse STF because
that's built in to our module that we've created that we can just drop straight in some of the leite
that's an I'm going to go to AD search and making farraj transparent.
Brilliant and pop it in.
Oh you can go colour into colour and Alpha into a factor and then shape that onto a Surface.
And that should have worked and why hasn't it.
Let's dive in and have a look through what the facts are coming in and across here we've got the transparent
on top and this on the bottom and it goes to an output.
So let's just make sure everything is working as it should be.
Let's go and compare it to the previous one.
So you've got the grass image here it coming in.
And we can zoom out here transparent tops all of this seems to be absolutely fine.
Question is why is that not showing it's as transparent.
And here is the problem.
I haven't selected use Alpher cellmates that's now ticked and sorted and I'm going to set the Alpher
to pre multiplied here.
They do look very similar but pre multiplied tends to be better with small edges that change rapidly
much like these seeds we've got at the top here and the way the grass moves quite rapidly and it's quite
thin so we want the best quality possible.
So armed with that knowledge over on this one I'm going to select my image texture the user helfer is
already applied to its Which is excellent.
I can delete the diffuse shader add in a source while search for my make image transparence and when
I plug this one in.
It should work without issue.
There we go.
Perfect.
How did you guys get on.
I'd love to see your transparent grass.
Do share it in the discussions and I will see you in the next lecture.