SurfaceFormat.HdrBlendable


If you ever tried to implement high dynamic range (HDR) rendering,  you probably noticed a few things:

  • HDR requires a rendertarget format with more than 8 bit precision
  • If you want to draw anything interesting, this format needs to support alpha blending
  • There is no consistently available format that meets these requirements 🙁

XNA Game Studio 4.0 introduces a new SurfaceFormat.HdrBlendable with the following characteristics:

  • Guaranteed to be supported for textures and rendertargets (but not the backbuffer) by all HiDef devices
  • Supports alpha blending
  • Floating point format with platform specific precision
    • RGB
      • At least 7 bits mantissa
      • At least 3 bits exponent
      • Range at least 0 to 31.875
      • Smallest nonzero value <= (1 / 512)
      • May or may not support NaN, Inf + denorms
    • Alpha
      • At least 2 bits
      • Range at least 0 to 1
  • When used with GetData or SetData, pixel values are encoded as HalfVector4
  • Only supports point sampling (no filtering)

On Xbox, this is implemented using an Xbox specific 7e3 (32 bits per pixel) EDRAM format. On Windows, it is implemented using HalfVector4.


Comments (9)

  1. Daemon says:

    *clap**clap**clap**clap*

  2. Al says:

    The more I read about XNA 4.0, to more excited I get about its release. Can't wait!

  3. jon watte says:

    Will the alpha blending on xbox be quantized to 4 levels of output, or done at high precision?

    When alpha blending into 1010102 int, there are only two intermediate levels of blend…

  4. ShawnHargreaves says:

    > When alpha blending into 1010102 int, there are only two intermediate levels of blend…

    Not in GS4…

    🙂

  5. Yay! Finally we get FP10!

  6. Eclectus says:

    >> When alpha blending into 1010102 int, there are only two intermediate levels of blend…

    > Not in GS4…

    > 🙂

    Very cool 🙂

  7. Shawn what about the phone , is there similar surface in the future

    Michael

  8. ShawnHargreaves says:

    > what about the phone , is there similar surface in the future

    HdrBlendable (and in fact all floating point formats) are a HiDef feature, not supported in Reach.

  9. Burton Radons says:

    Thanks, Shawn! I'll copy this over to the SurfaceFormat documentation page, which is all "this is a thing used for a thing", which is great if you don't know what HDR stands for but that's about it. I dream of a day when MSDN can be used as the primary source for information about what something does. 😛