An Introduction to Dynamic Real-Time Lighting
A full breakdown of dynamic lighting experiments in Unreal Engine. Sharing a complete walkthrough, with recommendations for those looking to get into lighting. (Download to the project/survey included)
Included in this download:
Examples of day and night scenes.
Basic_Setup level: Final level with default settings, ready for you to play with.
Basic_Blockout: The blockout of the level, ready for you to play with.
All I ask is that you fill in the survey which lets me know how helpful my tutorial has been and what could be improved in the future. The findings from this will be used as part of my University final year project.
Hi, my name is Joe Taylor and I'm currently finishing my final year of Computer Games Design BA(Hons) at The University of Huddersfield (UK). I began learning 3D a few years ago at the start of my course, now I am specialising in environment art with an interest in lighting. I have been conducting several experiments in Unreal Engine to discover fast ways to achieve promising results with both dynamic and baked lighting. I was also looking to further my ability to create interesting composition in a scene, with the intention of improving my skills and become a junior lighting/environment artist in the games industry once I finish University.
Some experiments I've done . Top 2 are baked, bottom 2 are using dynamic lighting.
This tutorial will be focused around dynamic lighting. I will be covering how to set up the lighting, cameras, post-process as well as breaking down how I have composed the scene. I have provided a download link for the project below. I recommend that you download it and follow along to the tutorial before using this process to create your own work.
It's up to you how you wish to follow the tutorial. I have provided the blockout level and the complete level with the finished composition of assets. Feel free to have a go lighting both. I've also included an example of Day and Night scenes which I will go over how to create towards the end of the article.
1. Blockout and camera set-up
When working on a project, typically you would collect reference first and then blockout a scene using cubes or simple geometry. In this case I chose to use cubes as it does the job. Avoid being a perfectionist at this stage, aim to get an interesting composition. I created a few grey materials so that I could easily define the importance of the objects in the scene and where I wanted the viewer to look.
It is important to think about how to guide the viewers eye towards your focal point. Think about where the focal point of the shot is and try to make sure that it's clear from the angles you have.
I recommend that you drag a few "cine camera actor's" into the scene early on, switch to the cameras in the viewport like I have below or right click on a camera and click pilot. This will allow you to control the camera and move around the scene as the camera. You should position it where you want and then switch to the next camera in the viewport settings like before, do this until you have as many camera angles as you'd like. I'd recommend doing at least 3 before moving onto the next stage. I have provided you with the cameras I used for project in all levels.
2. Post-process set-up
Before we can start tweaking values it is important to make sure that we have all of the basic elements and that they're set to fairly flat values. This will prevent anything from interfering with the image.
The settings I use here will allow you to stop any form of auto exposure and make the ambient occlusion more prominent. These settings can all be tweaked again at the end of the project to match the environment better, once all of the lighting has been done.
Add a Post-Process Volume anywhere in the scene, either scale the cube to cover your scene or select infinite extent in the post-process settings before adjusting any values, or you won't be able to see them. As with all of the settings I suggest, they should be used as a rough guide and may vary based on your own projects.
As long as the min and max values for the exposure are the same, then it will stop it interfering with the image and adjusting the exposure automatically as you move the camera around. I have found that having the Ambient Occlusion intensity between 0.4-0.8 and the radius between 30-100 typically looks better than the default settings in Unreal. I recommend playing with these values and setting them to your liking.
3. Directional Light
The directional light can be used hand in hand with the sky sphere to sell a believable time of day. It can also be important to use the light and shadow to make the viewer look at a particular object or area of the environment like I have here.
I chose this angle as it will bring out some of the details out in the steps and stone walls when they have PBR materials applied to them. Having the light come from a side angle in this scene will also allow the floor to have shadows from the foliage which I plan to put along the sides leading towards the focal point. The light being angled this way also adds highlighted edges to the pillars, they are the focal point so this works as it further draws your eye to them.
Add a directional light into the scene. As with any lights during this project you should set it to movable as we will be working with dynamic lights and not baking any of the lighting information. Adjust the intensity and rotation of the light until you achieve the look you want. I recommend using the temperature to adjust the colour of the light as it will use real world values rather than using the 'light colour' picker. There may be times you need to break this to achieve a look you want such as in a fantasy or sci-fi scene that may use values we don't have in real life.
4. Sky light
Adjusting the intensity of the sky light will help brighten/darken the scene and make the shadows of the directional light more or less harsh, depending on the look you're going for. If you increase the sky light intensity and decrease the intensity of the directional light the shadows will be less harsh.
Add a sky light into the scene, I recommend adjusting intensity of both the sky light and directional light until you get the shadows you're looking for. Then I would adjust the colour of the sky light slightly to match the colour of the directional light as this can help objects in the environment feel more grounded in the world they're in, it is important not to overdo the colour of the skylight or it will look as though everything has a coloured filter over it. Shadow casting can be disabled on the sky light as it is making no difference to the scene.
Add a reflection capture into the scene. Adjust the radius. and click recapture whenever you've made significant changes to the scene.
5. Focal point
Use point or spot lights to guide the viewers eye to the focal area to make it clear where they should be looking. Naturally we will look at the brightest or most colourful area of the image. Using contrasting colours and intensity of light is one of the best ways to catch the viewers eye immediately. As we are working with dynamic lighting it is important to think about performance cost when working with lighting. It is much cheaper to use spot lights than point lights so I would try to get the result you want with these if possible. For this scene we are only going to have a few lights so it's not an issue. Try to always link lights back to what could be a source of light in the scene, even if it is not completely accurate to real life it just needs to get the message across and be believable.
You should work using the temperature feature in Unreal rather than changing the colour of the light where possible, as it will be more accurate to real life. Often we make the light closer to white than it actually should be when we do it manually. When working with dynamic lights keep the attenuation radius as low as possible while aiming to still get the result you want. Avoid having the radius of multiple lights overlapping as this will have an affect on performance when using dynamic lights.
6. Asset composition
Lighting can often overlap with environment art. It can be very useful to know how PBR materials work and how to tweak them so that light can react to them correctly. It's also important to have an understanding of how to create strong composition in your work.
Foreground, midground and background
The key here is to make sure that the viewer looks at your focal prop/area, while positioning props that tell a story leading up to it. I ensured that the broken trees and pillars point towards the focal area. I also made sure to think about foreground, midground and background. The composition will be stronger if there is a clear distinction between them. You can separate these areas using contrasting lights or having areas where there is more or less light to add depth.
It is important to think about the image as a whole. Imagine you're taking a photograph and you want to get the perfect shot. You want the image to be purposely balanced or unbalanced. The areas I circled above felt like they were drawing attention away from the focal object, I added foliage and shadows to fill these areas. Often with composition it's a case of instinctively thinking 'what doesn't look right with this' and then acting upon it.
I have a path which leads directly to the focal point, the foliage leads down the side of the path and there are leading lines with the positioning of the props to point to the focal point.
7. Mood and Time of Day
Alternative Moods and Times of Day
You should now have everything set up. It's just a case of tweaking the colour, intensity and angle of the directional light, sky light and use fog to drastically change the different moods and times of day to match your reference/moodboard or whatever idea you have in your head while reading this article.
There are various ways to control the mood and time of day in a scene, such as to play with the contrast, light and dark areas, shadows, colour, fog and post-process, I'd recommend trying to break down how it looks in your reference and then try to replicate it.
Let's have a go creating some different moods and times of day in our scene.
(Both of these examples are provided in the project.)
I used the height of the sky sphere to sit the sit the sun just behind the focal point. I increased the brightness of the sun and the used a warm temperature for the directional light to really make the scene feel warm. For the sky light I used blue just to balance out the image and prevent it from being overly orange. I think this looked quite nice as it made the shadows a bit colder and added some extra contrast. If you can see the sun then it's important to make sure that the direction light is facing in the same direction for the shadows to make sense.
I brought the height of the sky sphere right down and adjusted the cloud opacity and star brightness to get a convincing night sky. I adjusted the temperature of the directional light to add the overall blue values to the scene. I also increased the volumetric scattering intensity to allow the light to make the fog a bit more prominent around the areas where there is light.
There are lots of different looks that fog can give your scene, however in most scenarios it is important not to overdo it.
One nice way you can get more realistic fog is to enable volumetric fog. This will allow the colour and intensity of your lights to pass through and affect the fog, producing a much more realistic and varied result. For a portfolio piece this could look really nice, for games it's a matter of whether you can afford to use it within your budget. However, with how easy it is to enable in Unreal it is worth enabling and then trying to recreate the result in a cheaper way if you can't afford to use it.
Here is an extreme example of the difference in results you can get from using fog with or without the volumetric option enabled:
8. Polish/Artistic pass.
Does it need to be 100% realistic?
No, the most important thing is to make sure that the story and mood/atmosphere is represented within the lighting. Making sure that the image is more visually pleasing will often require you to break the rules and not always stay true to how something is in real life. As long as the viewer can understand where the light is coming from and it makes sense then that is fine. If it can look better by breaking the rules, do it. Think of it as setting up a shot for a film, they often use artificial or controlled lighting because you can really control the end result and get the story or mood of the scene across.
Fake it to make it
This could be from using colour grading in the post process, to adding extra lights into the scene to create fake bounces. I would recommend this being the very final part of the work, ensuring that you don't need to add huge amounts of colour grading or an un-manageable number of lights to the scene. Aim to get the best results using the minimum lights and colour grading possible first, as it will make it easier to manage later.
Thank you for reading the article, I hope you've learned something from it. If you have any questions at all about the article feel free to message me on Twitter @JoeTaylorArt or email me: JoeTaylorArt@outlook.com. If you have a go yourself, feel free to share the results with me!
If you just read this article or you downloaded the project and followed along, It would be greatly appreciated if you could fill in the survey below, which lets me know how helpful my tutorial has been and what could be improved in the future. The findings from this will be used as part of my University final year project.