fade pixel to black...but in gl-land

    Aug 17 2011 | 5:01 pm
    Hi all, This is a continuation of a discussion found here:
    A really useful patch! But now I need to draw with an alpha value, and so must leave the comforts of jit.lcd land and move into jit.gl.sketch land. Possible? Below is a patch showing the original "fade to black" patch and my attempt at converting to gl, and where I am stuck.
    Thanks in advance for any pointers! David

    • Aug 17 2011 | 5:58 pm
      you just need to capture the sketch output to a named texture, and bang that texture into your slap chain. i also changed co.multiply to cc.scalebias as you just need to scale a single texture, not multiply two textures.
    • Aug 17 2011 | 6:21 pm
      Brilliant! Thank you for the help!!
      One small follow-up...the squares never fade completely to black (related to scalebias ?). Any pointers on making sure the square fades completely to black?
      Thanks again! David
    • Aug 18 2011 | 12:39 am
      Yup...I'm baffled...spent the day trying to figure this out and can't seem to solve it. I can never get it to fade to black. Any ideas?
      Thanks, David
    • Aug 18 2011 | 12:50 am
      either set the param scale to less than .99 or maybe send the output to some kind of threshold or contrast shader? not sure, i think it's a gpu thing.
    • Aug 18 2011 | 7:50 pm
      Hi Rob, Thanks for the pointers. I've been tinkering around with other options and still haven't found anything that works the way I'm hoping it to work (and still look pretty). I've tried on several different GPU's and still have the same issue, too. So maybe there's another approach.
      Here's a patch that's closer to the how I am applying the "fade to black" idea. The patch randomly draws two paths. The paths have a life-expentency, meaning that the oldest portion of each path will eventually fade to nothing. Playing with the scale parameter for the scalebias shader certainly helped with the "residual" trails being left on screen (although still present), but at the expense of a really short life span for the trail. Instead of scalebias I've also tried the co.multiply.jxs shader, vade's 2 channel mixer shaders, and a few other random shaders, all of which left this residual trail vs. black when it has finished fading out. So maybe another path to create my...paths...is in order?
      As always, any pointers/suggestions/words of wisdom are greatly appreciated.
      Cheers, David
    • Aug 22 2011 | 3:32 pm
      Any thoughts on different approaches to this before I admit defeat here?
      Thanks again for any pointers!