The HDR conspiracy

Posted by Adventus on Nov. 30, 2006, 4:26 a.m.

+ Intro:

HDR seems to be the word of the moment (or acronym as the case may be)….. damn near every new game i see gushes with the magical HDR insignia. Yet, as with many fads, i have often discovered that many people really have no clue what it is. For this reason I seek to clear the air a bit…. and it also saves me having to explain or clarify it to every Expert proponing there next GM HDR product.

I should note that this is purely my own opinion, much of what is present here is quite debatable (and i would never claim to be well versed on the subject)…. so feel free to argue or completely disagree. In fact if you agree with everything your only sucking up XD.

+ The Technical:

The visible spectrum of light is quite extensive but our eyes are limited to seeing a small portion of it at any one time. The way our eyes manage to see this range is by focussing on only a small bit of the spectrum at any one time. For instance if light extended from 1-100 our eyes might only be seeing 1-10 or 50-60 at any one time.

Yea thats great but what does this mean for games?…. Well if you focussed on something bright then moved into a dark hallway your eyes would take some time to adjust, this is basically all that HDR is trying to replicate. Realistically it only occurs when you have something of huge intensity (ie the sun) which our eyes cant adapt to, or an intenisty shift occurs.

The point is that this extra range is still noticeable by the human eye, either as an extremely bright white light which consumes any obstructions or an equally dark area where you cant make anything out.

+ The usual render process:

1. Render HDR lighting to a floating point surface and apply to scene.

2. Determine the average brightness of the scene.

3. Use this value to decide on the range at which the entity's eyes are currently adjusted to. You usually take into account the previous value to make it shift smoothly.

4. Any thing brighter than this range is then usually bloomed (blur + add…. or what ever tickles your fancy). PS: bloom is not specific to HDR.

5. Clip the scene to bottom and upper boundaries of your range. Basically its reduced down to a 8 bit LDR (low dynamic range) image, since our moniters can only output a certain contrast range and the viewer's eyes will only notice a limited range anyway.

+ GM & HDR:

Quite simply…. real HDR isnt going to happen in GM6.1. At least not until we get access to floating point surfaces. These are surfaces which are not limited to the 8 bit int 0 - 255 range, instead they can be upwards of 64 bit aka the same (cough theoretical cough) precision as GMs variables. This precision allows us to truely represent light which extends further than we can focus on.

There are however some very dodgy ways of faking it. One involves using multiple surfaces with each representing a small bit of the range. I have not seen this method used, and its pretty much guranteed to be too slow in GM. There are huge practical and theoretical problems using this method.

Another is to simply using a contrasting blend mode (aka modulate 2x) like i did in L3S. This method unfortunately works at the cost of precision, so a 2x range has a 0.5x precision.

Another problem is determining the average luminance of the scene, doing 800x600 getpixel()'s just aint gonna happen. Although using some scaling and linear intepolation is a good way of approximating either way at some stage we'll need to use a getpixel().

+ Conclusion:

Make your own damn conclusion this is already too long. XD. But i will just reiterate that technically HDR is either impossible of impractical in GM…. Now i command thought to stop spinning your HDR riddles.

Cheers…. wow i think thats the longest yet, and there was more but that will have to wait till next time.

PS: THIS IS NOT HDR:

Comments

Adventus 17 years, 5 months ago

Quote:
Later on ill input the same thing into L3S's bloom, and ill bet we get the same effect.
There we go.

Me getting a very similar effect using L3S (im sure if i messed aound for a bit longer i would have got it perfect): Pic

And heres the source:Source

Bryan 17 years, 5 months ago

I know that it's not HDR. But it does look like it. It does check the luminance (just scale parts down until you got 32*24 pixels, and then scale those down).

Cheers