HDR Rendering

Started by
8 comments, last by yoshi_lol 9 years, 4 months ago

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?

Advertisement

Well, bloom isn't really part of "HDR" - you can do bloom with LDR too.

Check here for some details about tonemapping:

http://mynameismjp.wordpress.com/2010/04/30/a-closer-look-at-tone-mapping/

Cheers!

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.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

@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?

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.

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.

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator

Bad..bad boy TheChubu...but I feel you pain...its one of the most overused effects..Like when lens-flare became prevalent.lol.

@TheChubu: Really?

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.

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).

"Some people use Singletons, some people are Simpletons." - Bill Gates
"Yum yum, I luv Cinnabon." - Mahatma Gandhi

This topic is closed to new replies.

Advertisement