A Valve engineer fixed 3D lighting so hard he had to tell all the graphics card manufacturers their math was wrong, and the reaction was: 'I hate you'

A custom wrapped Nvidia RTX 4080 graphics card with Half-Life 2 logo and Gordon Freeman.
(Image credit: Nvidia)

The PC gaming icon that is Half-Life 2 recently celebrated its 20th anniversary, and Valve pulled out all the stops with a major new update integrating the game with its episodes and adding a commentary track. The studio also released a two-hour documentary about the making of the game and what was going on at Valve during its development, which is absolutely crammed with fascinating digressions about the challenge it set itself. And one of them was lighting.

The development of Half-Life 2 was rooted in what multiple staff describe as "the tech wishlist", which would take six years to fully realise and was absolutely foundational to what Valve wanted to achieve with the game.

"[It] was a main feature that the light felt very, very realistic and intuitive because of the Source engine and the work, the collaboration between artists and engineers," says Half-Life 2's lead artist Viktor Antonov, before introducing our hero. "Ken Birdwell, he was a fan about photography and getting the lighting right."

Ken Birdwell was one of the earliest hires at Valve (he left the company in 2016) and, like pretty much every Valve employee, wore multiple hats over his time there: But he can fairly be described as an extraordinarily talented computer engineer. The now-defunct Half-Life website had a potted biography of Birdwell that listed some of his projects: "in-circuit emulators (CodeTap), 3D surface reconstruction (Surfgen), 3D prosthetics design tools (Shapemaker), and satellite networking (Microsoft's Broadcast PC). He also wrote one of the first graphical shells for multiplayer online games for Compuserve's Sniper."

Antonov actually undersells the photography angle. Birdwell worked for TeleCalc (a B2B software company) in the 1980s, and clearly saved up enough cash to pursue his passions after leaving: From 1990-94 he studied painting, photography, and animation at Evergreen State University, and was awarded a Bachelor of the Fine Arts degree. Getting back to Valve and Half-Life, this saw him primarily working on the first game's animations and AI (as well as having the idea for the G-Man). When Half-Life 2 rolled around, there was probably no-one in the world more suited to pursue the cutting edge lighting Valve was after. Sure enough, he immediately noticed a problem.

"The math that we were using was wrong," says Birdwell. "And not only that, the math that everybody was using was wrong. And then as I started to correct it I realised just how bad it was… and then I fixed it and suddenly everything looked great!

"I had to go tell the hardware guys, the people who made hardware accelerators, that fundamentally the math was wrong on their cards. That took about two-and-a-half years. I could not convince the guys, finally we hired Gary McTaggart [from 3DFX] and Charlie Brown and those guys had enough pull and enough… I have a fine arts major, nobody's gonna listen to me."

Half-Life 2: 20th Anniversary Documentary - YouTube Half-Life 2: 20th Anniversary Documentary - YouTube
Watch On

Let's just pause on that aside. Birdwell smiles while delivering the last line, which we'll allow because this guy fixed the math being used for lighting so hard that the manufacturers of graphics cards had to change their math. I found this thought too fascinating to leave alone, and sought out Birdwell to ask if he could expand a little.

"It's a bit technical," begins Birdwell, "but the simple version is that graphics cards at the time always stored RGB textures and even displayed everything as non linear intensities, meaning that an 8 bit RGB value of 128 encodes a pixel that's about 22% as bright as a value of 255, but the graphics hardware was doing lighting calculations as though everything was linear.

"The net result was that lighting always looked off. If you were trying to shade something that was curved, the dimming due to the surface angle aiming away from the light source would get darker way too quickly. Just like the example above, something that was supposed to end up looking 50% as bright as full intensity ended up looking only 22% as bright on the display. It looked very unnatural, instead of a nice curve everything was shaded way too extreme, rounded shapes looked oddly exaggerated and there wasn’t any way to get things to work in the general case."

Birdwell says this remains "a super common graphics mistake" and even today certain areas of programming require the coder "to keep in mind that all the bitmap values are probably nonlinear, you can’t just add them together or blend them or mix them with linear calculations without considering what 'gamma space' you're working in."

The good news is that "modern graphics cards know all this now," and at runtime automatically convert any non-linear formats "into a nicely behaved linear floating point value inside the graphics card before the math happens, so it's way easier. But that's now."

The reason it is that way now is probably a fine arts major.

"All through the '90s up to maybe the early 2010s it wasn't the case," says Birdwell. "You had to be super aware of what 'gamma space' you were in at each step of the process or things would look super weird.

"The problem was, when I pointed this out to the graphics hardware manufacturers in '99 and early 2000s, I hit the 'you've just pointed out that my chips are fundamentally broken until we design brand new silicon, I hate you' reaction. That wasn't a fun conversation. It went through the stages of denial, anger, bargaining, etcetera, all in rapid succession with each new manufacturer.

"I was very happy to pass off those conversations to the newly hired HL2 graphics programmers Gary McTaggert and Charlie Brown, who worked through it all step by painful step over the years."

