increase luminance of a matrix

    Sep 26 2013 | 4:53 pm
    I'm trying to create a jitter effect (using jit.op or some other object through which I can pass an existing matrix) where each pixel has its luminance increased, as if the H portion of the HSL notation had been increased.
    So for example, if luminance runs from 0.0 to 1.0, and we fed in a parameter of 0.3, then the luminance value of each pixel increases by 0.3. Thus, pure red would become pink, muddy yellow would become a brighter yellow, etc. Luminance would be capped at 0.1, so any pixel that was already close to full luminance would just look white.
    I've attached a screenshot to make my intentions clear.
    I tried jit.brcosa (using the @brightness attribute), but this does not raise a pixel above it's original luminance - it can only reduce it.
    I have a hunch that I will need to convert each pixel value to HSL, increase the L portion, then convert back to RGB. I have the required formulas from - but I'm not sure how I would use them in Max. Is this a job for Gen perhaps?

    • Sep 26 2013 | 5:33 pm
      jit.rgb2hsl and it's @lscale attribute
    • Sep 26 2013 | 5:55 pm
      So simple! Thanks!
    • Sep 26 2013 | 6:14 pm
      Here's a demo. I used jit.rgb2hsl as advised, and then jit.hsl2rgb to convert it back.
    • Sep 27 2013 | 12:36 am
      unfortunately 2hsl and 2hsv are the only ones which i did not got right from looking at the quasi codes found on the web, when i tried to do them all recently.
      the picture below shows how it would look like (if the last bug in it would be corrected finally - i somehow lost interest in it)
      btw, not sure how important it is for your project, but the L in HSL stands for lightness, and not for luminance. ;)
      for luminance, which you were asking for, you would need ALL of the three abstractions i posted in this thread
      quite a bunch of code for something so simple.
    • Sep 27 2013 | 1:01 am
      no, wait, thats luma, not luminance, my bad.
      it is always a bit hard to keep the difference between lightness, brightness, luminance, and luma in mind if you´re not native english. ;)
      luminance or lightness can be found in L*a*b.