[Custom Build] Blender G'MIC, Shadertoy GLSL and Python compositor nodes

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.

Home page and download: https://github.com/bitsawer/blender-custom-nodes
G’MIC demo video: https://www.youtube.com/watch?v=vGNB13ovwk4
GLSL demo video: https://www.youtube.com/watch?v=S5NdgZBxneE
Python demo video: https://www.youtube.com/watch?v=RaYfQT7r74s

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.

1 Like

The glsl one looks very impressive.
More restrictive but faster than anything that we have in composite currently.

That is crazy. This is very creative processing node. So many possibilities. Really cool stuff.

Cool stuff here.

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.


1 Like

@Ko.

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.


2 Likes

Hey this is awesome! I really wish Blender’s main release comes with this feature that allows us to write custom nodes in the compositor!

Hi,
can you adapt the glsl node to work with materials? It would be great to apply shader toy glsl to objects.

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. :smiley:

1 Like

You don’t really need a separate build to run Opengl 4.3+ or Shadertoy code in Blender, just installing a Python library through pip works fine. https://gist.github.com/amb/80d598ca896326488992da258ca95dfe

1 Like

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.