HDR - What's it all about, anyway?

Discussion in 'Mapping Questions & Discussion' started by Pocket, Jul 11, 2012.

  1. Pocket

    aa Pocket func_croc

    Messages:
    4,489
    Positive Ratings:
    2,213
    After messing around with outdoor lighting stuff for the first time, I came to realize just how little I understand about HDR. I get the basics: It simulates the opening and closing of the human iris during the transition between light and dark environments, and it does so mainly by producing a second, "overexposed" set of lightmaps that it can use in dark lighting situations, and that it also needs a corresponding set of cubemaps.

    But there's a lot I still don't get. Like, what do tonemap controllers really do, and why do different maps need different values for theirs? And is there ever any reason to set the BrightnessHDR and AmbientHDR in the light_environment to anything other than the defaults?

    And those cubemaps. Whenever I build HDR cubemaps it shows each angle going from full-overexposure down to the normal LDR levels. Is it actually committing every frame of that animation to the disk for some reason, or is there some other, weirder reason for it?
     
  2. grazr

    aa grazr Old Man Mutant Ninja Turtle

    Messages:
    5,436
    Positive Ratings:
    3,557
    The way i understand it is the exposure is like a camera shutter that stays open longer in order to take in more light. The longer it's open (the max/min exposure values you set in the tonemap controller) the longer the exposure and brighter the reflection. Since when defining the value of HDR via the tonemap controller you're not specifying a single value, it's a range. Allowing a balance between varying lighting conditions in your map (for example outdoors/indoors being the most obvious reason to allow for high and low exposure variations within your single environment). Dark textures that don't reflect so much light will require a higher tonemap setting in order to get a more significant HDR response, so in dark maps such as those set at night you might up your max exposure value. Also, say if you change your maps theme from desert to alpine, which has higher reflection values in its nature textures you'll probably wanna reduce the max exposure value so that your map doesn't look like it's 10ft from the sun.


    I'm not sure on the exact translation but "1" seems to feel like a tenth of a second, if the amount of time the exposure is left on the screen for is anything to go by. But... that's just speculation.
     
    Last edited: Jul 12, 2012
  3. xzzy

    aa xzzy

    Messages:
    815
    Positive Ratings:
    393
    The name says it all.. "high dynamic range". It's an image format that records more levels of light than a computer monitor can reproduce. You know how a gif is limited to 256 colors and a jpeg can go up to millions of colors? HDR is like that, but for intensities of light. If full white is merely "bright", information beyond that would be "ow fuck I'm staring at the sun this hurts."

    Source engine games uses HDR images to simulate the effect of glare. Say you had a single pixel light source on a map and looked straight at it in game. With LDR lighting, that pixel would be white and no more. But if it's HDR and that pixel is "brighter than bright", the game simulates glare by making more pixels on your screen white.

    HDR images are produced by taking several images at different exposures and combining the information. That's why buildcubemaps on an HDR map looks like it's animating.. it's not. It's taking a dozen or so screenshots of the map with varying sensitivity to light to build information about how intense the lighting is.
     
  4. A Boojum Snark

    aa A Boojum Snark Toraipoddodezain Mazahabado

    Messages:
    4,769
    Positive Ratings:
    5,521
    HDR cubemaps do contain six or so exposure levels, because it would look incorrect if reflections didn't have the same exposure level as the real-time scene.
     
  5. Pocket

    aa Pocket func_croc

    Messages:
    4,489
    Positive Ratings:
    2,213
    That's what I don't get: If it can get away with just using two different levels of exposure for the lightmaps and blend between them in real time, why do the cubemaps have to pre-bake every level?
     
  6. xzzy

    aa xzzy

    Messages:
    815
    Positive Ratings:
    393
    I would guess it's an engine limitation or performance related decision. Like the cubemaps can't work with the code that blends textures. Or maybe the blending process is too expensive to do more than it already is.

    So they went for a simple system where the game just picks the closest matching cubemap image.