Lighting Tutorial for UE4
This post will cover basic lighting knowledge and how to setup a solid start to an exterior lit scene. This method is heavily influenced by Jeremy Birn's book: “Digital Lighting and Rendering," and you'll get the most out of this tutorial if you're already a little comfortable in the editor. Lets get started!
Some Lighting Basics:
UE4’s Directional light mimics basic bitch sunlight and so covers the entire scene in light (don’t be fooled by the small icon!) as a result, it cannot be scaled. However, when you rotate this light it changes direction and mimics the position of the natural sun at different times of day. If you connect the light to the sky sphere and check “colors determined by sun position” you’ll see the sky change color (this overrides the “override settings” for the sky sphere) The directional light is also called the “sunlight” or “key light” and it is the star of your light setup.
UE4’s Skylight is the equivalent of a “fill light” in your light setup as it mimics the light that hits objects in your scene after it has bounced off like, the ground or whatever. It automatically takes the sky color. Without this, your shadows are absolute black.
UE4’s Lightmass importance volume is just there to make sure the light is where it needs to be. It’s important for rendering and doesn’t need to be touched.
Static, Stationary, or Moveable?
Static lights are the least expensive, but do not have dynamic shadows; if the player character walks by a static light, they’ll be affected by it but the light will not cast a shadow. This is fine for fill lights, where we may turn “cast shadows” off anyway, or for small detail lights on artificial light sources the player does not come into contact with.
Stationary lights have dynamic shadows, which means if the player walks by the game will show their shadow. These are more expensive than static but less than moveable.
Moveable lights are the most expensive and should only be used for hero objects that have moving lights, like a flying fireball. Try not to use them.
Setting up an Exterior Light Scene:
Starting with an empty level:
Add a Sky Sphere
Add Directional Light, rename “sunlight”
Click into skybox and connect it to the directional light. (details panel, “Directional light actor” )
Add a Skylight
Add a lightmass importance volume, scale to include whole scene
Add a post-process volume: scale to include whole scene (don’t just hit unbound because it’ll compute the post process info infinitely into space). Turn off auto-exposure: details panel, set min and max brightness to 1 (search for “exposure” or “brightness”)
Add another Directional light, name it “Spill light” and cut brightness/intensity in half. Turn off “casts shadows” for this light.
What’s with the “Spill light?” The spill light adds more dimensionality to the sunlight. In engine if you only have one directional light, everything in shadow is black even if it looks like the sun would be hitting it. To better sell the illusion that a real sun is lighting our space, we duplicate the sunlight and cut the brightness and disable shadows so we get the picture on the top instead of the bottom:
You can also accomplish this by messing with the shadow settings in the post process volume, but this is easier.
Ok so I’m done, right? Nope!
You’re going to want to mess with the lights so it matches whatever style you're going for. You can add a volumentric fog and point lights to your scene as needed, and you can disconnect the "Sunlight" directional light if you want to directly edit the sky dome's colors. Below are some scenarios and best practices for coloring the light for a more natural look.
When you color a light, it colors every object it touches. So if you have a yellow sunlight and a blue skylight (bc your sky is blue) you should be fine bc that gives the illusion of white light, but if you go and crank up all the lights to be red or blue, everything will be red or blue.
Build lighting (and save) often! Build after every change you make so you know exactly what effect it’ll have on the scene.
Your shadows should never be straight black. The player still needs to be able to see the environment.
If you have an artificial light source that doesn’t emit light on its own, add a point light to it.
Point lights are spheres of light. The scale of the light changes what the sphere illuminates, not the brightness.
Make sure your lighting looks good after building but before messing with the post process volume.
Here are some starter suggestions to create more realistic lighting scenarios:
If its daytime:
Yellow sunlight, same color for spill light, blue sky for skylight
If it’s sunset:
Yellow sunlight, orange spill light, orange/yellow sky for skylight
If it’s nighttime:
And there’s not a lot of artificial light sources:
Yellow moonlight, blue sky for skylight
And there is a lot of artificial light sources:
Blue moonlight, yellow/orange artificial lights, blue sky for skylight
Comments
Post a Comment