[Custom Build] Blender with a G'MIC image compositing node

I have made some experiments with Blender compositor functionality by adding a new node exposing G’MIC image processing functionality. It is most useful with NPR rendering, but it can be used in other ways too. I grew tired of manually processing, depth merging and combining the image layers in Gimp with a bunch of clumsy helper scripts. Version 0.2.0 now also supports many popular G’MIC GIMP extension filters.

Here is a demo video.

Here is the source code repo with a link to a binary release (Windows 64 bit)

No Linux or Mac builds yet. The binaries built with Visual Studio 2017 and it should be a drop-in replacement for Blender 2.79. Still, it is experimental so take backups of your work just in case. If you test it let me know if it worked on your machine or if you had any problems. If you get a missing .dll error, try installing Visual Studio 2017 Redistibutable.

Some other ramblings:

  1. I’m also investigation the possibly of adding a GLSL image processing node (might be very tricky because of the OpenGL context and threading). It could make possible to use filters from Shadertoy etc. Is there any interest in these kind of additions or can anyone suggest something similar that would be more useful to people? I tried googling around, but I couldn’t find if anyone has already done something like that.

  2. One other idea I have been playing in my head with is to make a Python compositor node (a bit like OSL node in Cycles). RGBA data is passed to user defined Python code as a Numpy array and the code can modify the data or pass it to external programs/libraries and back without a need to recompile Blender. Could be very slow in worst cases, but for simple things it might be fast enough. I would need to investigate how the Python GIL etc. interacts with the compositor node threading…

This is really cool!
Unfortunately I can not test, I am a Linux user.

I am not a programmer, but I have read before how difficult it is to integrate external filters into Blender nodes in compositor. I hope that in Blender 2.8 there is some change related to this to make the task easier for developers.

Most excellent! Well done. I would certainly vote to have the full G’MIC filter library set available as a compositor node. I agree with YAFU that it may take a refactoring by Blender Code 2.8 to make this possible but it is certainly very useful. Making it an Addon, rather than a required build would also be good, as Blender Institute probably won’t integrate the build but as an Addon, anybody could choose to use it. Thank you again for the effort on all our behalf.

Can you also see on vapoursynth lib integration?, please.

Thanks, everyone. I just uploaded version 0.2.0 which now supports the G’MIC GIMP-plugin commands. Most filters seem to work nicely, but some don’t. It is something I’ll have to look into more. Make sure you have the GIMP-plugin files installed (check the readme in the first link). If you have been using the GIMP-plugin previously with GIMP, you probably have at least some of those files.

I’m not really familiar with vapoursynth so I have no idea how difficult it would be to add to Blender. What would be some typical use cases for it?

Is that still relevant after the denoiser was added to Cycles? Is vapoursynth faster at denoising or does it work better in some cases? I had a quick look at vapoursynth docs and it should be possible to add a compositor node for that. I don’t know if I have the time for that right now, but I’ll keep it in mind.

I will vote for number 2. :slight_smile: It’s more portable. I would have loved to test out the g’mic node, but like yafu, I’m on a different OS (macosx). In case you haven’t seen this thread: https://blenderartists.org/forum/showthread.php?397693-Blender-2-G-MIC-Python-Script-for-Video-Sequence-Editor

Maybe it can give you some ideas.

I think they can have different uses. You can use VapourSynth with very low sample rates and get relatively good results in video, but a lot of detail can be lost.
VapourSynth is not only used for denoising, but other video related issues depending on the filters used. I do not understand much of those things anyway.

If you try it for denoising, I in this message I share a collection of scripts:

Keep in mind that for denoiser, VapourSynth filters analyze more than one frame at a time. So if this is going to be used in Blender compositor, I guess the only way to do this is by loading the sequence of images or the video.
But one advantage of doing it in composer could be for example, to save the images as multilayer openEXR to have better control of the noise reduction with different configurations in different layers.
Regarding the latter I said, I’m not even sure if VapourSynth filters can handle alpha

Is there any continued development on this project. Is there ‘code’ available to make an Addon. Applying a ‘diff’ file and MakeList are a limited avenue. Pablo Vasquez suggested posting Builds, but an Addon, working with gmic and/or gmic-qt (preferred) to provide feedback to the artist while trying to create images, which you demonstrated as possible. Any further thoughts???

Please someone resurrect this project. This would go a long way to allowing more people to work directly inside of Blender to manipulate images and would save a lot of time for batch processing.

Obviously the build is outdated now, can this be an addon for 2.8+ somehow?

I had an inspiration, tried it out, and it worked, straight away! Much to my delight and surprise.
Within Blender, >Edit>Preferences>File Paths I entered C:\Program Files\gmic-2.9.7-qt-win64\gmic_qt.exe into the Preferences. Of course, you have to have already installed gmic-2.9.7-qt on your system for this to work.
Then I opened an Image Editor Window, dropped and image into it, then chose View>Edit Externally and SHZaam!! G’Mic opened with the image, and the Filters all work as expected. At the end Blender pops up with a window of the image with a Close or Save As button, not over-writing the already open image.
This demonstrates that there is code already in place, but it is not a node and doesn’t update the image.
At least something works, from within Blender, using G’Mic.
I have sent this info to the developer in France who has worked on this and just posted an question to the Blender Developers to facilitate the idea of Node Development for G’Mic.

In a partial response to Jonathan-David Schröder’s suggestion, I have created a YouTube video demonstrating of this process. Fairly simple, but may help someone.
Blender G’Mic implementation.
By modifying the “Mix” function and Opacity, this approximates the “Recipe” that I had been using in Gimp/Krita/Photoshop/Affinity (your choice) of compositing Layers to create a final version of an already completed render with a more NPR style approach.