HDR post-processing order

Started by
6 comments, last by EsorU 8 years, 4 months ago

Hi,

I'm trying to implement HDR post-processing pipeline but not sure which way i should use.

- Which is the best or most used order of HDR post-processing?

Example 1.

Depth Of Field
Motion Blur
...
Adapt Luminance
Bloom -> Bright Pass -> color scaled by exposure -> threshold or something else
Bloom
Tonemap -> color scaled by exposure -> add bloom -> tonemap
Color correction
...
Sharpen
Noise

But these scale the color two times, should i divide it before tone mapping?

Example 2.

...
Bloom -> Bright Pass -> threshold or something else
Bloom
Adapt Luminance
Tonemap -> color + bloom -> color scaled by exposure -> tonemap
...

Seen's to be the best solution, right?

- Old days bright pass runs in LDR with a threshold value. However is there a better way to handle this in HDR?
Maybe scale threshold by max white or lower exposure?

- Is it possible to do luma shapen in HDR, because after tonmapping it will also sharp DOF/Bloom?
If so how to setup luma threshold value?

Thanks

Advertisement
- Old days bright pass runs in LDR with a threshold value. However is there a better way to handle this in HDR?
Maybe scale threshold by max white or lower exposure?

float4 main( in PS_INPUT Input ) : SV_TARGET
{
  // Sample the diffuse map and clamp to avoid artifacts because of fp16.
  float4 DiffuseData = DiffuseMap.Sample( LinearSampler, Input.TexCoord );
  DiffuseData.rgb = min( DiffuseData.rgb, float3( 65536.0f, 65536.0f, 65536.0f ) );

  // Return the bloom factor.
  return max( float4( 0.0f, 0.0f, 0.0f, 0.0f ), DiffuseData - BloomThreshold ) * 0.1f;
}


- Old days bright pass runs in LDR with a threshold value. However is there a better way to handle this in HDR?
Maybe scale threshold by max white or lower exposure?

A lot of modern games (usually with PBR) don't use any threshold at all and instead try to do some energy conservation - the simplest I know of is to lerp your HDR color and bloom color by a small amount (ex: lerp(color, bloom, 0.1)). This can help avoid aliasing from the threshold and can save you a pass (and is also "more correct" - quotes because bloom is a hack).

Thanks for your replies.

What i have in mind is something like to take all values above the white point and scale them down.

But this is what i currently using:


LDR
LColor.rgb *= max(GetLuminance(LColor.rgb) - BloomThreshold, 0.0f) * BloomMultiplier;

HDR (Example 1)
LColor.rgb *= saturate(max((GetLuminance(LColor.rgb) * Exposure) - BloomThreshold, 0.0f) * 0.5f);

I also try MJP's lower exposure version but i found it hard to get a good value.

@Styves
I think lerp should have the same problem as lower exposure every thing got bloom. I will give it a try.
But how can these save a pass?

You don't have to do a brightpass with lerp, so you can directly downscale your bloom target from the original source. Skips a step. ^_^

As for the lerp: apply exposure onto the result *after* lerping. So long as your image is exposed properly you should have the right amount of bloom. This is how we're doing it in CryEngine. :)

Well you right but i also do downscale in the bright pass so nothing to save. *cry*
Surely you can give me a answer to the main question where to insert luminance adaptation (exp 1 or 2) ?

To your advice i should do something like this?

...
Bloom (no threshold just simple downscale -> blur -> upscale)
Luminance Adaptation
Tonemapping:
exposure = keyvalue/adaptlum;
finalcolor = saturate( FilmicToneMapper( lerp(hdrcolor, hdrbloom, 0.1f) * exposure ));
...

Thanks X0 happy.png

What you post is fine. :)

For me, I'd probably do it like this:

Dof

Motion Blur

Luminance

Bloom

Tonemapping

But it doesn't really matter, it mostly comes down to what you want to do. If you were using the luminance for the threshold, then you would need to do it before bloom. If you want to generate luminance from the bloomed image, then you want to do it after bloom/composite.

Otherwise they're independent of eachother, so it doesn't matter when you do it.

Perfect that helps me a lot. Many thanks!
Just to be clear if you using luminance for the threshold do you apply exposure to both first in bloom and a second time in tonemapping to hdr Color?

Edit: I try the lerp thing but i don't like it. Every thing will less sharp and got bloom (yes i've played with the value) so back to luminance threshold. smile.png

This topic is closed to new replies.

Advertisement