Clustered Update

major update

Portal 2: Community Edition · build 18504930 · published

On SteamNotes only · this build shipped before we watched the app

An Overhauled Lighting System


We have completely overhauled the Source Engine's lighting system to add a new level of depth and liveliness to the game's environments. With fully dynamic lights, better looking shaders, and new lighting effects, Portal 2: Community Edition (and mods built on it) have never looked better.

Watch on YouTube

You can also explore clustered in 360 degrees on our website!

For those with access to P2CE, the update can be accessed via the "clustered" beta branch.

What is Clustered?

Clustered rendering is a modern rendering algorithm that leverages GPU compute capabilities to efficiently render dynamic lights. This allows us to significantly upgrade the graphical fidelity of the game whilst maintaining support for relatively low-end hardware. Clustered also improves the performance and quality of the existing dynamic lighting entities within Source, such as projected textures and Quake-style dlights.

Clustered introduces 4 new modes for light entities:

  • Fully static, with no dynamic lighting
  • Baked direct and indirect, with dynamic specular shading
  • Baked indirect/bounce, with dynamic direct and specular shading
  • Fully dynamic, without indirect/bounce lighting

By default, all legacy light entities, such as light and light_spot, default to the “fully static” mode to match legacy behavior. For convenience, two new entities, light_rt and light_rt_spot, were added with “Baked direct and indirect” as the default lighting mode. Unmodified maps recompiled on the clustered branch should look the same as they did before.

Clustered lighting can be enabled on old maps using sv_enable_dynamic_legacy_lights.

Shader Improvements

We’ve modified a number of shaders to leverage the features of the new clustered lighting system. Under the old lighting system only models could receive dynamic lighting, and even that was limited to a maximum of 4 lights! With clustered, every brush, model and displacement can receive an arbitrary amount of dynamic lighting.

The great thing about clustered is that we don’t have to change the lighting model of our shaders; it’s still a forward renderer, just with more capabilities. This allows us to build on the existing look and feel of the game without needing to recreate assets or restyle maps.

Improved Portal Lighting

The legacy “dlight” system, originally built for Quake way back in the 90s, has been completely replaced by clustered lights. These were used sparingly in places where simplistic non-shadowed dynamic lights were desirable, such as for dynamic portal lighting. Surprisingly, these legacy dlights were actually quite expensive to render! Dlights update lightmaps on the fly on the CPU, leading to a performance penalty from needing to reupload the lightmap to the GPU every frame.

Clustered lights not only look better, but perform exceptionally well in comparison since the lighting is done entirely on the GPU.

Improved Testing Elements

Some testing elements, such as turrets and energy pellets, now optionally emit light!

Watch on YouTube

Improved Paint and Gel

We’ve overhauled the paint shader with support for dynamic lighting and shadows. This allows it to better react to the surrounding scene, unlike the stock paint shader, which relied on a hardcoded envmap for reflections and specular.

Improved Water

Water now receives direct and specular lighting from both clustered lights and the sun. All water types support this, but we find that lightmapped water (especially goo!) looks the best.

Watch on YouTube

Tooling Improvements

Clustered allows us to address some pain points with Source’s tooling, namely Hammer. Working with lights in Source has always been a chore, especially since the built-in lighting previews are either non-functional or completely inaccurate. This leads to a long and tedious cycle of tweaking lights, compiling, testing, tweaking, and so-on. To avoid this, we’re working on updating the Hammer lighting preview to leverage clustered, allowing you to view your lights in real-time in a semi-accurate manner. This feature is currently incomplete, but will be coming in a future update.

Watch on YouTube

Clustered Update · Portal 2: Community Edition build 18504930 · SteamPeaks