mirror of
https://github.com/italicsjenga/slang-shaders.git
synced 2024-11-23 00:01:31 +11:00
Update chromaticity.slang
This commit is contained in:
parent
fc1617cd29
commit
69417bb472
|
@ -25,12 +25,12 @@ layout(push_constant) uniform Push
|
||||||
vec4 OriginalSize;
|
vec4 OriginalSize;
|
||||||
vec4 OutputSize;
|
vec4 OutputSize;
|
||||||
uint FrameCount;
|
uint FrameCount;
|
||||||
float COLOR_MODE;
|
float COLOR_MODE, Dx;
|
||||||
} params;
|
} params;
|
||||||
#pragma parameter COLOR_MODE "SRGB,SMPTE C,REC709,BT2020,SMPTE240,NTSC1953,EBU" 0.0 0.0 6.0 1.0
|
#pragma parameter COLOR_MODE "SRGB,SMPTE C,REC709,BT2020,SMPTE240,NTSC1953,EBU" 0.0 0.0 6.0 1.0
|
||||||
|
#pragma parameter Dx "Color Temp: D50, D55, D65, D75" 2.0 -1.0 3.0 1.0
|
||||||
|
|
||||||
|
#define Dx params.Dx
|
||||||
|
|
||||||
#define COLOR_MODE params.COLOR_MODE
|
#define COLOR_MODE params.COLOR_MODE
|
||||||
|
|
||||||
#define WHITE vec3(1.0, 1.0, 1.0)
|
#define WHITE vec3(1.0, 1.0, 1.0)
|
||||||
|
@ -340,6 +340,16 @@ vec3 srgb_gamma(const vec3 x)
|
||||||
return vec3(srgb_gamma(x.r), srgb_gamma(x.g), srgb_gamma(x.b));
|
return vec3(srgb_gamma(x.r), srgb_gamma(x.g), srgb_gamma(x.b));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vec3 TEMP ()
|
||||||
|
{
|
||||||
|
if (Dx == 0.0) return vec3(0.964,1.0,0.8252);
|
||||||
|
else if (Dx == 1.0) return vec3(0.95682,1.0,0.92149);
|
||||||
|
else if (Dx == 2.0) return vec3(0.95047,1.0,1.0888);
|
||||||
|
else if (Dx == 3.0) return vec3(0.94972,1.0,1.22638);
|
||||||
|
else return vec3(1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
mat3 toRGB = colorspace_rgb();
|
mat3 toRGB = colorspace_rgb();
|
||||||
|
@ -349,6 +359,6 @@ void main()
|
||||||
vec3 RGB = Yrgb_to_RGB(toRGB, W, Yrgb);
|
vec3 RGB = Yrgb_to_RGB(toRGB, W, Yrgb);
|
||||||
|
|
||||||
RGB = clamp(RGB, 0.0, 1.0);
|
RGB = clamp(RGB, 0.0, 1.0);
|
||||||
RGB = srgb_gamma(RGB);
|
RGB = srgb_gamma(RGB)*TEMP();
|
||||||
FragColor = vec4(RGB, 1.0);
|
FragColor = vec4(RGB, 1.0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue