Earlier I had a post about adding G’MIC image processing node to Blender compositor. Now I have also added a Shadertoy compatible OpenGL GLSL fragment shader node and also a node that can execute Python scripts.
The Python script node is probably the most interesting one. Image data is passed to Python code as numpy arrays which can then be manipulated in any way you want. It is even possible to use third-party libraries to process the image data. I bundled Pillow image processing library with the release and you can use it to draw lines, text or perform filtering (gaussian blur etc.). You can check out the demo video and documentation for more information.
There was some discussion about using vapoursynth for denoising images etc. and the core module seems to at least import correctly. I had no experience with using it however, so I didn’t try anything else with it yet.
Image processing with Python… Thats a pity that default Blender distribution doesnt go with SciPy library atleast. Otherwise there already will be many addons wich manipulate image datablocks pixel data.
And vice versa, Pillow library could help modeling landscapes for such addons like Sverchok.
Blender comes bundled with NumPy which is an important part of SciPy, so image manipulation can be fast even when “written” in Python. And it should not be hard to bundle whole SciPy with Blender if someone needs it.
As a quick test I implemented OpenCV face detection using the Python script compositor node. All faces that are found in the input picture are overlayed with green boxes. The script is visible in the script window.
Seems like the main dev is AFK. If someone interested to debug the GLSL part you can find the diff here:
I was almost close to make it compatible with 2.8. But some pointers are rising error as shader.c is updated. Will work on it, mean time any help is highly appropriated. This (at least glsl an py) should come in Blender Compositor.
If you are alive please reply @sawduster . At least I will be confirmed that you are not abducted.
Hi @ambi thanks for the point. I was searching for a faster py GL binding. Seems modernGL might be the answer. So what would be your suggestion to integrate in Blender compositor? Should I work on pycompositor instead?
This seems kind of flexible as well. Let me know your suggestions. Thanks.
Depends on your goals, what you want to do, but it seems one can just write a script to render Shadertoy output into an image and load that image into compositor through the regular compositor nodes. It’s just another option. Doesn’t require changing Blender source code and seems a bit more flexible as it’s an image.
I think I will go for pycompositor, I was searching for some fast GL though py. This can open up AI integration as well. Let’s see. Thanks for your suggestion. Very helpful indeed.