SweetFX – Tonemap

014SweetFX Tonemap is an effect that adjusts a variety of related image enhancements that include gamma, saturation, bleach, exposure, and color removal.

Tonemap is a useful “many-in-one” effect. Other effects might offer a greater degree of control over the image, but if only minor modifications are needed by using one effect, then Tonemap has its place.

Tonemap is an excellent effect for colorizing black and white images. The applied color is often better and more uniform across the image than other effects that attempt to colorize.

Enabling

Set USE_TONEMAP to 1 in SweetFX_settings.txt.

#define USE_TONEMAP 1
//[0 or 1] Tonemap : Adjust gamma, exposure, saturation, bleach and defog. (may cause clipping)

Tonemap Settings

There are six settings that affect Tonemap: Gamma, Exposure, Saturation, Bleach, Defog, and Fogcolor. Combining these settings can produce a variety of image enhancements. Below is the Tonemap section from the SweetFX_settings.txt file.

 /*-----------------------------------------------------------.
 / Tonemap settings /
 '-----------------------------------------------------------*/
#define Gamma 1.000 //[0.000 to 2.000] Adjust midtones. 1.000 is neutral. This setting does exactly the same as the one in Lift Gamma Gain, only with less control.
#define Exposure 0.000 //[-1.000 to 1.000] Adjust exposure
#define Saturation 0.000 //[-1.000 to 1.000] Adjust saturation
#define Bleach 0.000 //[0.000 to 1.000] Brightens the shadows and fades the colors
#define Defog 0.000 //[0.000 to 1.000] How much of the color tint to remove
#define FogColor float3(0.00, 0.00, 2.55) //[0.00 to 2.55, 0.00 to 2.55, 0.00 to 2.55] What color to remove - default is blue

Gamma 0.000 to 2.000

Adjusts gamma. However, this gamma control is limited. If only minor gamma adjustment is needed, then this should be enough, but for more accurate gamma control over the image, set the Tonemap Gamma to 1.000 (neutral) and use the SweetFX Lift Gamma Gain effect instead.

Exposure -1.0 to 1.0

Makes the image brighter. Brightens the darks so more detail is visible in dark areas. Think of this as being similar to the exposure control on a camera.

Higher = brighter
 Lower = darker
     0 = neutral
---------------------------------------
Negative values = darker exposure
Positive values = brighter exposure

Saturation -1.000 to 1.000

Saturates or desaturates colors to make them more or less intense. Use negative values to desaturate colors, and use positive values to saturate colors. Saturation = 0 is the neutral setting and has no effect.

Negative = desaturate
Positive = saturate
       0 = off

Setting saturation lower than -1.0 inverts colors. Reds become cyans.

Bleach 0.000 to 1.000

Avoid setting bleach above 1. The image becomes darker after that, not lighter. Whites become blacks while blacks remain dark. Small values, such as 0.020, are best.

Defog and FogColor

Defog and FogColor work together. FogColor specifies a color to remove (in decimal RGB format), and Defog specifies how much of that color to remove.

FogColor (Red, Green, Blue). This operates differently than might be expected because lower values preserve more color. Higher values indicate more of that color to be removed.

To preserve more green, use 0.25. 1.25 will reduce green more than 0.25. To preserve all green, use 0 for green. This is because Defog removes color. 2.55 will remove 255 of blue, which means all blue, and 0.25 will allow more blue to remain. The value of Defog also determines the intensity, or how much, of the color to remove. This is tricky to describe, but experimentation makes it easier to understand.

There appears to be a FogColor float4 function that accepts four arguments, but there does not seem to be any documentation regarding the fourth argument of FogColor float4. Use FogColor float3.

Colorizing

Tonemap will colorize a monochrome image using Defog, FogColor, and Saturation. When colorizing, Saturation will affect how much color is used. Saturation at -1.0 is almost black and white.

HDR

Tonemap appears much improved when used with the HDR effect by making colors appear richer. Compare 001 with 001 + HDR below.

Screenshots

Below are screenshots from the game Fallout: New Vegas to show what kind of results can be achieved with Tonemap.

001

Tonemap 001

Tonemap 001

