Closed geextahslex closed 3 months ago
I pitched this to our shader-programming channel in discord and this was guest.r's take: So, go ahead and calculate both with and without the effect, then mix between with the smoothstepped mix-factor.
Thanks for your answer. I know the "theory" but I need proper code that works ^^' I also use discord, maybe I could join the conversation
sure, come on down :)
https://discord.com/invite/VZ2b7wghxR #programming-shaders
Thank you :) I'm not sure in which category my question would make sense? ^^' Official Software channels->help?
Solved:
//!HOOK LUMA
//!BIND HOOKED
//!DESC sCurve (sigmoid)
#define EFFECT_END vec3(40.0) // stop applying the effect here
#define EFFECT_END_RAMP_SIZE vec3(10.0) // smooth out the edge of the effect
#define S vec3(0.15)
vec4 hook() {
vec4 orig = HOOKED_tex(HOOKED_pos);
vec3 effect = mix(orig.rgb, 1/( 1.0 + exp(-14*orig.rgb +7) ), S); //your desidered effect.
//effect = vec3(0.0);
vec3 mmix = smoothstep(EFFECT_END - EFFECT_END_RAMP_SIZE*0.5,
EFFECT_END + EFFECT_END_RAMP_SIZE*0.5,
orig.rgb * 255.0);
vec3 out_color = mix(effect, orig.rgb, mmix);
return vec4(out_color, orig.a);
}
Hi, could someone be so nice and help me to put a srgb treshold (smoothstep) into this shader? This is a S-Curve (sigmoid) contrast shader. I would like to apply the effect only in the sRGB 0-40/80(smoothstep) range
S-Curve
Thank you :)