FX wanted: CRT RGB dot shadow mask
  • freadZdeadZ
    junior Member
    Posts: 2
    Joined: Fri Aug 12, 2022 4:04 pm

    FX wanted: CRT RGB dot shadow mask

    by freadZdeadZ » Fri Aug 12, 2022 4:21 pm

    Hi all,

    Spent a few hours looking into creating this myself, but despite not being a complete luddite, gave up; What I am trying to achieve is a performant filter that takes a video signal and converts it into what in the old CRT TV/Monitor world was called "Shadow mask - a tightly stacked array of red, green, and blue dots, illuminated as per the brightness of the corresponding colour component of the pixel examined.

    I have achieved something like this in Processing, but it is painfully slow (the idea is to render onto a 1920 by 1080 surface, whereas we'd be only using something like every 6th of the inputs original input pixels in either dimension (rough example attached).

    I assume with a glsl and/or ISF, this would be much more performant, but having trouble to draw and locate simple circles with that technique (tried my luck modifying a couple of ISF's online, too)...

    Here is the code I used in Processing, not that it will be much help I guess, but to show the technique of building the triangles of circles (every second one inverted, and arranged as to avoid any colour repetitions):

    import processing.video.*;

    Capture img;

    void setup() {
    size(1920, 1080);
    img = new Capture(this, "name=OBSBOT Tiny 4K,size=480x270,fps=30");
    img.start();
    imageMode(CENTER);
    noStroke();
    background(0);
    }

    void draw() {
    if (img.available() == true) {
    img.read();
    pointillize = 3;
    float spc =1.6;
    for (int x = 0;x<img.width/3;x++){
    for (int y = 0;y<img.height/4;y++){
    int offs = 0;
    color pix = img.get(x*3, y*4);
    int rcomp = (pix >> 16) & 0xFF;
    int gcomp = (pix >> 8) & 0xFF;
    int bcomp = (pix) & 0xFF;
    color rch = color(rcomp,0,0,255);
    color gch = color(0,gcomp,0,255);
    color bch = color(0,0,bcomp,255);
    if(x % 2 == 1){
    fill(gch);
    ellipse(x*6*spc - 2*spc, y*7*spc, pointillize, pointillize);
    fill(bch);
    ellipse(x*6*spc+2*spc, y*7*spc, pointillize, pointillize);
    fill(rch);
    ellipse(x*6*spc , y*7*spc + 3*spc, pointillize, pointillize);
    }else{
    fill(rch);
    ellipse(x*6*spc , y*7*spc, pointillize, pointillize);
    fill(gch);
    ellipse(x*6*spc-2*spc, y*7*spc+3*spc, pointillize, pointillize);
    fill(bch);
    ellipse(x*6*spc + 2*spc, y*7*spc + 3*spc, pointillize, pointillize);
    }
    }
    }
    }
    }


    I assume that for someone who knows what they are doing with shaders, this will be a quick job, but yes - any help / pointers / would be appreciated!

    Here is a rectangular RGB split effect I forked off in ISF, so as long as the shapes could be manipulated to become circles in a particular pattern/arrangement, this would be perfect: https://editor.isf.video/shaders/62f645 ... 001afa2e1a ...

    PS, tried to include above as a CODE tag, but unfortunately it seems to eat the line breaks... and while italics seems to eat the code indentation, I thought it's better than none :)...


    Cheers,

    Freddy
    Attachments
    Screen Shot 2022-08-12 at 11.59.43 pm.png
    Screen Shot 2022-08-12 at 11.59.43 pm.png (704.76 KiB) Viewed 6567 times

Who is online

Users browsing this forum: No registered users and 7 guests