Artoriuz / ArtCNN

Super-Resolution Convolutional Neural Networks as GLSL shaders for mpv
MIT License
109 stars 2 forks source link

how to limit this shader effect to 0-40 sRGB? #23

Closed geextahslex closed 2 months ago

geextahslex commented 2 months ago

Hi, this is not a issue. I have seen that you are pretty familiar with glsl shaders and I'm looking for help with a shader. So I have this S-Curve (sigmoid) contrast shader and I would like to apply the effect only in the sRGB 0-40/80(smoothstep) range/ treshold. I would appreciate any help.

#define Thresh 15/255.
#define w 10/255.
#define CoefLuma vec4(0.2126, 0.7152, 0.0722, 0) //sRGB, HDTV
smoothstep(Thresh + w, Thresh - w)

S-Curve (sigmoid)

//!HOOK OUTPUT
//!BIND HOOKED
//!DESC sCurve (sigmoid)

#define S 0.25 

vec4 hook(){
    vec4 c0 = HOOKED_texOff(0);

    c0.rgb = mix(c0.rgb, 1/( 1.0 + exp(-14*c0.rgb +7) ), S);
    return c0; 
}

Thank you :)

Artoriuz commented 2 months ago

This is not the place to ask this. I don't know where exactly the best place would be, but since this is an mpv shader you can probably open the issue there (or ask at irc).