-
-
Notifications
You must be signed in to change notification settings - Fork 172
/
tonemap.msl
46 lines (41 loc) · 1.56 KB
/
tonemap.msl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "tonemap/aces.msl"
#include "tonemap/debug.msl"
#include "tonemap/filmic.msl"
#include "tonemap/linear.msl"
#include "tonemap/reinhard.msl"
#include "tonemap/reinhardJodie.msl"
#include "tonemap/uncharted.msl"
#include "tonemap/uncharted2.msl"
#include "tonemap/unreal.msl"
/*
contributors: Patricio Gonzalez Vivo
description: Tone maps the specified RGB color (meaning convert from HDR to LDR) inside the range [0..~8] to [0..1]. The input must be linear HDR pre-exposed.
use: tonemap(<float3|float4> rgb)
options:
- TONEMAP_FNC: |
tonemapLinear, tonemapReinhard, tonemapUnreal, tonemapACES, tonemapDebug,
tonemapUncharter
license:
- Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0
- Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license
*/
#ifndef TONEMAP_FNC
#if defined(TARGET_MOBILE) || defined(PLATFORM_RPI)
#define TONEMAP_FNC tonemapUnreal
#else
// #define TONEMAP_FNC tonemapDebug
// #define TONEMAP_FNC tonemapFilmic
// #define TONEMAP_FNC tonemapACES
// #define TONEMAP_FNC tonemapUncharted2
// #define TONEMAP_FNC tonemapUncharted
#define TONEMAP_FNC tonemapReinhardJodie
// #define TONEMAP_FNC tonemapReinhard
// #define TONEMAP_FNC tonemapUnreal
// #define TONEMAP_FNC tonemapLinear
#endif
#endif
#ifndef FNC_TONEMAP
#define FNC_TONEMAP
float3 tonemap(const float3 v) { return TONEMAP_FNC(v); }
float4 tonemap(const float4 v) { return TONEMAP_FNC(v); }
#endif