Gamma: 360 vs PS3


If you understand linear-space lighting, you have probably heard that the gamma is different on the 360 and PS3. By the way, Xenon is just another name for the Xbox 360, so if I say “the Xenon does this” then I’m referring to the Xbox 360. If you don’t know what linear-space lighting is, then you should check out my GDC talk. (-:

Anyways, we have to keep in mind that there are two key differences between the platforms. First, the gamma->linear and linear->gamma functions are different for texture reads and framebuffer writes. Also, the signal to the TV is different on the Xenon vs. PS3, but I’ll talk about that at the end. For reference, here are the functions for texture reads and framebuffer writes:

float XenonGammaToLinear(float val)
{
   float ret;
   if (val < 0)
      ret = 0;
   else if (val < 0.25f)
      ret = 0.25f * val;
   else if (val < 0.375f)
      ret = (1.0f/16.0f) + 0.5f*(val-0.25f);
   else if (val < 0.75f)
      ret = 0.125f + 1.0f*(val-0.375f);
   else if (val < 1.0f)
      ret = 0.5f + 2.0f*(val-0.75f);
   else
      ret = 1.0f;
   return ret;
}

float LinearToXenonGamma(float val)
{
   float ret;
   if (val < 0)
      ret = 0;
   else if (val < (1.0f/16.0f))
      ret = 4.0f * val;
   else if (val < (1.0f/8.0f))
      ret = (1.0f/4.0f) + 2.0f*(val-(1.0f/16.0f));
   else if (val < 0.5f)
      ret = 0.375f + 1.0f*(val-0.125f);
   else if (val < 1.0f)
      ret = 0.75f + 0.5f*(val-0.50f);
   else
      ret = 1.0f;
   return ret;
}

float LinearToSrgb(float val)
{
   float ret;
   if (val <= 0.0)
      ret = 0.0f;
   else if (val <= 0.0031308f)
      ret = 12.92f*val;
   else if (val <= 1.0f)
      ret = (pow(val, 0.41666)*1.055f)-0.055f;
   else
      ret = 1.0f;
   return ret;
}

float SrgbToLinear(float val)
{
   float ret;
   if (val <= 0.0f)
      ret = 0;
   else if (val <= 0.04045f)
      ret = val / 12.92f;
   else if (val <= 1.0f)
      ret = pow((val + 0.055f)/1.055f,2.4f);
   else
      ret = 1.0f;
   return ret;
}

First off, here is a default color checker image that I took from “HDR the Bungie Way”.

So that looks fine. Now let’s compare gamma 2.2 and sRGB. sRGB is what is on PS3 and most PC cards. For each square, I’ll apply a Gamma 2.2 to the left half and sRGB to the right half.

It looks pretty close. Blacks are a bit off but otherwise colors aren’t too bad. The most error is in the darkest square (lower-right). Now let’s compare Gamma 2.2 and Xenon Gamma. It’s a piecewise-linear curve with 4 segments. That’s why it is sometimes called the Xenon PWL Gamma curve.

Yikes! Those blacks are devastating. The more saturated colors are way too gray-ish. Why is this happening? Let’s check out the chart showing Gamma 2.2, sRGB, and Xenon.

You can see the high-res version here. The sRGB curve is very close to Gamma 2.2. And if you’d just look at this chart, you’d think that the Xenon curve is pretty good too. But now take a look at the bottom.

That’s why it’s so far off. While the top end doesn’t look too terrible, in the lower end, it is many times brighter. And don’t forget, our eyes have more precision in the blacks, so we’re really sensitive to this area of the curve. If you look at the formulas, you’ll see that at the low end of the curve, sRGB has a slope of 1.0/12.92 whereas Xenon Gamma has a slope of 1.0/4.0. That means that the blacks in your diffuse textures will be 3.23 (!) times brighter on 360 than PS3/PC.

Here’s the final comparison. Left is sRGB, right is Xenon. If you are using the gamma-correction hardware, and you aren’t doing anything special, then your PC/PS3 game’s textures look like the one the left and your Xenon sku’s textures look like the one on the right.

One final note. You’ll sometimes hear that the Xenon curve is supposed to match a 2.0 gamma curve instead of 2.2, but even then it’s pretty far off. Left is gamma 2.0, right is Xenon.

In general, I understand the argument that users have screwed up monitors, so it doesn’t make sense to go too crazy with fine tuning. But you have to draw the line somewhere. (-: One common alternative to using the Xenon hardware gamma curve is to use a 2.0 gamma curve (i.e. x*x). It doesn’t match sRGB exactly, but it’s way better than the Xenon gamma curve.

For reference, here are the images so that you can compare them for yourself.
Gamma 2.2
Gamma 2.0
sRGB
Xenon Gamma

As for the actual output curve to the TV, on Xenon, you can just call SetGammaRamp(). Look it up in the XDK. This is something I learned from Henry LaBounta, so he gets credit for it. The default curve has a bit of a toe in it, so if you are displaying a test pattern, your darks will be darker on the Xenon than PS3. Also, if you attach a waveform monitor to your Xenon, you’ll see that the NTSC-U, NTSC-J, and PAL curves are slightly different from each other as well.

One final thought. The gamma texture read hardware basically raises your blacks. But the output curve effectively lowers your blacks. So if you only fix one of them, it might look worse than before.

Happy Gamma!

7 Responses to “Gamma: 360 vs PS3”

  1. Well written blog. i learned from it :)


  2. Thanks!


  3. Is this why all Xbox games look darker and slightly more muddy than Ps3 versions?


  4. It depends on what you fix and don’t fix on the 360. If you fix the output curve, but not the texture read curve, then it looks too bright. If you fix the texture read curve but not the output curve, it’s too dark. If you don’t bother with gamma correction, and you don’t fix the output curve, then it’s too dark.

    Of course, if you are doing the “wrong” thing on 360, and your artists tweak for it, then the PS3 version will look “wrong”, even though the tech is more “correct”. Essentially, “right” and “wrong” are arbitrary.


  5. @Zombie,
    Bad question, you should ask
    “Is this why many multiplatform games on PS3 looks washed out?”
    And ‘muddy’ ? What ‘muddy’ on X360?
    Only muddy would be games that use quincux antyaliasing on PS3 – it blurs whole picture not only edges like MSAA do but also all textures details….


  6. Good stuff again John.

    What I’ve done in the past is to tune the output gamma curve using the old ‘alternating black-white stripes vs. 50% grey’ display. This at least removes one of the variables. If you do this on the same (already calibrated) TV for both PS3 and 360 then you’ll at least get something close to similar.

    Of course on the input side, for Xbox you should always use the PWL approximation when encoding your textures too.


  7. You already realize how that you have to replace weeklies plus books combined with einformation products. in a similar fashion, lower a wide range of units plus instead lug around one that offers as a multi function mobile, ipod, capsule, camera, plus portable. purchase these, never do lug around loads of the gown, foods, And/or paper.
    nike air max 2012 mens


Leave a Reply