Jump to content
  • Advertisement
Sign in to follow this  
akhin

About HDR Rendering/NonLinear Tonemapping

This topic is 2837 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi ,

In most tone mapping samples I have seen , it is a simple linear multiplication ( exposure )

In some samples there is also additional gamma correction and defogging

What I am after is improving my simple HDR rendering shader

1. Instead of a linear tone mapping/multiplication , what would you suggest ?

2. Like gamma correction and defogging what else do you suggest to apply ?

3. I also tried blooming by applying 2 Gaussian filters , 1 blurring horizotnally

and another blurring vertically , but frames per second reduced dramatically

I currently do not use post processing, but for studying HDR I directly render it with my

tonemapped phong point light shader , is the solution of FPS problem using postprocessing ?

I used the blurrings below which I got from a gamedev.net article :

// for vertical blur
float2 BlurOffset = float2( 0, 0.00260416666 );
float PixelWeight[8] = { 0.2537, 0.2185, 0.0821, 0.0461, 0.0262, 0.0162, 0.0102, 0.0052 };

...
for( int i = 0; i < 8; ++i )
{
color += tex2D( BlurYSampler, inTex + ( BlurOffset * i ) ) * PixelWeight;
color += tex2D( BlurYSampler, inTex - ( BlurOffset * i ) ) * PixelWeight;
}

// for horizontal blur

float2 BlurOffset = float2( 0.001953195, 0 );
float PixelWeight[8] = { 0.2537, 0.2185, 0.0821, 0.0461, 0.0262, 0.0162, 0.0102, 0.0052 };

for( int i = 0; i < 8; ++i )
{
color += tex2D( BlurXSampler, inTex + ( BlurOffset * i ) ) * PixelWeight;
color += tex2D( BlurXSampler, inTex - ( BlurOffset * i ) ) * PixelWeight;
}

Share this post


Link to post
Share on other sites
Advertisement
1. I wrote an article about tonemapping that included a comparison of a few different tone mapping articles. It's something of an artistic decision, so you may just want to have a look and pick which you like best. They're all pretty simple to implement. I prefer the filmic curves, personally.

2. I wouldn't worry about doing either of those in your shader. You can implement gamma correction by having the GPU do it automatically when writing out the results of your tone mapping pass. Tone mapping + bloom should be enough to get things looking pretty good for you.

3. First of all that's pretty damn big filter kernel, and most of the samples are useless since the weights are so low. I would suggest going with no more than 5-7 samples per pixel. For the weights you can generate them yourself by just using the Gaussian Function (I would suggest using a sigma of around 0.75-1.0).

Also, you'll probably want to downsample your bloom source image a few times before blurring. This will give you much better performance, and it will give you a wider blur radius for your bloom. I usually implement bloom like this:

1. Full-res pass where tone mapping is applied to the input image, with a lower exposure value than what's used in the "actual" tone mapping
2. Downsample 3 times
3. Do horizontal + vertical blur passes 2-4 times
4. Upsample 2 times
5. Do tone mapping pass, which samples the bloom results and adds to the tone mapped result

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!