While trying to get in touch with Birdwell I found an unrelated patent granted to Valve in 2007 on which he's listed as the inventor. Patent #20070195090 is for "Determining Illumination of Models Using an Ambient Framing Abstractions" and summarises itself as "a system and method for determining light illumination on a model in a virtual environment." It goes into great detail about Birdwell's exact innovation and, even if this isn't anything to do with what he's describing above, it's clear the man is some sort of god of videogame lighting.

Producer Bill Van Buren says elsewhere in the documentary that there were three key principles to Half-Life 2 and the lighting was part of the first. "To make something that was immersive," says Van Buren, "visually really rich and appealing, something more like you would see in a film, and the art direction and the tech to make that happen."

Valve certainly achieved that: Half-Life 2 still looks amazing today. And there are many, many people responsible for that achievement. But Ken Birdwell is why the lighting looks so good, and he did such an outstanding job that you can probably argue every game since has benefitted from it: Or, to put it another way, our graphics cards certainly have.

TOPICS
Rich Stanton
Senior Editor

Rich is a games journalist with 15 years' experience, beginning his career on Edge magazine before working for a wide range of outlets, including Ars Technica, Eurogamer, GamesRadar+, Gamespot, the Guardian, IGN, the New Statesman, Polygon, and Vice. He was the editor of Kotaku UK, the UK arm of Kotaku, for three years before joining PC Gamer. He is the author of a Brief History of Video Games, a full history of the medium, which the Midwest Book Review described as "[a] must-read for serious minded game historians and curious video game connoisseurs alike."

Read more
Crytek went so overboard on the Crysis tech it created a whole blushing system, implemented nose shadows, and sent devs to photograph leaves in Haiti to get the translucency right: 'We went over bonkers on this one'
Screenshots from Half-Life 2 RTX, showing the various new effects delivered by full ray tracing and enhanced assets.
I just played Half-Life 2 RTX, a fully ray-traced overhaul of the original, and its meaty headcrabs have me hankering for more
Jen-Hsun Huang, president and chief executive officer of Nvidia Corp., holds up the new Nvidia GeForce RTX 2060 graphics processor during the company's event at the 2019 Consumer Electronics Show (CES) in Las Vegas, Nevada, U.S., on Sunday, Jan. 6, 2019.
'Put them on the slides': How Jensen Huang invented and then announced Nvidia's DLSS AI upscaling tech in just two weeks
Doomslayer pointing a gun at demons while giants fight in the background
Ray tracing is quickly becoming inescapable and I think it's time we bit the bullet and embraced it
A retro-futuristic robot does his rounds in WolfEye Studio's next game, a cannon of some sort grafted to his arm.
Raf Colantonio can’t stop making first-person immersive sims: 'Weird West was a sidestep'
Collage of images to represent Nvidia's RTX AI PCs
I'll say it: The best thing I saw from Nvidia at CES wasn't its sweet new GPUs, but some tasty AI every RTX gamer can enjoy
Latest in FPS
Rainbow Six Siege year 9 season 2 key art - two Rainbow Six Siege operators facing each other
'Siege 2 was never on the table': Rainbow Six Siege X director explains why the 10-year-old FPS doesn't need a sequel
rainbow six siege sledge
After holding out for 10 years, Rainbow Six Siege is finally going free-to-play (kind of)
rainbow six siege x dual front mode
Rainbow Six Siege is getting its first permanent mode in 10 years, and it throws every Siege rule out the window
Fragpunk characters with weapon drawn
The latest big game on Steam is Fragpunk, or as I like to call it, 'kitchen-sink Counter-Strike'
spectre divide
Spectre Divide and its studio are shutting down after just six months: 'The industry is in a tough spot right now'
Masked Counter-Terrorist in helmet in forefront with sunglasses and beret-wearing CT in background touching headset
There's hope yet for Classic Offensive after its Steam rejection: The team behind the Counter-Strike 1.6 revival mod is in touch with Valve about its 'concerns'
Latest in News
Erenshor - A player and two simulated MMO party members stand on a plateau in front of a yellow landscape
This RuneScape-looking 'simulated MMORPG' has all the nostalgia without the drama because all the other 'players' are NPCs
Pirate Bay co-founder Carl Lundstrom
Pirate Bay co-founder and far-right politician found dead after plane crash
Sunset in the desert in Hello Sunshine
Hello Sunshine is a desert survival sandbox where you live in the literal shadow of the colossus
Roblox CEO David Baszucki.
'Don't let your kids be on Roblox', Roblox CEO tells parents, before comparing himself to Walt Disney and declaring the platform 'the future of communication'
Titus in Warhammer 40,000: Space Marine 3 reveal promo image
Praise be to the Omnissiah! Warhammer 40,000: Space Marine 3 is officially in development
Jensen Huang, co-founder and chief executive officer of Nvidia Corp., speaks while holding the company's new GeForce RTX 50 series graphics cards and a Thor Blackwell robotics processor during the 2025 CES event in Las Vegas, Nevada, US, on Monday, Jan. 6, 2025. Huang announced a raft of new chips, software and services, aiming to stay at the forefront of artificial intelligence computing. Photographer: Bridget Bennett/Bloomberg via Getty Images
Group allegedly trying to smuggle Nvidia Blackwell chips stare down bail set at over $1 million