HDR + Tonemapping + Skylight = Fail?

Started by
52 comments, last by riuthamus 11 years, 8 months ago

Sure that's the point. I do luminance downsampling but the initial sampling is made on the whole HDR image and not on the DownscaleRenderTarget. The downside is that it has a slight impact on the performance.

Ok so instead of starting at the 1/16th size image, you started from the fullsize image, calculated the initial luminance using the function you provided, and then downscale it to a 1x1 to get the average? Correct me if I'm wrong but the code you provided seems to sample the same pixel 9 times. Is that intentional...?


Yes that is correct. As far as I understand the sampling helps to get a smoother result but I did not go through the whole C++ code of the DirectXSDK sample so I could be wrong but it gives me a better result. Oh and the "+1" to vSample is a project specific color correction constant so you can ignore it.


The result rendertarget in the function is 1/16 size of your source image and the PostProcess() is called 4 times. The first 3 time you call it on a temporary rendertarget which is 1/2 of the last ones size. So you have 1/1 -> 1/2 after the first pass and then 1/2 -> 1/4 -> 1/8 and then it is rendered to the result rendertarget and you get your 1/16 sized texture.

I had figured that was the intention but it's not actually using the size of the previous RT, but continually using the size of the source RT. I checked with the debugger, source.width / 2 is the same number for all 3 RTs. I'm guessing thats a bug in the sample then.


That's strange indeed. It's probably a bug. I never noticed it because I'm not using the hardware scaling.
Advertisement

Yes that is correct. As far as I understand the sampling helps to get a smoother result but I did not go through the whole C++ code of the DirectXSDK sample so I could be wrong but it gives me a better result. Oh and the "+1" to vSample is a project specific color correction constant so you can ignore it.


Why not sample once, save yourself the loop and x9?

[quote name='quiSHADgho' timestamp='1346140803' post='4974015']
Yes that is correct. As far as I understand the sampling helps to get a smoother result but I did not go through the whole C++ code of the DirectXSDK sample so I could be wrong but it gives me a better result. Oh and the "+1" to vSample is a project specific color correction constant so you can ignore it.


Why not sample once, save yourself the loop and x9?
[/quote]

Your probably right. I did a quick test and did not noticed big differences but also no performance improvement at all. But I'm messing around with the shaders for some other features atm so I have to test it again later.
So I took a look at the initial luminance image being generated and it looks a bit odd to me. I'm not sure what its supposed to look like, but it seems wrong to me that everything that is not the sky has exactly 0 luminance and that the sky has such a strong gradient on it.

Initial Luminance:
[attachment=10975:luminance.png]

Final Image:
[attachment=10976:RuinValor 2012-08-28 05-31-54-35.png]
The problem is that the dotproduct in the luminance sample function is smaller than 1 so the log becomes negativ and negativ values are clamped to 0. What you can do is add a "+1" to make sure the log is always greater or equal 0 or boost the lighting so that the values in the HDRimage getting higher.
Well, we did some of that and we got a good+bad result.
You do not want to clamp your log(luminance) at 0 or 1. The value can and will be negative. A 32-bit or 16-bit floating point format has a sign bit, so there is no problem with storing a negative number in such a render target. The only thing you'll want to do is clamp the luminance value to some small epsilon before taking the log of it, since log(0) is undefined.
So the luminance is supposed to look like that then? I did also try turning up the lighting values a lot and the luminance looks a bit more normal, but the final screen result is about the same so... I guess the luminance isn't really the issue.

There is still an issue with the bloom though. It seems like only colors with a large amount of red in them get any bloom applied (although white doesn't seem to get any bloom). I've attached a screenshot of several different colored blocks.

[attachment=10983:RuinValor 2012-08-28 18-02-28-60.png]
And to give you guys some video of what is going on:

[media]
[/media]
So, i was trying my best to figure out what could be causing this and we are more or less stuck! We think it is due to blur... I started to play some of my newer games and see what they are doing and maybe this was a common thing. I noticed the game witcher and saw this same effect ( although theirs does not look like crap! )

Perhaps the answer is we cant use bright tones of colors? This overblur only happens on red tone colors... perhaps there is something wrong with tonemapping? If anybody has any suggestions at this point we are at a loss for what to do. I dont want to break down each system and find it that way as that would be a lot of work.. but it is looking more and more like that is the only solution.

Thanks for any help you can provide in advance.

gallery_1_8_18948.png
gallery_1_8_213186.png
gallery_1_8_109182.png

This topic is closed to new replies.

Advertisement