I said in my last journal post that I was going to resurrect one of my old platform games. Had a look into that but, to be brutally honest, couldn't be bothered [lol]. Instead I decided to work on my "HDR Demo" code instead.
I've not had so much fun coding in a LONG time (refactoring F1CM to unicode doesn't even come close). You know that feeling when it "just works"? I had to tear myself away from the PC at around 2am.
A bit of background
I've probably written about it before in this journal, but ever since I set my eyes on the rthdribl demo (Check it out if you haven't already) I knew I had to get me some of that High Dynamic Range Imagery (HDRI) coolness. I'm also hoping to do my final year dissertation into using realtime HDR for scientific/visualization technology.
My "HDR Demo" codebase is something I've been working on for a while - basically bits and pieces inspired and "borrowed" from other samples. Last night I ripped a lot of it out, upgraded it to the August SDK framework and got it working a lot better than I had before.
Where is this going..
The theory behind an HDRI pipeline is pretty damn simple as far as advanced graphics go - whilst there are lots of things that need doing each individual step is relatively straight forward and simple to understand.
However the bit that took me the longest to figure out was how to actually implement all of the various steps. Every example I've read through has been a bit of a mess of functions, render target swapping and effect-file shading. My "HDR Demo" might not be quite as impressive, but the idea is to cut down on the fluff.
It was originally my own pet-project to help myself learn HDRI, but I'm starting to think it might well be of use to others.
I haven't got any code for you guys to try yet, but I've got a few images. Images are required for good journals [smile]
This is the display as it currently stands. Not too impressive I know...
I opted for creating an HDR image using the simplest possible means - that is the classic 3D spining cube. Except in this case, the vertex diffuse component is a packed HDR colour (later unpacked inside the shader), so the HDR render target does have some > 1.0f values in it.
This part is likely to change as I'm not too convinced that the conversion to HDR is working as I intended. I'm having to use some awkward tricks to get around (what appears to be) clamping and resolution limits for either my hardware or the API. Seems that the standard COLOR0 semantic is either clamping or very low resolution (lots of horrific mach bands). For the time being it's using a somewhat obscure packing into TEXCOORD0 and TEXCOORD1 - which don't have the resolution/clamping issue.
Note that in my image above, it's showing (bottom right) the 6 luminance maps that are generated for each frame. This is a crucial part - I want my demo to show each and every step in the rendering pipeline. It's the key to exposing the theory and implementation.
The above image is a simple template that I'm going to implement as a background to the rendered display. The path around the top-right is each successive iteration of the luminance calculations, finally feeding into the finally rendered image. Later on I'll add an additional path showing each step in creating a bloom filter.
This final image is a manual composite of the previous two, and what I'm hoping the final display will look a bit like. Each texture is specifically drawn over a part of the underlying diagram, and due to it all being real-time you can manipulate the main image and see how each corresponding step changes accordingly.
Next time on the path with a ramblin' man...
If this works out how I'm hoping then I'll release the full (highly commented) source code and demo sometime in mid september. Probably make it a post in the DirectX forums like I did with the F1 Car - see if Coder will make it a sticky [smile]
Leave me a comment for when I get back - not had many comments left lately ([headshake]), would be useful to know if people will find this useful or not!! [smile]
That's all for now, I'm gonna go pack up my bag and go to Spain [grin]
If I don't return, the locals beat me up because I can't speak spanish and they can't talk binary.