View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# Filmic ToneMapping is DARK

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

6 replies to this topic

### #1Alundra  Members

Posted 30 July 2014 - 09:38 AM

Hi all,

I have a render target RGBA16F where I render the scene with lighting.

When the rendering of the scene is finished I send this texture in the Filmic ToneMapping pixel shader.

The problem is I got a very dark image, you can see the image "With" on the right and "Without" on the left:

http://uppix.com/f-Screenshot_2014_53d910de0017208f.png

Here the pixel shader code :

struct PS_INPUT
{
float4 Position : SV_POSITION;
float2 TexCoord : TEXCOORD0;
};

Texture2D< float4 > DiffuseMap : register( t0 );
SamplerState LinearSampler : register( s0 );

float3 FilmicTonemap( in float3 x )
{
float A = 0.22f; // Shoulder Strength.
float B = 0.30f; // Linear Strength.
float C = 0.10f; // Linear Angle.
float D = 0.20f; // Toe Strength.
float E = 0.01f; // Toe Numerator.
float F = 0.30f; // Toe Denominator.
return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F)) - E/F;
}

float4 main( in PS_INPUT Input ) : SV_TARGET
{
if(Input.TexCoord.x > 0.5f)
{
// Get the diffuse data.
float3 DiffuseData = DiffuseMap.Sample( LinearSampler, Input.TexCoord ).rgb;

// Compute the current color and the white scale.
float3 CurrentColor = FilmicTonemap( DiffuseData );
float3 WhiteScale = FilmicTonemap( float3( 11.2f, 11.2f, 11.2f ) );

// Return the final color.
return float4( CurrentColor / WhiteScale, 1.0f );
}
else
{
return DiffuseMap.Sample( LinearSampler, Input.TexCoord );
}
}

Thanks for the help

### #2TiagoCosta  Members

Posted 30 July 2014 - 10:12 AM

Have you played around the with the constants A, B, C, D, E, F and the 11.2 used to calculate WhiteScale? You probably have to tweak them to achieve the look you want...

Edited by TiagoCosta, 30 July 2014 - 10:12 AM.

### #3haegarr  Members

Posted 30 July 2014 - 10:41 AM

11.2 is the level in the input image that should be mapped to 1.0 in the output image (i.e. the "white point"). If the input image's mean luminance lies noticeably below this 11.2, then the output image will look overall darker.

### #4Alundra  Members

Posted 30 July 2014 - 01:57 PM

Good catch, using this value :

float3 CurrentColor = FilmicTonemap( DiffuseData );
float3 WhiteScale = FilmicTonemap( float3( 1.0f, 1.0f, 1.0f ) );

I have this result (Left = orifinal HDR, Right = Filmic Tonemapping) :

http://uppix.com/f-Screenshot_2014_53d94e230017212f.png

Is it better to set one fixed value or have one value by scene ?

Edited by Alundra, 30 July 2014 - 02:23 PM.

### #5haegarr  Members

Posted 31 July 2014 - 09:44 AM

Is it better to set one fixed value or have one value by scene ?

I'm not familiar with HDR, but AFAIS the white point depends on the current snapshot of the scene. I mean, it would not make sense in general to have a constant white point, because it would result in typical LDR images since you would need to foresee a value for all circumstances. Someone with experience in HDR may confirm or contradict this...

However, the demo scene you are showing us with the screenshots does not look like a typical HDR scene. The brightness of highlights seems relative low, and the fact that 1.0 can be used as white point supports this. In such a scene a constant white point may perhaps be used.

### #6Ashaman73  Members

Posted 01 August 2014 - 12:13 AM

Is it better to set one fixed value or have one value by scene ?

When using the common reinhard tonemapping, you use the scene brightness as variation for the exposure level of the tonemapping operator. You can use something similar for the filimic tonemapping, eg by adding variation to the white scale (or modify other parameters).

To determine the brightness of your scene, render it first (HDR), then sample the image down (eg from 1024x1024=>256=>64=>16=>4=>1) while caluclating the average birghtness/light intensity of the HDR image. Then use the pixel value of the last rendered 1x1 pixel as input (modify by a scalar) for the white space. Utilising the GPU hardware filtering capacities and taking multiple samples per step will result in just a few rendering steps.

Instead of the using only the light intensity of the current scene, take the average of the last X frames.

Ashaman

### #7Alundra  Members

Posted 02 August 2014 - 07:48 PM

Unreal Engine has a param for camera component named "Dynamic Range" :

Dynamic Range -> This controls the amount of dynamic range before the tone-mapping curve starts to clip. A setting of 1 would be no dynamic range. Eye adaption happens before the input to Film post so dynamic range is the range after adaption.

So, we end to the answer that it's needed to allow the user to set it.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.