HDR, reproducing this in GL

Originally posted by Tzupy:
This looks MUCH better than Oblivion! I’d like to know how the three exposures were combined.
Photoshop CS2 has a “merge to HDR” option. There’s also a free app called PhotoMatix Basic that does the same (and better IMHO). What they do is simply reverse the exposure equation to compute the luminance in all pixels and then do a weighted average between the images. In the overexposed picture the darker regions is given higher weighting, and in the underexposed picture the brighter regions are given higher weighting. Summed together from a bunch of images (3 for normal scenes, maybe 5-7 for huge ranges) you get a good quality HDR image. Then the hard part is doing a reaonable tonemapping to get something that looks somewhat similar to how a human viewer would have seen the scene in real life.

We’re way off the original topic here.

Ok, if I would implement such HDR effect as in the first link I would do it like this:

  1. basic bloom / tone mapping - the standard way

  2. glare - apply additional filters to blurred image - these filters blur image in one direction only to create different glare patterns. Note that each color component can use different filter values to produce some spectral/scattering effect. You can also use circles instead of lines to create some extra glow.

  3. lens flare - apply additional filter to blurred image - each point samples at multiple positions along a line that croses this point and the center of screen - sample points placed further from center have smaller wieghts to make flares fade out if not looking towards light source.

@Humus: I appreciate your answer. So the intermediary results are tonemapped only for on-screen display, the final blended image is still HDR prior to tonemapping to standard range.
About a year ago I wrote a 256-shades to 6-shades conversion software, for industrial ink-jet printers, using error diffusion, that works well but loses some contrast. I wondered if this HDR technique could be used to compensate.

Yeah, I’m an addict… Couldn’t resist. :wink:
5 hours of work, and here it is:

It looks ugly comparing to that DirectX demo, but it works 3 times faster. And it’s poorly written - could run faster or look beter. Or both.
Cheers.

Edit: I just had to try it out with my game. Not very realistic but still interesting and a little magical:

I should probably thank V-man for inspiration :wink:

It looks ugly because you have things like trees and water. The link I gave just has spheres and no one can argue that look ugly. Shcmoove!
Well, the author has not responded yet :frowning:

Yes, I did mention it looks ugly :slight_smile: What else can you expect from such experiments? The key was to see if I can apply such large patterns to my filters. I’ll probably improve it in the future and maybe then i’ll use it somewhere.
For now, I just wanted to see if I can achieve something similar with similar framerate.

I’m applying these patterns on 4x downsampled and further blurred image. This allows to place pattern’s samples quite apart from each other and create large blurs with good framerate.

I came up with an idea of 3-4 pass jitter+blur. It would work something like this:
1st pass: sample 16 pixels apart +/-8 pixels jitter
2nd pass: sample 4 pixels apart +/-2 pixels jitter
3rd pass: sample 2 pixels apart - no jitter

Should give fast and strong blur. I’ll have to try it one day.

V-man, I emailed the author two years ago for additional information and didn’t get an answer…
Well, you can find a similar demo in the nvidia sdk
http://download.nvidia.com/developer/SDK/Individual_Samples/samples.html
named ‘HDR with 2x FP16 MRTs’. It uses DirectX but it shouldn’t be very difficult to convert it to OpenGL! The User Guide has some information about the way it is done.

Here you go:

Recovering High Dynamic Range Radiance Maps from Photographs

It’s not that primitive, I warned you :slight_smile:

v-man - check these ati-presentations out - probably quite similar but I don’t recall which one I saw :smiley:

http://www2.ati.com/developer/ScenePostProcessing.pps
http://ati.amd.com/developer/gdce/Oat-ScenePostprocessing.pdf
http://ati.amd.com/developer/gdc/GDC2003_ScenePostprocessing.pdf