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

    Einmal editiert, zuletzt von MrTie (20. März 2018 um 10:06)

  • 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

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!