The results from the studio Tomb Raider environment with Dark Lights disabled. Tomb Raider environment with Dark Lights enabled. An environment without Fire Lights. An environment with Fire Lights.

[GDC WEEK] Casting a New Light on a Familiar Face: Light-Based Rendering in Tomb Raider

Now that the game is out and about, we’re eager to show fans some of the impressive technology under Tomb Raider’s hood. A handful of Crystal Dynamics’ staffers are out at GDC this week, presenting on Tomb Raider’s system design, tools, camera, and more. I’ve culled down their presentations into a slightly more digestible format to give you some insider information into making the game!

Up to the plate is Jason Lacroix, our Senior Rendering Engineer/resident rock climber, speaking to light-based rendering in Tomb Raider.

Light-based Rendering before Tomb Raider [2013]
As you may know, Tomb Raider utilizes a proprietary engine, aptly named the Crystal Engine. It’s been hard at work all through Legend, Anniversary, Underworld, and Guardian of Light. That being said, it’s evolved quite drastically since it first debuted. Despite this, the engine’s lighting systems only had the capability to take advantage of forward lighting and heavy use of light maps until this project.

Forward Lighting: This is a fairly traditional way of doing lighting. When rendering with this technique, light is calculated for each light source, and against each object it will affect. This is an inefficient way to do lighting as it results in many wasted calculations from overlapping pixels, and overlapping triangles.

Light Maps: Light maps are essentially lighting with textures. Light maps mean that the lights and shadows for an environment or object are preset into the textures. This makes it difficult to accurately feature dynamic or destructible environments. It’s not a very flexible system.

This approach was fine for Underworld, but needed to be refined for Tomb Raider due to a shift in internal workflow. This shift moved to modular asset creation with a tool called Horizon (more on Horizon in a different presentation!) that allowed for rapid iteration, increased content creation within a limited team size, and the ability to reuse assets. For example, many assets in the scavenger hub (such as a rusty sheet of tin) were combined in unique ways to make larger structures. These sorts of instanced assets aren’t great for laying out UVS or light maps.

UVs: UVs are texture coordinates. They tell you where in a texture to grab color information from when rendering a surface. 

The fact that much of Tomb Raider’s environments are also destructible or would later be set on fire caused some issues with continuing to use light maps.

The last argument against light maps related to the economy of space games operate on. We knew fairly early on that size constraints were tight, and that there would likely be a deficiency. Complex materials, textures, and a massive library of set pieces meant that there wouldn’t be enough room on disk, or memory, to integrate light maps.

Making a Case for Hybrid Lighting
So there was the problem. What was the solution? Deferred lighting seemed the obvious answer, but the art team wasn’t convinced that we’d get the same quality results by tossing light maps out the window. They needed to be sold on the idea. 

Deferred Lighting: With a deferred approach, the lighting is applied once per light source for the entire scene. It is a screen space operation (meaning applied to whatever the viewer sees), not an object-by-object operation. Since it’s “cheaper” we can then use more light sources. 

The team couldn’t move forward without a unified decision, so some convincing was in order. The rendering and technical art teams were positive that they could get great results with differed lighting. A studio-wide “Pepsi Challenge” was put in place. The two teams went head to head, with the studio serving as judge in blind tests. Each team had two weeks to complete work on the same level. One would use the deferred solution; one would take advantage of light mapping. The blind challenge put the deferred lighting as the clear winner, but there was still room for some of the other lighting solutions for specific scenarios.

Techniques & Features in our New Lighting Pipeline
As a result we ended up moving forward with a hybrid solution. Opaque objects would use deferred lighting through an accumulation buffer, and forward lighting would be implemented when dealing with translucent objects or complex materials such as hair or water. 

Accumulation Buffer: This is a texture to which lighting information is added for each deferred light rendered. The final accumulation buffer represents the lighting information for the frame. 

The system takes advantage of various light types (point, directional, spot, and so on) as well as complexities (universal, fill, player) and can even be edited in real time thanks to art-driven lighting stages.

For example, this lighting system allows the artist to control the intensity of light over time, by creating a curve to be applied over a specific duration. This allows for the ebb and flow of light on a surface when in close proximity to Lara’s torch. The system also allows for the application of a random offset to individual light instances, to ensure they don’t accidentally synchronize with each other.

Shadowing was another complex task for the team to tackle. The lighting system supports standard projections for spotlights, and up to four splits on directional lights. There is also what we call Texture Projection Modulation, that takes into account water caustics, cloud cover, tree shadows, and so on. Making the world feel alive and real in a wide array of circumstances isn’t easy.

Solving New Problems, Optimizations, and Enhancements
One of the tricks with having a deferred approach to lighting for opaque objects is that we lost the ability to mask (block) out lights for things like the player. The art team really wanted to be able to light the player separately from the rest of the environment, which necessitated creating player lights, most often used in cinematics.

Even with these new sets of tools, the team had a number of problems to solve, such as applying environmental effects in mass, wetness to materials, and making entire levels burn without changing the source art at all. This resulted in the creation of wet lights and fire lights. Wet lights give the illusion that water is cascading down the sides of geometry through specular reflections. Tiled normal maps are animated to control how hard it is raining, have cascades flow faster, and so on.

Specular Reflections: These are glossy highlights applied in a variety of scenarios, such as water, metallic surfaces or a character’s glasses.

Normal Maps: Normal maps are textures that provide detail for an object’s surface. The geometry of the object may be flat, but the normal map indicates what surfaces should look like raised, recessed, and so on. This is then picked up when lighting to properly shade the surface.

Jason concluded his presentation by diving into optimizations: how they keep the game running at 30-60 FPS by including linear world depth targets, light bounding volumes, low-res lights, and particle lighting optimizations.

I hope you’ve enjoyed this in-depth look into the lighting of Tomb Raider!