Search code examples
graphicsvideodesign-patternswavesynthesis

Video Synthesis - Making waves, patterns, gradients


I'm writing a program to generate some wild visuals. So far I can paint each pixel with a random blue value:

for (y = 0; y < YMAX; y++) {
    for (x = 0; x < XMAX; x++) {
        b = rand() % 255;
        setPixelColor(x,y,r,g,b);
    }
}

I'd like to do more than just make blue noise, but I'm not sure where to start (Google isn't helping me much today), so it would be great if you could share anything you know on the subject or some links to related resources.


Solution

  • I used to do such kind of tricks in the past. Unfortunately, I don't have the code :-/

    You'll be amazed of what effects bitwise and integer arithmetic operators can produce:

    FRAME_ITERATION++;
    for (y = 0; y < YMAX; y++) {
        for (x = 0; x < XMAX; x++) {
            b = (x | y) % FRAME_ITERATION;
            setPixelColor(x,y,r,g,b);
        }
    }
    

    Sorry but I don't remember the exact combinations, so b = (x | y) % FRAME_ITERATION;
    might actually render nothing beautiful. But, you can try your own combos.

    Anyway, with code like the above, you can produce weird patterns and even water-like effects.