#define Gamma 1.0
#define Exposure 0
#define Saturation 0.3
#define Bleach 0.020
#define Defog 0.00
#define FogColor float3 (0, 0, 0)

001 + HDR

Tonemap 001 + HDR

Tonemap 001 + HDR

Same as 001 above but with HDR enabled. Notice blacks appear blacker without loss of detail. Image has more depth of color.

Due to image resizing and compression, the effect is less noticeable in the screenshots than in the actual game.

002

Tonemap 002

Tonemap 002

#define Gamma 1.0
#define Exposure 0.5
#define Saturation 0.3
#define Bleach 0.020
#define Defog 0.00
#define FogColor float3 (0, 0, 0)

003

Tonemap 003

Tonemap 003

#define Gamma 1.0
#define Exposure -1.0
#define Saturation 0.3
#define Bleach 0.020
#define Defog 0.00
#define FogColor float3 (0, 0, 0)

004

Tonemap 004

Tonemap 004

#define Gamma 1.0
#define Exposure 1.0
#define Saturation 0.3
#define Bleach 0.020
#define Defog 0.00
#define FogColor float3 (0, 0, 0)

005

Tonemap 005

Tonemap 005

#define Gamma .050
#define Exposure 0
#define Saturation 0.3
#define Bleach 0.020
#define Defog 0.00
#define FogColor float3 (0, 0, 0)

006

Tonemap 006

Tonemap 006

#define Gamma 1.5
#define Exposure 0
#define Saturation 0.3
#define Bleach 0.020
#define Defog 0.00
#define FogColor float3 (0, 0, 0)

007

Tonemap 007

Tonemap 007

#define Gamma 1.2
#define Exposure 0
#define Saturation 0.3
#define Bleach 0.020
#define Defog 0.00
#define FogColor float3 (0, 0, 0)

008

Tonemap 008

Tonemap 008

#define Gamma 0.2
#define Exposure 0
#define Saturation 0.3
#define Bleach 0.020
#define Defog 0.00
#define FogColor float3 (0, 0, 0)

009

Tonemap 009

Tonemap 009

#define Gamma 1.0
#define Exposure 0
#define Saturation 0.5
#define Bleach 0.020
#define Defog 0.00
#define FogColor float3 (0, 0, 0)

010

Tonemap 010

Tonemap 010

#define Gamma 1.0
#define Exposure 0.1
#define Saturation 0.5
#define Bleach 0.020
#define Defog 0.00
#define FogColor float3 (0, 0, 0)

011

Tonemap 011

Tonemap 011

#define Gamma 1.0
#define Exposure 0.1
#define Saturation -1.0
#define Bleach 0.020
#define Defog 0.00
#define FogColor float3 (0, 0, 0)

The Tonemap Saturation settings does not remove all color completely, it only lessens the color intensity. So, it is not possible to create a pure black and white image using Tonemap alone. To remove all color and produce a true black and white image, use the SweetFX Monochrome effect.

012 Too Much Desaturation

Tonemap 012

Tonemap 012

#define Gamma 1.0
#define Exposure 0.1
#define Saturation -2.0
#define Bleach 0.020
#define Defog 0.00
#define FogColor float3 (0, 0, 0)

Saturation less than -1.0 tends to invert colors. Here, Saturation is set to -2.0. Tonemap can be used as a cheap way to invert colors by lowering the Saturation value to a negative amount well below its intended limit. However, this will most likely produce ugly image artifacts.

013 Slight Desaturation

Tonemap 013

Tonemap 013

#define Gamma 1.0
#define Exposure 0.1
#define Saturation -0.8
#define Bleach 0.020
#define Defog 0.00
#define FogColor float3 (0, 0, 0)

Scene is slightly desaturated with a Saturation value of -0.8. (Negative values desaturate.)

014 Too Much Desaturation

Tonemap 014

Tonemap 014

#define Gamma 1.0
#define Exposure 0.1
#define Saturation -6
#define Bleach 0.020
#define Defog 0.00
#define FogColor float3 (0, 0, 0)

This scene is over-desaturated with Saturation at -6, which is below its limit of -1.0.

015 Bleach

Tonemap 015

Tonemap 015

#define Gamma 1.0
#define Exposure 0.1
#define Saturation 0
#define Bleach 1.000
#define Defog 0.00
#define FogColor float3 (0, 0, 0)

