Skip to main content
GameDev.net gamedev.net
🔒 Locked

LogLuv HDR problem

Started by sepul Mar 22, 2009 at 11:47 AM 6 replies 1.8k views
Original Post
sepul
sepul
Hi I'm having a problem dealing with Multisampling in conjunction with LogLuv HDR encoding. my card is 7600gt and I'm using the latest drivers the problem is when MSAA is on, I get strange single pixel artifacts somewhere (not visible), that messes up luminance calculation and the luminance of the scene suddenly turns up white, so the scene flickers one frame, and it's completely random, this problem never arises in No MSAA mode. for LogLuv Encode/Decode I use the common NAO32 described here and here is what I do for HDR / luminance measurement, etc. 1- render scene using LogLuv Encoding into AA surface (RGBA8) 2- Copy the AA surface into RT Texture using StretchRect 3- Downsample and Decode LogLuv from RT Texture into RGBA16F 4- Measure Luminance 5- Threshold and Bloom 5- Final HDR (Tonemapping + Bloom + DecodeLogLuv) Am I missing something here ?
MJP
MJP
Well your basic process sounds fine. Are you using the exact code Christer had posted on his blog? I'd made a few changes to avoid some precision issues...the code I used is here. I'd tried it with MSAA on a few platforms and never encountered a problem like the one you're getting. The only issue I did have at first was that I'd accidentally left alpha-testing on while rendering, and that left some "holes" where the alpha was 0.

It sounds like you might be having some problems with discontinuities though...you've gotta be careful in the decode since you divide by Y. If Y is 0 you could get weird results in the pixel shader, depending on the hardware, driver, and shader model (remember that in SM2.0 dividing by 0 gives you 0, but in SM3.0 it produces an undefined result). You might want to see if you can produce that situation, and then run it through PIX or something.
sepul
sepul
thanks for the tips
but I still couldn't find a solution, checked the .y division, and even put an If statement to avoid zero division. but couldn't fix it
and the decode/encode code is exactly the one that you mentioned in your website
I put up a little test program for HDR test, that you can see the problem for your self.
hdr test demo
edit the INI file and set AntiAlias=0 or (2,4,8,...) to run it with AA and without AA.
you can add "debug=1" line in the [common] group to debug it in nvPerfHud
and for the console commands press '~' and type "r_enablepostfx hdr 0" while running ro disable HDR

any more help is really appreciated
MJP
MJP
I will try it out when I get home later tonight, and see what results I get.
wolf
wolf
I use this without the log compression ... so I split up the value straight into two 8-bit channels ... but I also have a rather low luminance range in the image.
You might give that a try ...
MJP
MJP
Unfortunately I can't run your test app...I get a message box with this text:

Creating RT Texture Surface failedInvalid call


The log file has this:
Fri Mar 27 20:28:43 2009Initializing Hammer Engine v0.70 ...Resource Manager InitializedInitializing Direct3D9 renderer ...Resource 'texture@impact24_00.dds' LoadedResource 'font@fonts/impact24.font' LoadedResource 'shader@shaders/2d_bmp.shader' LoadedResource 'shader@shaders/2d_clr.shader' LoadedResource 'shader@shaders/3d_dbg_clr.shader' LoadedInitializing Shadow cache ...Exception: Creating RT Texture Surface failed - Invalid call @ hmrTexture_D3d9.cppHammer Engine Released


The debug runtimes say that the call failed because an invalid format was specified.

I'm running an ATI HD 4870, FYI.
sepul
sepul
oh, I didn't test it on ATI cards, do you know what is the common hardware shadow mapping format for ATI cards ?
I use a 2k, RGBX8 and D24S8 DepthStencil texture for my card. I also check for the availability of the hardware z-buffers and for your card it doesn't seem to be the problem.

anyway, thanks wolf and mjp, the problem is solved, it wasn't actually with the LogLuv encoding, I had a problem with Z-artifacts that messed up the encoding.
MJP
MJP
Oh you're using hardware shadow mapping? It's a little different for ATI vs. Nvidia. I forget exactly how it works (it's been a long time)...this sample should show you how to do it.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.