Our own Jim Chaney was joined onstage at Unite Europe by Kasper Storm Engelstoft, Graphics Programmer, Unity Technologies and Adam Simonar, Studio Director and Lead Level Designer, NVYVE Studios, to talk about how real-time global illumination powered by Enlighten in Unity 5 allowed him to overcome specific game design challenges and set the appropriate mood and style for PAMELA, a survival horror game coming soon for the PC.
Lighting plays an imperative role in telling a game’s story. It captures the players’ emotions and sets the atmosphere to astound, enthral or frighten them with luminous glows, coruscating lights or sinister shadows.
PAMELA by NVYVE is an upcoming open world survival game set in the utopian city of Eden. The game will feature day to night cycles that give the player unique survival challenges and objectives at each cycle as well as altering the entire feeling of Eden.
In order to capture the right theme for each setting, NVYVE place a high emphasis on lighting and embedded it as part of the level design process. Because the transitions from day to night serve a critical role in the gameplay and ambience for each scene, the changes had to be seamless.
Traditionally the process of modelling, bringing the data into Unity and testing the lighting is a time consuming back and forth process just to see how light fills and spills across the scene. Prior to Enlighten technology in Unity, artists would need to bake out the global illumination of a scene. This increased workflow significantly as lights would need to be baked each time a minor change was made – there was no real-time preview available. If each light required fifty iterations to achieve AAA quality (the average which the Geomerics artists expect for their demos), the build time seriously adds up.
Alternatively, should the game designers decide to include any elements of dynamism, for example player controlled lighting, they could position a myriad of direct lights. Doing so would cause a severe performance drain, as well as being laborious in development, making it impractical. Comprised of just four team members, this arduous process would pose as a significant set-back into designing the levels in the way originally envisaged, and further increase the teams’ workflow.
Enlighten in Unity 5 allows NVYVE to achieve dynamic global illumination without the need of “crazy hours and hours” of iteration cycles just to see how a scene reacts with small additions, like extra windows. This ability to instantly preview any changes is invaluable to such a small team.
In PAMELA, the majority of the areas are set indoors and lit by emissive materials and indirect skylight. The game’s city also features emissive conduits along the levels that shift between blue to orange from day to night. These conduits serve as a critical component of the story yet presented NVYVE with unique design challenges in building the game.
Enlighten is now fully integrated into Unity 5. With its ability to deliver dynamic area lights modeled as emissive surfaces, NVYVE is able to achieve spectacular effects without this performance cost. In fact, these dynamic emissive materials are essentially free. This opened up a lot of opportunity in terms of the way PAMELA lights their levels.
“Emissive lighting allows to achieve a beautiful result while saving a ton of time and performance over using hundreds of real time lights throughout the environment. It’s an incredibly powerful feature and I recommend everyone make use of it if you can incorporate it into your art style.” said Adam.
Player controlled lighting
In order to further immerse the player in the game, PAMELA players control the lighting and manage the power in the city to keep the lights on at night and in darkened areas like maintenance tunnels. This lighting can be toggled to different emergency modes at both day and night; hence many possible lighting configurations need to be supported with the global illumination updated accordingly to achieve the correct, soft fall of light. Once again, Enlighten’s support for emissive materials enabled the desired lighting effects to be achieved at a very low performance.
Adam’s Top Workflow Tips:
• Set a logical resolution that is realistic to your game.
The resolution is directly related to precompute time, final quality and performance cost. Therefore, you want to be working at a resolution that is appropriate to your game type. An open world or large scale MMO for example, will simply not use a resolution of 10 pixels per meter, so don’t even go there. High resolutions can look great and precompute quickly in extremely small scenes, like an apartment walkthrough, but will quickly become unmanageable in anything beyond this.
• Determine the static geometry early.
As a general rule, consider what benefit you are going to get by setting an object as static. You need to determine early what geometry is going to be static when bringing it into Unity versus what is going to use light probes. If you need something to emit light into your scene, it is probably worth including as static even if it may be physically small. If an object is smaller than a meter or two, it is almost never worth setting as static as the precompute time will be sluggish and it will also probably not contribute much to a scene’s GI unless you’re using a high resolution.
• Try to only set large significant architecture elements as static.
Floors, walls, ceilings, etc., will have the most important effect on the GI in your scene. You must resist the urge to set everything as static, since the more static there is, the more precompute is required.
• Use a naming convention to attach to all the static objects (e.g. Filename_LMS).
This is to quickly set or filter through your static objects and eliminate any guessing in level geometry when you receive them from your artists.
• Emissive objects that need to be updated in real time should be kept as a separate mesh.
For example, if modelling a television, separate the back metal plate mesh from the front emissive mesh. This vastly reduces performance cost as you’re simply updating a flat emissive colour, rather than recalculating all the texture inputs.
• Use fast emissive API calls (DynamicGI.SetEmissive rather than DynamicGI.UpdateMaterials) for better performance.
SetEmissive will use the CPU to copy a flat colour into the emissive buffer, instead of drawing into the lightmap using the GPU i.e., avoiding sampling every single texture.
• View the lighting in multiple visualisation modes.
Different visualization modes allow you to see how Enlighten interacts with your scene and how it is affecting your textures and lighting in more specific detail. As the final frame is often cluttered with detail, the following modes are great to filter through the data and view what Enlighten is doing in each scene.
- Albedo filters through the noisy detailed textures to allow a basic look into what the GI would look like.
- Emissive is similar to Albedo, yet gives an approximation on the lighting emissions that should be happening.
- Irradiance – Adam’s personal favourite – takes all the indirect lighting from direct light and emissive surfaces and distils exactly what Enlighten is doing, previewing how the light from different sources interact with each other and what effects are cast on the scene.
Click here to watch the trailer and learn more about PAMELA.
Watch the full talk below to find out how global illumination works: