Gamma corrected color or linear color workflow?

I’m starting up on pre-production on a new project. One of the things I’ve been asked to do is explore/expand on the HDR rendering we did for Red Faction: Guerrilla. In RF:G we had an HDR renderer, but still used SDR source imagery. This caused some problems later in the dev cycle as we tried to color balance and light adjust the game because:
the source images were not HDR (only problematic on some materials), the source images were not lighting color neutral (some assumed light color was apparent in the diffuse maps), and, the source images were authored and saved in 2.2 gamma corrected space.

The first problem was only a problem on certain texture types, like the skydome and reflection maps. We’re thinking of solving that this time around by using HDR imagery for some, but not all, of our textures. The second issue can be handled easily with artist training and communication. The third issue is a big ball of suck that ate up multiple months of my life last year as we were trying to strap an HDR renderer on top of a bunch of already authored gamma corrected textures, and then hoping we could easily color balance all of it. While we are happy with what we have achieved, the process was painful and clunkly.

This time around I was wondering if it would be better to force the artists to work in linear color space in Photoshop. Has anyone else tried a linear color space workflow on a game? If so, would you be willing to share successes and failures you experienced, please?

You’ll definitely need a LOT of diskspace, because all the images need to be stored as 16 bit RGB - to lose no color information, everytime you apply or remove the 2.2 gamma.

Edit:

Err… I mean I never heard anyone working in linear in game production.Although it is make sense if you develop a multiplatform game (pc/console) because of the different gammas.

I know of a few games that did go with 16 bit source images and were pretty successful at making it look good in the environment. Also one that used linear color spacing. The trick for the HDR ones was using Photoshop CS3 to work on the data.

And working with color neutral textures is tricky because most artist aren’t used to not baking light into their textures. You need a way to display only textures and only lighting separate in the game so they can see how lighting is the one that should be responsible for lighting =)

Linear color space also requires monitors to be calibrated, and shaders modified to gamma correct the textures before they get multiplied together and then gamma correct the output if I’m not mistaken. We rounded gamma to 2.0 for math’s sake.

Hope that helps, let me know if you have any questions, I’ll try to navigate the NDAs as well as I can =)

We got the game engine stuff (different platform gammas, converting textures to linear space so shader math is right, etc…) down on RF:G. The biggest hangup was taking our gamma curved textures and going through this backwards process of removing the gamma and then putting it back on in different forms (2.2 for PS3 and PC, ugly 4 part approximated curve for 360) just because the hardware was mulitplying all incoming textures by 1/<hardware’s gamma curve> to force the textures into linear space. I want to avoid any unnecessary machine mungine of the texture color space if at all possible. This is driving the idea of having artists work in linear space.

Calibration of monitors isn’t an issue for us, we do that as a matter of course anyway. My big hurdle now is finding a way to get the linear color space profile and settings out across the organization and ensuring that Photoshop is set to use those settings each time it is loaded. I really wish Photoshop was as easily managed by script as Max and Maya are.

Photoshop has COM object and Javascript functionality so you might be able to do some stuff with it.

You can use python to drive the COM object and Photoshop has a pretty robust javascript API, so you might want to look into that.

Can’t you change the hardware gamma curve to something constructive? I know we used to set the 360 to look like the PS3 with the hardware gamma correction

Photoshop actually has a full ide as well and has extremely powerful scripting. Do a search for extendscript toolkit. As mentioned above, it also has a com object.

Is anyone here actually authoring their textures in linear (1.0 Gamma) space?

I’m just curious…

All what’s left of the artist in me ran away when I was trying to do that. Gave up pretty quick. We’re not going to do that anytime soon I hope, no matter what the real graphics programmers say. :slight_smile:

SamiV.

(Well, I asked some of the real artists in the company and they said gamma doesn’t really matter, they’ll just compensate based on the media…)

Gamma matters when you’re doing real time lighting, it doesn’t matter TOOOOOOO much, but if you’re doing stuff where the color needs to be dead on it matters, the main place I heard it helped was in NASCAR where the cars needed to be a specific tone of orange.

Note that the orange is shifting colors to a red with lighting

Here the colors are a lot more even.

It’s subtle but it’s there

I hate Gamma and all things related.
I’ve pretty much given up on monitor calibration, all TVs look different. Then if your working on multi-platform and then HDMI or compnent look different.

Do you have gamma correction happening in shaders? Or when you render to your final screen buffer?

Shaders, you need a 16 bit buffer if you want to do it on the final screen buffer and not get any artifacting

We’ve decided to try some tests with authoring textures in linear space. But, the thinking is that we will continue to author in gamma 2.2 and deal with all of the various reapplications/removals we need to get the gamma appropriate for each console. The benefit linear space gives us in not having to do those gymnastics is outweighed by the biased color space gamma 2.2 provides–so that color fidelity is allocated appropriately relative to what the human eye can perceive. Linear color wastes to much bandwidth in the higher brightness levels, where we can’t perceive much difference between colors anyway.

This thread is pretty old but I thought I’d throw in some more info since there is still a lot of mystery surrounding gamma correctness.

sRGB textures pack a lot more precision into dark colors, for this reason alone you should have your artists create content in sRGB and not linear. Creating sRGB source textures does require you to do the extra step of making per-platform textures (360 textures need to be converted to linear and then converted to PWL approximation), but this is something a build machine can easily handle, plus it gives you per-platform control over textures (DXN for PS3, DXT5-swizzle for 360) while still having a single source-texture to edit (yay!). Having artists work in linear also makes the pipeline much more confusing, you need photoshop to be set up properly on every artist’s machine, plus you’re going to get a ripple effect where things look wrong in other DCC apps that aren’t set to linear.

The worst part about gamma correct pipeline is that depending on the type of asset it is, a texture/color may or may not need to be converted into linear space. Diffuse textures and most material colors should definitely be converted, normal maps and “color vectors” should definitely not be converted. It is much more “murky” when trying to decide how to treat things like specular masks/color, ambient occlusion, vertex colors (depending on use), mod2x colors. Be careful!

There are several presentations on gamma correct pipelines that go into great detail about the various issues, I’d recommend reading them before considering any changes to gamma correct pipeline, as the “rabbit hole” is deep and needs to be fully understood before trying to fix.

Valve’s 2008 GDC paper describes the problem with gamma-incorrect pipelines very concisely, it’s a great overview of Gamma Correction. Post Processing In the Orange Box: http://www.valvesoftware.com/publications/2008/GDC2008_PostProcessingInTheOrangeBox.pdf

Microsoft’s GameFest 2007 course goes into more detail about what Gamma actually is and why its important (brings detail back into your shadows). Picture Perfect - Gamma Through the Rendering Pipeline: http://download.microsoft.com/download/b/5/5/b55d67ff-f1cb-4174-836a-bbf8f84fb7e1/Picture%20Perfect%20-%20Gamma%20Through%20the%20Rendering%20Pipeline.zip

Naughty Dog’s GDC 2010 presentation goes into lots of detail about actual implementation into HDR pipeline on PS3 and also covers a lot of photography/film concepts. Uncharted 2: HDR Lighting : http://filmicgames.com/Downloads/GDC_2010/Uncharted2-Hdr-Lighting.pptx

[edit. URL fail]