Okay, VR peoples, we're gonna do a video now that is all about lighting and I
think it's long overdue because I know that when you're coming from mark vis
understanding Unreal Engine can be difficult especially if you're just used
to 3ds Max and an offline renderer like v-ray and one of the biggest things that
you have to overcome is completely revamping your mindset when it comes to
lighting because the lighting works totally different in real-time than it
does in offline renders so I want to go over some of the theory of lighting in
Unreal Engine I want to go through some of the techniques the different kinds of
lights and how to wrap your head around light baking and understand what exactly
is going on and how to make it look good okay
so stay tuned for all of that what I've done so far is just make a basic scene
it's just a box I'm in the first person shooter template it's got a sphere
inside of it I use some of the new substance materials and applied it
there's a basic direct light out here in a skylight okay fantastic everything is
pretty straightforward so far we do have a light mass importance volume
encompassing this scene as well you may know that the direct light that comes
standard in the template is set to stationary so let's first talk about the
differences between stationary static and moveable lights if you hover over
them they'll tell you what they are static is fully baked lighting fastest
rendering obviously it's baked into the scene so when you do your build and you
build your lighting it is actually baking it on to this and none of it is
being computed in real time stationary is a hybrid it can't move but it allows
partially baked lighting and dynamic shadows follow or dynamic shadows from
movable objects okay so keep that in mind it's a bit of a hybrid and then
there's the movable light which can actually be totally dynamic and move
throughout your scene in real time whole scene dynamic shadows slowest rendering
obviously and it does not contribute to the light baked okay so what is the
light baked the light baked is where we you can think of it as your global
illumination if I put a light out here that is say this was static it would
calculate all the highlights it would even bounce
lighting calculate where the shadows will be where the highlights will be and
then it will map it on to these objects that is what light baking does so there
is global illumination going on but it's not happening in real time or baking it
in so when would you use these different kinds of lights well let's test them all
out first I'm gonna set the Sun to be static okay and then we're just gonna do
a basic light build will go to lighting quality preview and just build the
lighting what this is going to do is bake in all the global illumination and
the direct lighting from that static Sun coming through my little silent skylight
up here and lighting my scene so we'll see what kind of results we get
all right there we go so you can see the direct light coming in and you can see
that global illumination is happening because the rest of my scene is also lit
up I've got a cool reflection on this tile right here that's awesome you can
also see some shadowing going on underneath of the ball it's not very
high quality but that's because of settings it's also because my build
lighting quality was on preview so there's lots of different things that go
into that that is for another time right now but
there you go there's the baked lighting you can also see that in the corners
there's some ambient occlusion going off and that's kind of tricking our eyes a
little bit showing lighting that isn't actually there isn't being calculated by
the light baked so let's just turn that off for now go into project settings
ambient occlusion let's just turn it off entirely okay there you go
so there's our light baked without any ambient occlusion and you can see that
works pretty well actually I'm gonna turn off one other thing to the auto
exposure and what this does I mean we can obviously turn these back on later
we can also do them through our post-processing volume but right now I'm
turning them off so that we are getting rid of all the different variables that
can be going on here okay so you can see it's considerably darker here there is a
little bit of light in here but it's not very bright let's actually
turn up the Sun 15 one thing to keep in mind is this skylight up here you can
actually apply nhgri map to it right here and light your scene with an hgri
so that's cool of course that's probably something you're used to right let's
turn up the intensity of that - let's bake it again get some more light in
here okay now it's brighter boom we got the scene lit up a little bit in here
so without the exposure settings it's still working you can see there's a
little bit of shadow coming off this way that's because there's a bright
highlight right there casting a shadow so you can see there's global
illumination going on now the global illumination is not very high quality
that would be adjusted in your world settings here under light mass and it's
basically these five settings right here okay the most basic way to adjust this
would be to up the number of indirect lighting bounces okay that will make it
higher quality you can put it at ten you can put the skylight bounces do
something higher as well perhaps even ten and then the indirect lighting
quality you could put up to six this is very high settings and you can even
adjust these downward below one this one and this one to make even higher
settings but that will up your build times dramatically so this could be
considered sort of like your secondary bounce render settings your GI render
settings like if you were using v-ray okay they don't translate directly but
that's kind of the kind of quality that they're controlling okay so look up the
documentation on this and you'll see that going like a hundred bounces gives
you a very little difference from ten bounces but the difference between ten
bounces and one bounce is is very dramatic okay so you don't necessarily
want to just crank this and crank this higher and higher but this number the
indirect lighting quality will actually give you considerable about more quality
it also makes your build times go nuts so let's do this this well actually for
now let's just put this down pretty low okay
and we'll leave this at 1.5 because I'm just demonstrating here but the numbers
I had before could be used to get much higher quality stuff but I don't want to
wait for all these billed times well I'm just trying to demonstrate okay so
that's that let's build that one more time to look and see what it looks like
and here preview medium high production this is going to be also contribute to
how accurately it's calculating everything so you can see a choppy edge
on this shadow up here if you put this lighting quality too high or medium then
you might start seeing that go away I'll put it on medium and build okay that
didn't take too long at all you can see the shadows looking nicer
now obviously the corners are getting a little bit darker because the GI knows
that not as much light is getting into those corners anyway overall our
calculation is getting better you can see that this is a nice soft shadow
being cast here under that wall little sharper up on the top so that's all in
our quality settings okay so that's that I talked about that elsewhere in other
videos okay but I want to talk more about this stationary light we've got up
here or they sorry the static light okay that is static so everything's being
baked in what if this was an object that we were going to pick up in VR and move
around what would we do then well we change it to a movable object
and then we go down and say in the lighting okay if this is a movable
object then we don't want it being baking shadows onto the ground because
then when we pick it up there'll be a big black spot there that we don't want
let's just do that as an example actually it's already done it's baked in
if we moved it then that shadow would just remain there okay we don't actually
want that so what we do if that's gonna be a movable object we would make sure
that in the cast shadow settings it doesn't cast the static shadow but it
does cast a dynamic shadow okay now we could change this to a stationary light
which of course will bake some of the lighting but it will also cast dynamic
shadows okay so let's build that and see what it
looks like okay you can see that the star
lighting is not working on this anymore it's no longer casting any shadow down
here and it's not getting darker as it goes around this curve or anything like
that it looks kind of dramatically different but it is something that you
can pick up and notice what happens when you move the ball around and especially
if you moved it over to here into the shadow
voila look at that so that looks realistic when you pick it
up and move it around that's actually really cool so the stationary light
would be awesome in your scene if this is the kind of thing you want to
do if there's gonna be a movable object moving through that direct light that's
why the Sun by default is set to a stationary light so that it can do these
kind of things so if you have movable objects the
lighting still works ok so that's pretty cool actually that looks really good
however if you're in your scene and you want the Sun to move it would not work
that is not a movable light is only stationary and the other thing to
remember about stationary lights is you can only have so many of them what's the
number 6 where is it for I don't remember but you can only have so many
of them overlapping with each other if I took now a spotlight and put it into the
scene here made it stationary right and then I made some more stationary lights
now we're at 1 2 3 plus the Sun 4 overlapping v 1 gives me a red X ok so
that's because these these cone shapes are overlapping with each other you
can't have more than 4 of those cones on stationary lights overlapping with each
other okay so you have to keep that in mind you can address that by making the
cone smaller and then making the lights further apart or you can also change the
attenuation radius so that it doesn't go it doesn't influence as far away but as
long as these cones are intersecting with each other that counts as one light
and you can only have four of them that are stationary and overlapping like that
okay so that's another thing to keep in mind with moveable you'll have similar
problems and this will also slow down your potentially slow down your
real-time rendering dramatically if you have a bunch of fully dynamic lights but
if you wanted to animate the Sun then that's what you would need you knew you
need a movable light or if you want a light that turns on and off and those
kind of things completely dynamic right and it creates dynamic shadows it does
not figure into the bait lighting at all so that is the difference with that so
for arc vis I think we're probably using most of the time static or stationary
lights but we want might also want to use moveable especially if you have
interaction going on with those lights okay so this one will probably leave a
stationary as well we'll bake it one more time okay there you go all baked
this thing doesn't leave a big dark shadow there because that light is
stationary and the shadow remains dynamic and then when we come over here
you've got a dynamic shadow as well which is pretty cool looking actually
okay so that is the difference between a static fully baked light and stationary
lights / movable lights with dynamic shadows okay let's change this all back
to static for one last test that one's static and that guy static and this guy
light aesthetic we'll do one last test here we'll build it one more time see
what we get oh we forgot to do one thing so everything's baked but this thing is
not casting a static shadow so really it doesn't look right at all make sure to
turn that static shadow back on right there let's try that one more time then
you got to also make it static object try one more time okay so here you go
this is all baked lighting right so if I move this it's gonna look wrong right
away totally wrong and immediately it says lighting needs to be rebuilt
you can't move static objects okay that shadow will remain there
everything will look incorrect okay so when we're doing our quiz this might
actually be the way that we want to use it most of time if it's just a scene
that we're gonna walk through and nothing's gonna be moving around and
we're not gonna be interacting with things
everything can be static including the lights but if we're getting into VR and
we're gonna walk over here and pick this thing up or if there's anything dynamic
going on like okay I want to switch this ball out for a different ball or for a
different material or I want to move this ball over here then you have to
start thinking about what kind of lights you're gonna want to use what kind of
shadows you're gonna be one of using won't need to use okay so like I said if
you're seeing static you can do everything static you can bake crazy
complicated lighting schemes just bake it in and then nothing's calculated in
real time and everything will run smoothly okay so hopefully that helps
demystify some of the lighting techniques going on here helping you
understand the difference between baked vers dynamic lighting and how to get the
effects that we want now the only other thing I want to look at is some of these
optic optimization view modes right now we're in lit if we go to detail lighting
it'll show us just the lighting and you can see this here see this shadow here
how choppy it is and how choppy this shadow is some of that can be addressed
by doing a higher quality light build but really a lot of that is dependent on
another view mode here which is the light map density optimization View mode
light map density you can see that this is how dense our light maps are and of
course the light map is like like a shadow map and in 3ds max maybe but it's
basically a map that tells where the highlights and shadows are on each face
of each object individually that's why we do the UVW unwrapping so let's look
at this static mesh by double-clicking on it let's look at the UVs okay that's
not the right channel this is going to be our Channel it was automatically
created on import when I used data Smith to import you
can also automatically create that when the FBX import but you notice each face
needs its own unique space to have that light map applied to and then you have
to make sure that this UV channel is the one that's accepting the light map and
then you make sure that lighting resolution that light map resolution is
high enough so light map coordinate index is set to two which is the right
one it looks great everything's separated we could up this to 1024 and
save it and then when we're back in our mode now we're getting a really high
resolution on that thing red means high resolution and you can look and see how
big these squares are to know how much resolution there is and that should be
sufficient okay so that's a big way let's look back at our lighting okay
everything's gonna have to be rebuilt now
because we've changed the light mask settings the light map settings and they
should be higher quality now and let's go with a high quality build build the
lighting again we've got our light maps at the right resolution and let's see
what we get here it should be a pretty good result the only other thing we
would do after this is go back to those world settings I will show you and up
those settings really high which that will be our last final test I promise ok
so this looks pretty awesome getting some clean results down here we could
probably go even higher with the settings for this particular shadow here
higher light now setting or higher light map settings and then a higher quality
build we are getting some nice sharpness up here in this shadow and then softness
as it comes down overall this Lighting's looking pretty
great you can see that without ambient occlusion turned on at all you're still
getting dark corners and things like that so the global illumination is
working quite well so the last test we'll do the last and final test in this
video is just to up our settings so I'll just go with something that I've found
to work basically well and I'm not gonna claim that this is the best settings for
this all around but these have worked pretty well for me
now the time in the build is gonna go way up so I'll pause it and I'll build
it I'll show you the results okay here we go I cranked the settings up I even
went to lighting quality production level okay I exaggerated a little bit on
how long it was gonna make my render times because this is a simple scene so
it it's still built the light really quick but on a big scene with a ton of
lights and lots of light map resolution going on it can take a really long time
so keep that in mind but this is the kind of quality of lighting we can get
and this is still a little choppy down here the best way to address that would
be to turn off the light rat map resolution do something ridiculously
high on this object here and that would eventually take care of that okay so you
can see that the global illumination is actually pretty high quality right now
look at this corner up here you can see that the the bouncing of the light is
going quite well there's a nice crisp shadow right there that gets softer and
softer as it comes down the wall everything is quite realistic actually
okay as you can see the lighting looks pretty dang good here everything is nice
everything the light bounce is going very well so that's the kind of results
you can get if you can get away with making everything static you can get
actually get very photorealistic lighting going on inside Unreal Engine 4
and if you need things to be movable then you isolate those objects with the
proper lights that they need and the proper type of shadows they will not
look as realistic if they are interactive and they cannot do these
nice static shadows but they will remain fairly accurate and at least represent
shadows properly on your scene so hopefully that helps you guys out
transitioning from v-ray or Corona or some other offline rendering program
into real time rendering with Unreal Engine 4