I want to try and take the pristine full-color image sequences that Cycles is giving me and simulate the artifacts from a camera with a Bayer filter. Basically, a 640x480 camera gives you 640x480 color pixels, but it doesn’t actually have unique red, green, and blue sensors for each pixel. Usually they alternate in a grid pattern, with 1/4 of the overall pixels being sensitive to red, 1/4 to blue, and 1/2 to green. The camera or your software then interpolates to try and fake the other receptors to give you a decent full-color picture. There are some variations or alternatives to this, but that’s the gist of it. The result is that on the edges of objects or transitions between colors, if you zoom in all the way, you can often make out pixels that have the wrong color. Anyway, I’d like to try and simulate this, and I’d prefer it to be as flexible as possible so I can easily try it at different resolutions and such.
My first thought was to create a compositing node with a Python script that would pick through the image and discard any color information that shouldn’t be present, and then re-assemble it using one of the common algorithms (bilinear interpolation etc). But it doesn’t appear that there is currently support for scripted compositing nodes?
My next thought was to use a Separate RGBA node to split out the colors, then apply a unique mask to each color channel to discard the extra color information, then do something (exact steps undecided) to try and do a passable interpolation to recover the lost color. The first problem I ran into was making the masks. I could make them in Gimp or something, but then I’d be committing to the resolution (640x480 or whatever). I messed around a little with creating a Cycles checker texture and scaling it appropriately, but it wasn’t clear to me how to make this flexible against such things as re-rendering at higher resolutions. I need to be able to suppress things at a pixel level.
So here I am. Does anyone have any other suggestions? I would love to just write a little Python compositing node that tweaks the pixels, but it appears that that isn’t possible at this time?
Thanks for any help or suggestions you can give me, I appreciate it!