Menu

Change colors in RGBMatrix

2014-10-09
2014-12-10
  • Alessandro Grechi

    Hi all,
    I'm working with some RGB LED bars and sometimes I use the RGBmatrix
    functions to easily create nice animations. When creating the function I
    can only chose the primary and/or secondary color for the animation, and
    cannot be changed later on "live" mode.
    I mean, would be nice if I could change the color of the animation as a
    separate parameter, maybe with a slider o a scene in the consolle. At this
    moment I have to clone each animation for each different colour I want.
    My fixtures of course have only RGB intensity channels, so HTP, I guess. I
    cannot change intensity and colors separately.

    Any ideas about that?

     
  • Giorgio

    Giorgio - 2014-10-09

    To avoid cloning I use custom scripts with internal color generators (random, complementary or schema generator).

     
    • Massimo Callegari

      Giorgo, it would be nice to share those scripts here, so other users can benefit from them.

      Thanks

       
    • Alessandro Grechi

      Yes, that's what I was thinking to.
      Do you have some examples to start? :)

       
  • Massimo Callegari

    Hi Alessandro, maybe we can do the other way round.
    Since I know you use Jinx!, maybe you can explain how you normally work with it and see if we can add similar functionalities to QLC+.
    Maybe screenshots and videos can help to have the immediate idea.

    Improving RGB Matrices is something I'm willing to do as I will personally need them for a few shows at the beginning of the next year.
    So, the more flexibility, the better.

    Thanks

     
    • Alessandro Grechi

      Hi Massimo,
      Yes I worked a lot with rgb matrices and Led strips/bars on these months, and I would like to replicate some functionalities on QLC+.

      In my opinion the script animation is a good starting point. I can share to you some ideas:
      - colors setted as parameters in script, and controllable separately.
      - Colors generator, animated gratients / fade, random
      - layers. EX: animation1 + animation2

      Better layout groups interface. You told me you know that part is not very handy. Would be great to have a visual editor (like the 2D mode on DMX monitor!) to setup matrices, led strips, compositions, ecc.

       
  • Giorgio

    Giorgio - 2014-10-09

    I use custom made matrix scripts. Inside algo.rgbMap function I don't use the input rgb parameter but I use an internal generator.
    For example I can generate a random color with this function:

    function randRGB()
    {
    var r = (Math.rand()256);
    var g = (Math.rand()
    256);
    var b = (Math.rand()*256);

    return ( ( r & 0xFF) << 16) + ( ( g & 0xFF) << 8) + ( b & 0xFF );
    

    }

    I can upload some scripts in the next few days.

     
  • Alessandro Grechi

    I've tried to follow your instructions adding that function in one script, but It doesn't work as expected. What am I missing?

     function()
     {
        var algo = new Object;
        algo.apiVersion = 1;
        algo.name = "Random Color";
        algo.author = "...";
    
         algo.rgbMap = function(width, height, rgb, step)
         {
            var map = new Array(height);
            for (var y = 0; y < height; y++)
            {
                map[y] = new Array();
                for (var x = 0; x < width; x++)
                {
                    if (y == step) {
                        map[y][x] = randrgb();
    
                    }
                    else
                        map[y][x] = 0;
                }
            }
    
            return map;
        }
    
        function randrgb() {
            var r = (Math.rand()*256);
                            var g = (Math.rand()*256);
                            var b = (Math.rand()*256);
                            var randrgb = ( ( r & 0xFF) << 16) + ( ( g & 0xFF) << 8) + ( b & 0xFF );
                            return randrgb;
        }
         algo.rgbMapStepCount = function(width, height)
         {
    
            return height;
        }
    
        testAlgo = algo;
    
        return algo;
    }
    )()
    
     
  • Giorgio

    Giorgio - 2014-10-10
    // Development tool access
    var testAlgo;
    
    (
    function()
     {
        var algo = new Object;
        algo.apiVersion = 1;
        algo.name = "Random Color";
        algo.author = "...";
    
         algo.rgbMap = function(width, height, rgb, step)
         {
            var map = new Array(height);
            for (var y = 0; y < height; y++)
            {
                map[y] = new Array();
                for (var x = 0; x < width; x++)
                {
                    if (y == step) {
                        map[y][x] = randrgb();
    
                    }
                    else
                        map[y][x] = 0;
                }
            }
    
            return map;
        }
    
        function randrgb() {
            var r = (Math.random()*256);
                            var g = (Math.random()*256);
                            var b = (Math.random()*256);
                            var randrgb = ( ( r & 0xFF) << 16) + ( ( g & 0xFF) << 8) + ( b & 0xFF );
                            return randrgb;
        }
         algo.rgbMapStepCount = function(width, height)
         {
    
            return height;
        }
    
        testAlgo = algo;
    
        return algo;
    }
    )()
    
     
  • Alessandro Grechi

    Looks like exactly the same, except the first three rows, which I forgot to paste here but are present in my script. Still does not work...

    Script is evaluated correctly but I get no output.

     
  • Giorgio

    Giorgio - 2014-10-10

    Not only the first rows.
    Math.rand() changed to Math.random()

     
  • Alessandro Grechi

    Yep! I missed that :)
    now it's working. Thank you :)

     
  • Massimo Callegari

    Alessandro, I think what we need is a dedicated Virtual Console widget to control the essential RGB Matrix parameters. I would say:
    - intensity
    - algorithm (call it preset or script as you like)
    - start color
    - end color

    The layout I imagine is: 1 slider, 2 buttons and a drop down box.
    With the slider you can control the intensity of the matrix.
    The buttons are Click & Go color choosers and the dropdown box is the list of algorithms you can change on the fly.
    This list can be configured to display a custom list or all the QLC+ algorithms.

    How does it sound ?

    Any proposal is welcome.

    P.S. Regarding layers, if you run 2-3-4 matrices together they automatically layer onto each other. Try it, you can create nice effects !
    (I show something like that in the Raspberry Pi video at 8:45)

     
  • Alessandro Grechi

    Massimo,
    I understand what you mean, sounds cool! ;)
    Something like my attached screenshot, right?

    As regards layers, yes, I finally managed to sum te effects with collections of RGBscript. Very nice, indeed.

     
    • Massimo Callegari

      Exactly something like that !
      In addition to my previous post, the slider will act like a playback slider.
      Value 0 = function stopped
      Value not zero = function started and dimmered

       
  • AdamUK

    AdamUK - 2014-12-08

    Hi Massimo and Alessandro,

    Please excuse me for asking this stupid question. I have never used scripts before in QLC+ and would really appreciate some help if you don't mind. I have an RGB matrix for 8 LED Bars, animations are working great but I would also like to create a widget to independently control the colour, dim and speed of the animations, similar to Alessandro. Would it be possible for you to talk me through step by step how to add the script and get this widget?

    I really appreciate your help!

     
  • Alessandro Grechi

    Hi Adam,
    you can find the RGB matrix widget in virtual console since the last version (4.8.2). In the GIT version there are a lot of improvements on this side, so grab it from there if you can! (or wait for next stable version).
    For the usage, nothing is more clear than Massimo's video tutorial! :)
    https://www.youtube.com/watch?v=ovr3CSSbfgY

     
  • AdamUK

    AdamUK - 2014-12-10

    Hi Alessandro,

    I shortly found the video on youtube after posting my question, which of course prompted me to find the widget on the update! A really useful tool! Thank you so much for your help :)

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.