Welcome to light portals in this video you will learn how to use light portals understand the limitations
of their use see that they can dramatically increase quality.
Given a fixed number of samples and see they're especially useful for indoor environments little by
environmental lighting.
So to talk about portals we need to talk first about cycles and how the lighting works.
Light rays are fired out from the camera.
The active camera until they hit a light source.
Now this sounds a bit counterintuitive in to you imagine well that light source could be projecting
light in any direction and to make sure we don't waste time.
The Rays are fired from the camera so that we are capturing the light that only the camera can see.
With the lamp blender knows where the light sources so only fires rays that will eventually hit the
light source.
And this often ends up with a nice clean image.
Now with a missive materials blender doesn't know where the light sources so when the camera fires those
rays some of them never reach a light source.
And this introduces more noise.
With environmental lighting when you've got a sky map in the scene or an HDR high dynamic range environmental
or lighting in an interior with only windows letting light in the Rays bounce around a lot and only
a few actually manage to go out the window and reach the light source.
This introduces a lot of noise in the final image.
Given a certain number of samples.
So how do portal's help.
Well portal's helped by telling Glendale where to aim those rays.
This produces much less noise in the final image.
However they do have some limitations.
Poor tools are a cycle's lighting feature which means that they won't work externally to blend and they
won't work with the blender internal rendering engine.
They increase light calculation time.
However that's offset by the fact you don't have to render as quickly so they produce much less noisy
environments.
Poor tools only work with environmental lights using them otherwise can reduce quality.
And they have little impact.
If you put something in the way so that's going to have a look at couple of examples before we hop into
a blender.
So this is in a missive plane that's placed outside that hole in the in this box and there is no portal.
If we put a portal in the way when it actually looks worse and noisier.
So that's an example of it not working.
And in fact making things worse with a missive plane that's outside.
So what happens if we bring the missing plane.
So it's faking being the window.
Well this is with no port that's a relatively clean image.
In the missive plane acting as the window and a portal there to guide it.
Well you see it actually makes it worse again.
Now let's have a look at an environmental light.
So at this point the environment is just white.
To be consistent and there is no portal you can see that that image is very hard to even work out what
that is.
Is it a cube or is it just a bunch of noise.
Well with a poor tool it makes a phenomenal amount of difference.
And just for example.
This is a sunlamp placed outside with a thousand samples and you can see yes the lighting slightly differently
because it's not an environmental light.
It's a point light source in the sky being a sunlamp it's still noisier than the previous one.
So some examples of when you stick something in the way are we're going to see some familiar faces here.
A There's some bunnies lamps and bowling pins and a chess set.
So we have four different scenes here that we're going to run through and show you the difference.
The top two are with and without a portal and so are the bottom two.
However the bottom two have a glass window in the way so let's go have a look at these in a bit more
detail.
So this is the scene rendered with a portal.
So you can see it's only 30 samples in this case so there is still noise in the scene.
It took about 30 odd minutes to do this particular scene render on a g.t. X 980 just to give you an
idea of times taken even that 30 samples because there's there's a lot of complexity in this particular
scene.
Now if we see it without support or you can see that it's much more noisy especially in the darker areas
of the scene.
Now it changes slightly when you go and put a window in.
So at the moment that's just a hole in the wall.
Go and put a window in.
Well much less light actually enters the room because it's bouncing in and out of that glass.
So less light comes in.
So one of these has a portal and this next one does not.
What did you see the difference there.
This is before.
And this is after.
Well I struggle to see the difference there.
And that just goes to show that if you stick something in the way like glass that you think well actually
if it's an environmental light in the air yet of the glass it will help guide the Rays.
No one fortunately certainly at the moment that doesn't help at all.
In fact in this case it seems to make no difference whatsoever.
So let's now hop on over into blender and play with some light portal's.
So let's start off with a basic cube in our scene so I've opened up a brand new blender file and will
take it from there.
The first thing this I'm going to do is remove the lamp from this basic scene because it's no longer
required.
And we're going to add a different light source.
So we're going to go to the world propertys.
We're going to change the colour of the world to a white and just go ahead hit render and see how that
comes out.
That's exactly what I'll be expecting for it to happen.
This cube is uniformly lit from the outside so we can't see any details because it's white all around.
Perfect.
So let's hop back into the 3-d view and let's make this cube much much much bigger.
So hop into edit mode and scale it up.
By let's make it 10 times bigger.
And then we can exist in it.
And I'm going to lift it up by 10 on the z axis 2 and that should place on the ground.
Excellent so we can easily be inside here and have a switch to the camera mode.
I'm inside it so you've created a fake building very quickly.
The next thing I'm going to do is subdivide.
This keeps on going to come out of a camera mode.
I'm going to subdivide this cube a couple of times so I'm gonna use the tool shelf here.
I want it so I can just remove some of these faces.
So I'm going to go ahead here and remove a zigzag pattern going down.
And for those too there why not.
In fact let's just remove those.
They're perfect.
So let's delete.
I want the faces gone sir.
There we go.
There is our funky window in the wall.
And the final thing we're going to do before we actually start playing inside is to add a modifier which
is a solidify which will make the walls for us and that's under generate solidify.
And I'm going to increase the thickness to point one.
Now one of the things you have to watch out here for is if you look through that there's a bit of a
curve going on.
And if we have a look in fact this is a very thick cube some was going to make it maybe point four so
we can see more what's happening now as it's moving around the edge.
Can we see an wireframe mode.
More detail.
It's not exaggerating it that much.
But basically if you take even thickness It'll make sure that the thickness is applied evenly throughout
the model.
So let's hop inside and I'm going to move my camera about so I can see more.
I'm going to use the walkaround feature.
So we've got our window there.
This is quite a large room.
And I think I've just gone through so I'm just going to come out of wireframe and do that again.
So I know when I pass there and I might want a wide angle lens in fact I think I do in this case.
So I'm going to go ahead and change the camera properties so it has a wider focal length.
I'm going to go for 80.
There we go see much more.
So let's see how this looks at the moment.
There we go.
We have quite a noisy scene now on the render results.
Down at the bottom.
I'm going to change your it's slot one to slot two so we can compare in a few moments and I'm just going
to make this a bit larger so we can compare them much more closely.
So let's now hop to the 3-d view.
Now in order to add a now in order to go ahead and add in a portable is actually a type of lamp some
going to add the portal here and I'm going to cover all four windows with it if they're close together
you can cover them all together.
Obviously the number of portals if you have too many of them may add up and cost you more in calculation
time.
But in this case we can just cover this middle square because it doesn't really matter compared to the
other ones around it.
We could of course add four portals.
So let's go in add a lamp of type area and in the properties for the lamp we can change it so says portal.
That's all we need to do in terms of setting that up.
Apart from we need to rotate it round so I'm going to rotate it's on the y axes and ungless looking
down there so it's going to be why by 90.
You see that dotted line that white dotted line now orange coming out of it.
That's the direction it wants to face.
The light is going that way.
So the final thing here is to do the size.
Now there's an option over in the properties to have it square or rectangular.
So you can have it different proportions under the leave it set square since it's there.
And I'm going to just go up and up and up.
I think this is end up going to be 10 No 12.
There we go.
So 12 covers the entire thing I'm going to add a little extra.
And now when we go back inside the building and hit render we should end up with a much less noisy image.
Now I've got the default settings here so that's 10 samples.
And the difference between that and.
Okay that was a great example I didn't switch to slot before hitting render cilice just render it without.
So there we go.
This one is much noise zarine slot to them with out.
Now one thing that should be noted at this point is that the rough render did take just over three seconds
and the other one was I think it was five and a bit seconds.
Well we can quickly go and check it would go to slot 1.
I'm going to turn my area lamp back on and then render again.
Now this isn't these aren't optimal squares for this particular render they need to be made a bit smaller.
So there you go.
Five point six so it's taking a bit longer.
But let's see if doubling the sample counts on slot three makes a difference because.
I don't think it.
Well I think that's the one at stenn samples with a portal is going to be much cleaner than 20 samples
with out a portal.
So it should take at least twice as long to do this is the one with the portal that 20 samples.
And let's go to slot four and do the one with out the portal just to demonstrate that it's still going
to be noisy.
And we can see straightaway it's going to be much more noisy.
So let's just have a look through these then so we've got slot 1 which was 10 samples with a portal
slot who is 10 samples without a portal slot three is 20 samples with a portal and slot four is 20 samples
without a portal.
So we compare the one that's taken nearly the same time as the first one with a portal.
You can see it's still much much cleaner.
So now we understand about portals and how to put them into a scene.
I've got a small challenge for you.
I would like you to add some portals to your interior.
So add in environment texture or indeed just adjust the world surface like I did in the example hide
or remove any other light sources.
So it's a fair comparison.
Render your interior at about 20 sample.
Render your teria about 20 samples first for a baseline ad like poor tools to those windows and then
render the scene and share in the discussions the difference it's made.
Pause video now and give that a go.
Okay guys welcome back.
Let's go add some portal's to our interior.
So I've made sure my camera is in roughly the right position.
I managed to make it a little bit wonky and the first thing that I'm going to do is do the render.
But make sure the render settings are fair.
So let's just check the number of samples.
The number of samples is 50.
Let's drop it down to 20.
Go ahead and hit render the moment that's done.
Oh I haven't added my environmental lighting yet or remove the other lights from the scene.
I'll be back in a few moments.
There we go.
I've added an environmental light.
It's just going to be a white one for the moment and now I've added that I just can see how that renders
out looking pretty noisy at the moment.
Be interesting to see whether it makes a difference.
Once we add light portals and the reason why I say that is great cause there's a lot of gaps in the
in the in the building at the moment which may cause or may not cause some problems.
But there we go that's gives us a nice base level.
Now I'm going to go ahead and add portals to the rest of these.
Now I've got two choices.
In this particular case I could go in and light portals to the original mesh and then re append them
into the scene.
Or I could stretch one along this entire wall for instance and then the rest groups too.
In this case I am going to do that rather than modelling modifying the original having to reimport and
change over these bits.
Not going to do that at the moment.
And there we go so I've added several portals into my scene.
I think that's for future iterations I probably will make the poor tour with in the models themselves
so that I never have to redo this but for the sake of this particular model I've gone ahead and done
it anyway and I'm just going to go ahead and render the image so I've overwritten my original.
Which is pretty silly.
Okay so straightaway I can see that this particular render I inadvertently overwrote my first one for
comparison.
This one's taking as significantly less time.
I can see straight away it's quick of the rendering with the light portal took one minute twenty four.
And this was already on 24 seconds because it's counting up and it's an I don't know about the quality
though.
This is this is going to be one of these things where I am not sure whether the big holes in here are
letting enough light in any way that we won't see much of a difference.
But now it's rendered.
Let's go and have a look.
I'm going to make this as big as I possibly can for comparison so I look through the doorway here.
And this is with portals without.
With Okay I think in this particular instance portals aren't going to help us until I've got this roof
sealed in.
I can do a few checks to see whether that is the case but otherwise I think that's just not letting
or is letting enough light in already.
The camera is finding a light source and that's especially true at the moment because the camera is
facing these big gaps.
There is a lot of light that will naturally just bounce off of these floor bits etc and automatically
end up hitting this sky box in the background.
That's something to bear in mind the areas perhaps where that's not the case where it doesn't have a
great big hole in the wall may be slightly different so I'm going to move the camera down and just check
that hypothesis as well.
So I'm just rendering here with out at the light portals and then I'll enable them and compare.
And here's the final render with those light portals turned and was is finished.
I'll compare the two and see if my hypothesis that facing a giant light source any weighed with the
camera is going to mitigate most of the benefits of a light portal.
Okay so looking at the two I can quite comfortably say at this point I think enough light is entering
our scene that we don't particularly have a problem lighting it.
So with that in mind I'm glad any more light portals at the moment.
In my particular scene I think if I didn't have quite so many windows we might be able to see more of
an affect of this whole building didn't have this great big open archway at the top as well.
So I will keep the portals in mind for my particular model if it starts to get noisy I can start adding
them in later and I will start adding them into the actual pieces themselves.
So when I link for more highly detailed models in it will bring across the portal information as well.
I'd love to see your models did using light portals of make your scene less noisy.
Did it make no difference at all like it has done mine here.
Please post in discussions and I will see you guys in the next lecture.