Bleach is set to its limit of 1.0. The whites are made whiter.

016 Much Too Much Bleach

Tonemap 016

Tonemap 016

#define Gamma 1.0
#define Exposure 0.1
#define Saturation 0
#define Bleach 4.000
#define Defog 0.00
#define FogColor float3(0, 0, 0)

Bleach is much higher than its limit of 1.0. Anything higher than 1.0 turns whites into blacks, not whiter whites. At 4.0 much of the whiteness becomes dark.

017 Too Much Bleach Again (but not as much)

Tonemap 017

Tonemap 017

#define Gamma 1.0
#define Exposure 0.1
#define Saturation 0
#define Bleach 2.000
#define Defog 0.00
#define FogColor float3(0, 0, 0)

Bleach is set to 2.0, which is greater than its limit of 1.0. When Bleach is set to a value greater than 1.0, the scene becomes darker, not lighter. White parts turn black. This is why the clouds are black instead of white.

018 No Blue

Tonemap 018

Tonemap 018

#define Gamma 1.0
#define Exposure 0.1
#define Saturation 0
#define Bleach 0.020
#define Defog 1.00
#define FogColor float3(0.00, 0.00, 2.55) // Removes BLUE

Remember the color wheel. Removing blue from the palette leaves red and green, which, when added together, produce yellow (red + green = yellow). This is why removing blue gives the entire image a yellow hue. recall that adding two colors from the additive spectrum produces a secondary color, which is a primary color of the subtractive spectrum.

  • Additive spectrum primaries: Red, Green, Blue.
  • Additive spectrum secondaries: Cyan, Magenta, Yellow.
  • Subtractive spectrum primaries: Cyan, Magenta, Yellow.
  • Subtractive spectrum secondaries: Red, Green, Blue.

Keeping these color rules in mind help avoid confusion and understand what is happening when removing colors from an image.

019 No Red

Tonemap 019

Tonemap 019

#define Gamma 1.0
#define Exposure 0.1
#define Saturation 0
#define Bleach 0.020
#define Defog 1.00
#define FogColor float3(2.55, 0, 0) // Removes RED

Subtracting red leaves green + blue = cyan.

020 No Green

Tonemap 020

Tonemap 020

#define Gamma 1.0
#define Exposure 0.1
#define Saturation 0
#define Bleach 0.020
#define Defog 1.00
#define FogColor float3(0, 2.55, 0) // Removes GREEN

Removing all green leaves blue and red, which, when combined, produces magenta.

021

Tonemap 021

Tonemap 021

#define Gamma 1.0
#define Exposure 0.1
#define Saturation 0
#define Bleach 0.020
#define Defog 1.00
#define FogColor float3(0.25, 0.10, 0.10)

These settings achieve a color effect somewhat comparable to the Technicolor effect.

022

Tonemap 022

Tonemap 022

#define Gamma 1.0
#define Exposure 0.1
#define Saturation 0
#define Bleach 0.020
#define Defog 1.00
#define FogColor float3(0.25, 0.50, 0.37)

023

Tonemap 023

Tonemap 023

#define Gamma 0.8
#define Exposure 0.15
#define Saturation -0.5
#define Bleach 0.50
#define Defog 0.5
#define FogColor float3(0.25, 0.50, 0.37)

024

Tonemap 024

Tonemap 024

#define Gamma 1.5
#define Exposure 0.15
#define Saturation -0.25
#define Bleach 0.50
#define Defog 0.5
#define FogColor float3(0.25, 0.50, 0.37)

Increased Gamma for darker scene than 023.

025

Tonemap 025

Tonemap 025

#define Gamma 1.2
#define Exposure 0.15
#define Saturation -0.25
#define Bleach 0.75
#define Defog 0.5
#define FogColor float3(0.25, 0.05, 0.5)

026

Tonemap 026

Tonemap 026

#define Gamma 1.0
#define Exposure 0.15
#define Saturation -0.25
#define Bleach 0.75
#define Defog 0.5
#define FogColor float3(0.25, 0.05, 0.5)

Lower Gamma than 025 to show more details in shadow areas.

SweetFX Effects

, ,

  1. Leave a comment

Leave a comment