-
-
Notifications
You must be signed in to change notification settings - Fork 172
/
tonemap.hlsl
52 lines (47 loc) · 1.8 KB
/
tonemap.hlsl
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
47
48
49
50
51
52
#include "tonemap/aces.hlsl"
#include "tonemap/debug.hlsl"
#include "tonemap/linear.hlsl"
#include "tonemap/reinhard.hlsl"
#include "tonemap/uncharted.hlsl"
#include "tonemap/unreal.hlsl"
#include "tonemap/aces.hlsl"
#include "tonemap/debug.hlsl"
#include "tonemap/filmic.hlsl"
#include "tonemap/linear.hlsl"
#include "tonemap/reinhard.hlsl"
#include "tonemap/reinhardJodie.hlsl"
#include "tonemap/uncharted.hlsl"
#include "tonemap/uncharted2.hlsl"
#include "tonemap/unreal.hlsl"
/*
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 in 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) || defined(PLATFORM_WEBGL)
#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 color) { return TONEMAP_FNC(color); }
float4 tonemap(const float4 color) { return TONEMAP_FNC(color); }
#endif