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

OL 17 years, 4 months ago

Thanks for clearing that up, I'm sick of people getting Bloom and HDR confused.

I've been working on GM HDR emulation for some time now, and I've come up with some interesting effects.

Misconstruct 17 years, 4 months ago

Okay, fine. Pft.

But I knew what HDR was.

@ OpticalLiam

Interesting effects? Hmm, like what?

OL 17 years, 4 months ago

Like HDR.

Bryan 17 years, 4 months ago

http://img153.imageshack.us/img153/3076/hdrishzt4.jpg

HDR-ish enough? It isn't true hdr, but it looks like it.

Misconstruct 17 years, 4 months ago

@ bryan

That's… obviously not real HDR (Even you said it. lol)… but it is freakin' sweet!

Bryan 17 years, 4 months ago

Don't look at the lights below, that was just a test…

Yay.

OL 17 years, 4 months ago

Looks pretty damn decent bryan. Now give me source code.

:D

aeron 17 years, 4 months ago

<fieldset><legend>quote</legend>Make your own damn conclusion!</fieldset>

^^LOL!

Nice writeup! In my opinion HDR is a waste of processing power and really doesn't help me in any way, in fact I find it quite annoying during a game. Although it would be cool to be one of the first to make a gm game with somewhat accurate HDR effects…

Adventus 17 years, 4 months ago

Quote:
HDR-ish enough? It isn't true hdr, but it looks like it.
Another Bloom filter. Probably The biggest component of HDR is making it shift based on the average luminance of the scene….. do that accurately and at a decent speed and ill be impressed.

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

takua108 17 years, 4 months ago

Excellent post. I've never really understood what it meant, and now I do [^^]