Working asinh stretch

This commit is contained in:
2020-05-17 14:48:02 +02:00
parent e350591b3f
commit b71d0c4a7f
3 changed files with 17 additions and 9 deletions
+12 -3
View File
@@ -6,9 +6,16 @@ uniform vec2 scale;
uniform float a;
uniform int stretch;
float asinh_(float x)
{
return log(x + sqrt(x*x + 1.0f));
}
void main(void)
{
vec4 color = texture2D(qt_Texture0, qt_TexCoord0);
color = color*scale.x + scale.y;
max(color, vec4(0.0f));
switch(stretch)
{
@@ -25,13 +32,15 @@ void main(void)
break;
case 4:
{
float l = color.r*0.2126f + color.g*0.7152f + color.b*0.7152f;
color *= asinh(l / a) / asinh(1 / a);
//float l = color.r*0.2126f + color.g*0.7152f + color.b*0.0722f;
float l = (color.r+color.g+color.b)*0.33333f;
float k = asinh(l*a)/(l*asinh(a));
color *= k;
}
break;
}
color = color*scale.x + scale.y;
//color = color*scale.x + scale.y;
//float color = pow(c, 0.4545);
gl_FragColor = color;
}