Skip to content

how to limit this shader effect to 0-40srgb? #14440

Closed Answered by geextahslex
geextahslex asked this question in Q&A
Discussion options

You must be logged in to vote
//!PARAM S
//!DESC sCurve Strength
//!TYPE float
//!MINIMUM 0
//!MAXIMUM 1
0.15

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

#define EFFECT_END             vec3(70.0) // stop applying the effect here
#define EFFECT_END_RAMP_SIZE   vec3(40.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…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by geextahslex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant