My filter plugin don't work

  • Hi all, im trying to code my own webgl filter plugin (brightness , contrast, gamma), but it's not work very well :

    I try to change the brightness, but it follows that we no longer see the images, an idea?



    result with brightness at 0.5

    Edited once, last by MrTie (March 20, 2018 at 10:06 AM).

  • Hi,

    the multiple passes are surely the reason, your code wouldn't need more than one pass, so all multiple passes related code could be removed.

    E.g. see here:

    Code
    var shader_passes = 6;

    all that is unnecessary - one shader would be enough:

    Code
    shaders = new Array(shader_passes);
    for (var i = 0; i < shader_passes; i++) {

    also that 'scaling' code is completely wrong, it would only causes wrong values:

    Code
    var pass_brightness = (((i >> 1)+1) / (shader_passes/2.0)) * xml_brightness;
    var pass_contrast = (((i >> 1)+1) / (shader_passes/2.0)) * xml_contrast;
    var pass_gamma = (((i >> 1)+1) / (shader_passes/2.0)) * xml_gamma;

    That pass-related scaling is from the multipass blurring and is wrong here.

    Best regards,
    Klaus

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!