Sign in to follow this  

HDR Rendering

This topic is 1117 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

I'm trying to implement HDR, according to my understanding:

 

- Render the scene to D3DFMT_A16B16G16R16F texture

- Apply bloom effect

- Apply tone mapping

- Render the final scene (Fullscreen Quad)

 

The bloom effect is working perfectly.

 

How do I apply tone mapping?

Edited by Medo3337

Share this post


Link to post
Share on other sites

The DirectX SDK (June 2010) has 4 HDR-related D3DX9 sample solutions. In particular, the HDRPipeline example illustrates individual steps - source image, brightness pass, down-sampling, horiz- and vert-blur, luminance passes, etc.  It can be a bit of a struggle to work through the examples piece-by-piece, but there are several steps to the process (as mentioned in kauna's link) that you'll have to integrate and implement. The shader code, however, is provided.

 

If you have the DX SDK installed, browse through the SampleBrowser for descriptions of each project.

Edited by Buckeye

Share this post


Link to post
Share on other sites

@Buckeye: I already looked at the samples, but until now I can't seem to understand tone mapping and luminance calculation.

 

Additionally, I read that blending the following 3 images can produce HDR image:

- Bright scene

- Dark scene

- Normal scene

 

Is that correct?

Share this post


Link to post
Share on other sites

HDR just means exactly High Dynamic Range. Typically renderer manipulate ( output, calculate, intermediate ) values that are of limited dynamic range or low dynamic range. The output of renderer are usually stored in textures/framebuffer with 8-bit per component. 8-bit is not enough( even with sRGB encoding ) to cover more than 2 orders of magnitude hence the use of textures that have more range ex. the texture format you mentioned. Using a texture format that allows for more range itself doesn't not qualify as high dynamic range. To display HDR images on a LDR display device, there has to be a dynamic range compression step ( tonemapping ) that converts the high dynamic range into a range suitable to the display device. There are multitude of tonemapping operator out there and you would have to research the one that does the job for you. A simplistic one you could use is a linear scale of the displayed value or linearly scaling the luminance.

http://filmicgames.com/archives/75 covers a few operators.
 

Share this post


Link to post
Share on other sites

You forgot a couple of steps:


- Render the scene to D3DFMT_A16B16G16R16F texture
- Apply bloom effect
- Apply tone mapping

- Apply more bloom
- Render the final scene (Fullscreen Quad)

- Apply even more bloom

- Screw the scene, just draw a white fullscreen quad.

- Then add bloom to it.

There you go.

Share this post


Link to post
Share on other sites

Some effects like bloom, lens flares, motion blur, etc have left a bad taste in some peoples mouth because they have been implemented very poorly in the past, and in some cases abused. If you do these things right then they should not stick out enough to come across as an "effect" because these are things which are always present in reality.

Share this post


Link to post
Share on other sites

I recommend checking out the Intel HDR implementation aswell:

 

https://software.intel.com/en-us/articles/hdr-rendering-with-compute-shader-sample

 

It's based on a talk by Bungie for Halo 3 ("HDR The Bungie Way").

In short: they use mip-maps to speed-up the blur-passes of the bloom-effect while additively blending the results into the target buffer.

 

Tone-mapping is done using the Reinhard-operator but you can replace it with any other TM-operator that's out there.

 

If you are using DX11 you should also look into compute-shaders instead of using fullscreen-quads for all of your image-processing since they are generally faster, if done right (i.e. cache data / texture reads in groupshared-memory).

Edited by yoshi_lol

Share this post


Link to post
Share on other sites

This topic is 1117 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this