Tone Mapping

From Frictional Wiki
< HPL3‎ | SOMA‎ | Scripting
Revision as of 14:23, 2 October 2026 by TiMan (talk | contribs) (Add a sourced SOMA guide with explanations and stock-script examples.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


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.

Before you start

  1. Open the map script inside your own mod. Keep its generated includes, cScrMap : iScrMap class and callback structure. See Add your first script if you have not edited a map script yet.
  2. Add the helper include shown below alongside the script’s other includes.
  3. 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.

See also