Random static fill in Designer

Hi,

Is there a way to make a static random fill with specified colours?

As an example, I have a 100 pix, I want them to be randomly assigned a colour, from a selection of R,G and B. It's a static timeline/scene. Ideally I would like to have a button "generate" and keep clicking it until I find something I like. 

I am trying to create a digital camouflage pattern.

Importing a JPG is not good, as it gets fades. 

  • Hi AndresK, 
    a custom preset is your friend here, let me work on an example and past that here.

  • The custom preset could look like this:

    -- Randomly generate colours for each pixel
    -- Define properties
    property("RandomSeed",INTEGER,12345,0,65535,1) -- Should the output be greyscale
    
    --Create the random table
    math.randomseed(RandomSeed)
    local randomvalues = {}
    for i = 1, width do 
        randomvalues[i] = {}
        for j = 1, height do
            randomvalues[i][j] = {}
            randomvalues[i][j]["R"] = math.random(0,255)
            randomvalues[i][j]["G"] = math.random(0,255)
            randomvalues[i][j]["B"] = math.random(0,255)
        end
    end
    
    -- Pixel function
    function pixel(frame, x, y)
        a = randomvalues[x+1][y+1]["R"]
        b = randomvalues[x+1][y+1]["G"]
        c = randomvalues[x+1][y+1]["B"]
        return a,b,c
    end


    If you create this custom preset and place it on the timeline you can use the 'seed' to get an image you like (and this will persist if you open the file next time)

    Example file: https://we.tl/t-TEyYjQgrfF  (link only 7 days valid)

  • Oh, thank you. This looks great. I assume the math.random(0,255) is the parameter that I can limit the choices with? 

  • Hi AndresK, not sure I understand your comment.
    On a timeline, drag the custom preset to the timeline and adjust the 'random seed' parameter to get to a preset you like. 


    (changing the math.random(0,255) will limit the min/max value for respective Red,Green and Blue)

  • Hi, yes, sorry - this is what I meant - to limit the min and max value. 

  • Building off what  gave you if you wanted to have red, green and blue Min/Max control in Properties you could do this:

    -- Randomly generate colours for each pixel
    -- Define properties
    property("RandomSeed",INTEGER,12345,0,65535,1) -- Should the output be greyscale
    property("RedMax",INTEGER,255,0,255,1)
    property("RedMin",INTEGER,0,0,255,1)
    property("GreenMax",INTEGER,255,0,255,1)
    property("GreenMin",INTEGER,0,0,255,1)
    property("BlueMax",INTEGER,255,0,255,1)
    property("BlueMin",INTEGER,0,0,255,1)
    
    --Create the random table
    math.randomseed(RandomSeed)
    local randomvalues = {}
    for i = 1, width do 
        randomvalues[i] = {}
        for j = 1, height do
            randomvalues[i][j] = {}
            randomvalues[i][j]["R"] = math.random(RedMin,RedMax)
            randomvalues[i][j]["G"] = math.random(GreenMin,GreenMax)
            randomvalues[i][j]["B"] = math.random(BlueMin,BlueMax)
        end
    end
    
    -- Pixel function
    function pixel(frame, x, y)
        a = randomvalues[x+1][y+1]["R"]
        b = randomvalues[x+1][y+1]["G"]
        c = randomvalues[x+1][y+1]["B"]
        return a,b,c
    end

  • Great addition Lowell - hope all is well!

Related