1
$\begingroup$

I have a script that blooms based on color value, but I need to bloom only if the color is on a list,

the list is (1,0,0),(0,1,0),(1,0,1),(1,1,0),(0,1,1)

here is the script I was trying to edit http://www.pasteall.org/61086/c

uniform sampler2D bgl_RenderedTexture;
const float BRIGHT_PASS_THRESHOLD = 0.55;
const float BRIGHT_PASS_OFFSET = 0.08;

#define blurclamp 0.002
#define bias 10.8
#define KERNEL_SIZE 6.0

vec2 texcoord = vec2(gl_TexCoord[0]).st;

vec4 bright(vec2 coo)
{
        vec4 color = texture2D(bgl_RenderedTexture, coo);

        color = max(color - BRIGHT_PASS_THRESHOLD, 0.0);

        return color / (color + BRIGHT_PASS_OFFSET);   
}

void main(void)
{
        vec2 blur = vec2(clamp( bias, -blurclamp, blurclamp ));

        vec4 col = vec4( 0, 0, 0, 0 );
        for ( float x = -KERNEL_SIZE + 1.0; x < KERNEL_SIZE; x += 1.0 )
        {
        for ( float y = -KERNEL_SIZE + 1.0; y < KERNEL_SIZE; y += 1.0 )
        {
                 col += bright( texcoord + vec2( blur.x * x, blur.y * y ) );
        }
        }
        col /= ((KERNEL_SIZE+KERNEL_SIZE)-1.0)*((KERNEL_SIZE+KERNEL_SIZE)-1.0);
        gl_FragColor = col + texture2D(bgl_RenderedTexture, texcoord);
}

but it's just bloom, not 'selective bloom'.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.