More HDR woes

I’m still spending an occasional minute on my HDR demo. Now, everything is fine so far, except one thing: I can’t get MSAA working on some Radeons (and I don’t have a Radeon right now, which makes debugging a lot harder). The main point of my demo is to have MSAA on ordinary hw, so this is bad.

The reason seems to be that on older Radeons MSAA does not resolve alpha channel, which obsiously messes things up in my case. I’m using RGBE8 encoding for the main rendertarget, and it RGB gets MSAA’d and exponent not - then oh well, no good anti aliasing most of the time.

Of course I could always manually supersample everything, but this would defeat the whole point of the demo. Or I could render everything in two passes, one for RGB and one for exponent - but this also is not very nice…

Probably I’ll just release the demo as it is now and wait for possible feedback. Or dig up an old Radeon somewhere and debug more - but replacing the video card in my Shuttle XPC is not an easy task :)


Debugging plus

Yesterday I had a cool debugging session while working on my HDR demo. One of postprocessing filters produced weird results and I went off to investigate that. The usual tricks: debugging in Visual Studio to make sure right sample offsets are generated; D3D debug runtime, D3DX debug, reference rasterizer, firing up NVPerfHud and doing frame analysis, doing full capture with PIX and inspecting device state, etc.

Nothing helped.

Then I noticed that in the pixel shader, I wrote

sample = tex2D( s0, uv + vSmpOffsets[i] )

instead of

sample += tex2D( s0, uv + vSmpOffsets[i] )

Aaargh. So much for a plus sign.

How to deal with such bugs? Why some bugs are trivial to find, and some are hard? Why sometimes (often?) the time required to find the bug does not correlate with bug’s “trickiness”? Why sometimes I can find a tricky bug in big unknown codebase in a couple of minutes; yet spend two hours on the plus sign in my own small code?

I’ve got no answers to the above.

By the way: PIX is a great tool, but D3D guys should really polish the UI :)


Jumped onto HDR bandwagon

I’m doing a small HDR demo for fun. Nothing fancy - linear gamma, Reinhard’s tone mapping and whatnot - everyone does that. But the thing I made so far does not even look good! :)

I’m trying to support both HDR and FSAA at the same time on ordinary DX9 hardware (no Radeons 1k) by using RGBE8 rendertarget for the main scene. It’s all okay so far.

The most difficult task right now is making it look good. Once I have that I’ll post the results.