Tone Mapping
This page describes SOMA’s Tone Mapping effect.
Tone-mapping helpers change image exposure, white cut and color grading. Exposure affects overall image brightness; the documented white cut clamps colors brighter than its threshold, while grading uses a texture to change final colors.
Contents
Before you start
- Open the map script inside your own mod. Keep its generated includes,
cScrMap : iScrMapclass and callback structure. See Add your first script if you have not edited a map script yet. - Add the helper include shown below alongside the script’s other includes.
- Read the stock example before copying its calls: named entities, voice subjects, materials and callbacks must belong to the map or resources you are using.
Follow the stock example
#include "helpers/helper_effects.hps"
Effect_ToneMapping_FadeExposure
Changes the overall brightness of the image over time
| Parameter | Meaning |
|---|---|
afExposure |
how much extra light should be let though the lens, 0 is default |
afTime |
time to fade in |
In maps/_e3/_e3_01_02/_e3_01_02.hps, SOMA calls Effect_ToneMapping_FadeExposure as follows.
Effect_ToneMapping_FadeExposure(0,0.1f);
| Parameter | Value in this stock call |
|---|---|
afExposure |
0
|
afTime |
0.1f
|
This is an excerpt from that stock script; its referenced names and variables belong to that script.
Effect_ToneMapping_FadeWhiteCut
Changes the white point of the tone mapper over time Every color brighter then the white cut gets clamped to (1,1,1)
| Parameter | Meaning |
|---|---|
afWhiteCut |
the value of the white cut, every brighter color get set to white |
afTime |
time to fade in |
In maps/_e3/_e3_01_01/_e3_01_01.hps, SOMA calls Effect_ToneMapping_FadeWhiteCut as follows.
Effect_ToneMapping_FadeWhiteCut(0.1, 0.0001f);
| Parameter | Value in this stock call |
|---|---|
afWhiteCut |
0.1
|
afTime |
0.0001f
|
This is an excerpt from that stock script; its referenced names and variables belong to that script.
Effect_ToneMapping_FadeGrading
Fades in a grading texture which changes the final color of the image
| Parameter | Meaning |
|---|---|
asTextureName |
name of the grading texture |
afTime |
time to fade in |
Check your change
Save the script and restart the map in development mode with F5. If the script fails, open F1 and use Show Error List or Show HPL Log. See the development loop for the launch and debugging steps.