Accommodate for changes to default sRGB textures and targets
This commit is contained in:
@@ -14,17 +14,17 @@ class Post : Extension {
|
||||
/**
|
||||
* The color type to use for the intermediate color buffers
|
||||
*/
|
||||
var intermediateType = ColorType.UINT8
|
||||
var intermediateType = ColorType.UINT8_SRGB
|
||||
|
||||
/**
|
||||
* The color type to use for the output color buffer
|
||||
*/
|
||||
var outputType = ColorType.UINT8
|
||||
var outputType = ColorType.UINT8_SRGB
|
||||
|
||||
/**
|
||||
* The color type to use for the input buffer
|
||||
*/
|
||||
var inputType = ColorType.UINT8
|
||||
var inputType = ColorType.UINT8_SRGB
|
||||
|
||||
/**
|
||||
* The depth format to use for the input buffer
|
||||
|
||||
@@ -16,29 +16,9 @@ in vec2 v_texCoord0;
|
||||
|
||||
out vec4 o_color;
|
||||
|
||||
uniform bool linearizeInputA;
|
||||
uniform bool linearizeInputB;
|
||||
uniform bool delinearizeOutput;
|
||||
uniform float fill;
|
||||
uniform bool clip;
|
||||
|
||||
vec3 srgb_to_linear(vec3 c) {
|
||||
const float t = 0.00313066844250063;
|
||||
return vec3(
|
||||
c.r <= t ? c.r / 12.92 : pow((c.r + 0.055) / 1.055, 2.4),
|
||||
c.g <= t ? c.g / 12.92 : pow((c.g + 0.055) / 1.055, 2.4),
|
||||
c.b <= t ? c.b / 12.92 : pow((c.b + 0.055) / 1.055, 2.4));
|
||||
}
|
||||
|
||||
vec3 linear_to_srgb(vec3 c) {
|
||||
const float t = 0.00313066844250063;
|
||||
return vec3(
|
||||
c.r <= t ? c.r * 12.92 : 1.055 * pow(c.r, 1.0 / 2.4) - 0.055,
|
||||
c.g <= t ? c.g * 12.92 : 1.055 * pow(c.g, 1.0 / 2.4) - 0.055,
|
||||
c.b <= t ? c.b * 12.92 : 1.055 * pow(c.b, 1.0 / 2.4) - 0.055
|
||||
);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 a = texture(tex0, v_texCoord0);
|
||||
vec4 b = texture(tex1, v_texCoord0);
|
||||
@@ -48,13 +28,6 @@ void main() {
|
||||
vec4 nb = b.a == 0.0 ? vec4(0.0): vec4(b.rgb / b.a,b.a);
|
||||
|
||||
|
||||
if (linearizeInputA) {
|
||||
na.rgb = srgb_to_linear(na.rgb);
|
||||
}
|
||||
|
||||
if (linearizeInputB) {
|
||||
nb.rgb = srgb_to_linear(nb.rgb);
|
||||
}
|
||||
|
||||
vec4 mixed = vec4(spectral_mix(na.rgb, nb.rgb, min(1.0, fill)), 1.0);
|
||||
|
||||
@@ -68,9 +41,6 @@ void main() {
|
||||
|
||||
mixed.rgb = mixed.a == 0.0 ? vec3(0.0): mixed.rgb / mixed.a;
|
||||
|
||||
if (delinearizeOutput) {
|
||||
mixed.rgb = linear_to_srgb(mixed.rgb);
|
||||
}
|
||||
|
||||
// premultiply alpha
|
||||
mixed.rgb *= mixed.a;
|
||||
|
||||
@@ -18,8 +18,6 @@ private class LaserBlurPass : Filter(mppFilterShader(fx_laser_blur, "laser-blur"
|
||||
var vignette: Double by parameters
|
||||
var vignetteSize: Double by parameters
|
||||
var aberration: Double by parameters
|
||||
var linearInput: Boolean by parameters
|
||||
var linearOutput: Boolean by parameters
|
||||
|
||||
init {
|
||||
radius = 0.0
|
||||
@@ -29,8 +27,6 @@ private class LaserBlurPass : Filter(mppFilterShader(fx_laser_blur, "laser-blur"
|
||||
vignette = 0.0
|
||||
vignetteSize = 1.0
|
||||
aberration = 0.0
|
||||
linearInput = false
|
||||
linearOutput = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,12 +56,6 @@ class LaserBlur : Filter1to1() {
|
||||
@DoubleParameter("exp", -1.0, 1.0, order = 7)
|
||||
var exp = 0.739
|
||||
|
||||
@BooleanParameter("linear input", order = 8)
|
||||
var linearInput = false
|
||||
|
||||
@BooleanParameter("linear output", order = 9)
|
||||
var linearOutput = false
|
||||
|
||||
@DoubleParameter("phase", -1.0, 1.0, order = 7)
|
||||
var phase = 0.0
|
||||
|
||||
@@ -99,19 +89,13 @@ class LaserBlur : Filter1to1() {
|
||||
|
||||
pass.radius = 1.0 + pow(exp, 0.0) * radius
|
||||
|
||||
pass.linearInput = linearInput
|
||||
pass.linearOutput = true
|
||||
pass.apply(source[0], intermediates[0], clip)
|
||||
for (i in 0 until passes - 1) {
|
||||
pass.linearInput = true
|
||||
pass.linearOutput = true
|
||||
|
||||
pass.radius = 1.0 + pow(exp, i + 1.0) * radius //(1.0 + simplex(0, phase + i)) / 2.0
|
||||
pass.apply(intermediates[i % 2], intermediates[(i + 1) % 2], clip)
|
||||
}
|
||||
pass.radius = 1.0 + pow(exp, (passes) * 1.0) * radius
|
||||
pass.linearInput = true
|
||||
pass.linearOutput = linearOutput
|
||||
pass.apply(intermediates[(passes + 1) % 2], target[0], clip)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,12 +37,6 @@ class VideoGlitch : Filter1to1(mppFilterShader(fx_video_glitch, "video-glitch"))
|
||||
@DoubleParameter("scroll offset 1", 0.0, 1.0)
|
||||
var scrollOffset1: Double by parameters
|
||||
|
||||
@BooleanParameter("linear input")
|
||||
var linearInput: Boolean by parameters
|
||||
|
||||
@BooleanParameter("linear output")
|
||||
var linearOutput: Boolean by parameters
|
||||
|
||||
init {
|
||||
amplitude = 1.0
|
||||
vfreq = 4.0
|
||||
@@ -52,7 +46,5 @@ class VideoGlitch : Filter1to1(mppFilterShader(fx_video_glitch, "video-glitch"))
|
||||
scrollOffset0 = 0.0
|
||||
scrollOffset1 = 0.0
|
||||
borderHeight = 0.05
|
||||
linearInput = false
|
||||
linearOutput = false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user