Graphics

 View Only
  • 1.  Set diffuse/ambient color through datalinq (Hex and/or decimal)

    Posted 04-23-2018 13:58
    Hi there!

    Was just wondering... I did find the way of setting the ambient and/or diffuse color of a material through visual logic.
    Though this input seems to be hex values in the form of #ARGB (Alpha, Red, Green, Blue).

    However, there is no way to actually "give" this input any other way than the blocks for color, that is through the blocks Color, Float Color or Int Color.
    Seeins as it asks for hex values, I dont see why there's no "hex colors".

    This is especially because...

    DashBoard. When setting up a color picker in DashBoard you get the value returned as hex in the shape of #RRGGBB.
    Now wouldnt it be great if we could just pad this with a hex-alpha value and send it to Xpression through DataLinq?
    At the moment I have a script in DashBoard that does the following:

    • Strips the # from the hex value (left with RRGGBB)
    • Separates those into 3 different variables RR, GG & BB.
    • Converts those into int values (0-255).
    • Pads those numbers up to 3 numbers with leading 0s if it should be less than 3 numbers.
    • Concatenate those 3 variables into a single variable and store this 9 digit string in a parameter.
    • Streams this parameter through DataLinq
    Then in Xpression

    • Get the parameter from datalinq
    • use 3 of the "mid string" blocks in visual logic to grab the three values.
    • Insert these 3 values into Red, Green and Blue in an IntColor block.
    Now it WORKS, but is there a simpler sollution out there?

    Ohhh, and yes.. This is at work, and we still use Xpression v.6.5 here.


  • 2.  RE: Set diffuse/ambient color through datalinq (Hex and/or decimal)

    Posted 04-24-2018 16:50
    Maybe : instead of sending one parameter, you can stream the color as 3 parameters ( the 3 integer values ) : in Xpression use a datalinq block for each parameter and directly connect them to IntColor block.

    I just wonder if the 3 parameters will be processed at the same time (to avoid intermediate color behavior ) ...
    #XPression


  • 3.  RE: Set diffuse/ambient color through datalinq (Hex and/or decimal)

    Posted 04-24-2018 19:31
    Maybe : instead of sending one parameter, you can stream the color as 3 parameters ( the 3 integer values ) : in Xpression use a datalinq block for each parameter and directly connect them to IntColor block.

    I just wonder if the 3 parameters will be processed at the same time (to avoid intermediate color behavior ) ...



    I could most definetly do that!
    Though seeing as Xpression still wants the values as int 0-255 for all 3, I still have to convert the values from the color picker into decimals from hex.

    The last concatenate in DashBoard is simply to reduce the amount of parameters to send. As I got a feeling this DashBoard will end up with a couple hundreds total...
    And and splitting them up again in Xpression was surprisingly easy with the "MID STRING" block.
    #XPression


  • 4.  RE: Set diffuse/ambient color through datalinq (Hex and/or decimal)

    Posted 04-29-2022 18:10
    Bumping an old thread.... How did you do the following step:

    • Strips the # from the hex value (left with RRGGBB)
    I see the current value of my colour picker as <#00E1F25C>, so maybe I need to strip out the # and the < > symbols? I tried using a substring, but it did not seem to work

    var x = params.getValue('Game_1_Away_Colour', 0);
    params.setValue('Game_1_Away_Colour_Hex', 0, x.substring(3,10));

    I also tried of 2,9 just in case those < > symbols don't actually count, but still no results

    ------------------------------
    Jake Lew
    Access Communications Co-Operative Limited
    ------------------------------



  • 5.  RE: Set diffuse/ambient color through datalinq (Hex and/or decimal)

    Posted 04-30-2022 12:45

    This is more DashBoard than it is Xpression I see, but it ties into it anyhow.

    I see your color picker returns the values <#00E1F25C>, that is not only RGB but ARGB (Alpha, Red, Green, Blue, as the hex values allways comes in pairs to get 256 values), or "Transparacy" in the color picker in DashBoard.
    This makes no sense to me, because if the transparacy is set to 0, your value would be #E1F25C, but the second you touch the transparancy slider, you get an Alpha Hex value ahead of your RGB values, meaning the index position of RGB is completly up to the mercy of the transparancy slider...
    I know ROSS added an option in the color picker in DashBoard to select wether or not you want it as ARGB or RGBA, I assume, as a response to my post above...

    So, if you add the w.format as rgba in the config options for the color picker, you will now have #E1F25C00 (or #E1F25C if you dont touch the transparancy slider) instead, wich makes more sense now that you know that the RGB values will allways have the correct index position in the string...

    ​As for it including the <> signs I dont believe it does. It doesnt do that at my DashBoard anyhow...
    Easiest way to check what you're getting is by using the ogscript.debug() function and look at the debug window for what you're getting.​​
    So, just do a ogscript.debug(x); on  a line after your var x declaration there and you can see wether or not the <> is included.

    Hope this helps! 



    ------------------------------
    Aleksander Stalsberg
    Inland Norway University of Applied Sciences/Lillehammer Icehockey Club
    Norway
    ------------------------------



  • 6.  RE: Set diffuse/ambient color through datalinq (Hex and/or decimal)

    Posted 05-02-2022 11:13
    Sorry if I am crossing the streams asking Dashboard questions in the Xpression section. This was just exactly what I was trying to do with both of them. I managed to solve it using the debug tool as you mentioned, then I just stripped away the leading 00 of the value it was giving to me and it works. I don't see any option to change it from ARGB to RGBA, but just adding a line to strip the two 00s at the start seems to do the trick. Then I take the one value and use the "mid string" blocks in Xpression to get my colour onto the material.

    ------------------------------
    Jake Lew
    Access Communications Co-Operative Limited
    ------------------------------