added PBRNetral Tonemapping
This commit is contained in:
parent
008dbd5353
commit
1c8e1e68f8
19
shader/ToneMap/PBRNetral.glsl
Normal file
19
shader/ToneMap/PBRNetral.glsl
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
vec3 ToneMapping(vec3 color)
|
||||||
|
{
|
||||||
|
const float startCompression = 0.8 - 0.04;
|
||||||
|
const float desaturation = 0.15;
|
||||||
|
|
||||||
|
float x = min(color.r, min(color.g, color.b));
|
||||||
|
float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
|
||||||
|
color -= offset;
|
||||||
|
|
||||||
|
float peak = max(color.r, max(color.g, color.b));
|
||||||
|
if (peak < startCompression) return color;
|
||||||
|
|
||||||
|
const float d = 1. - startCompression;
|
||||||
|
float newPeak = 1. - d * d / (peak + d - startCompression);
|
||||||
|
color *= newPeak / peak;
|
||||||
|
|
||||||
|
float g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);
|
||||||
|
return mix(color, newPeak * vec3(1, 1, 1), g);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user