Auto-illumination of 2d shapes

Other experiment with this script:

Repairing the parts using the previous layers as mask.

1 Like

Another test, Really like how it defines the volume despite that I just ran the script in a single layer. I also tried to combine this script with a relief light to get some extra highlights.


I’ve worked hard this week end, and finally updated this filter with some new options :

  • Input type lets you choose between “Single opaque shape over transparent background” or “Multiple colored shapes over transparent background”, which is clear enough I think :slight_smile:
  • Added parameter Output as to be able to generate z-map or normal maps.

Some screenshots:

Original image.

With ‘Input type’ -> ‘Single opaque shape’

With ‘Input type’ -> ‘Multiple colored shapes’

With ‘Output as’ -> ‘Normal map’


Also in this solution in which repair inferior layer (darker) by repair [patch-base] or [morphology]


1 Like

Another update of this filter, pushed today !
You can now manage ‘Bump maps’ and ‘Normal maps’ also as inputs, so basically, you can let the algorithm has a first guess for a bump/normal map from a 2d shape, then correct it or add details if necessary, and run the filter again on the corrected version to render the corresponding illumination.

A few more examples of completely automatic shading :


Another update of our filter Illuminate 2d shape today. Now you can add guide strokes to your image to help the filter estimating a better bump map, with better illumination results only with a few clicks !
The example below shows why guide strokes are cool :slight_smile:

And here is a video on how to do this kind of things (and even better, with editing of the bump-map).


Pretty cool stuff, David. Also looks like a cool way to create depth maps too. :slight_smile:

Cool, thanks…

Wow this is huge!
Adding guides is super helpful, you can direct the flow of the shading and get some really cool results!
I’ve also been playing around with getting the bump map out and applying it to a mesh. It seems promising to use this technique to generate your own textures from really simple starting shapes or patterns.


Looking this tree think that it could deform the painting with the new bump

Thanks for the tests and feedback.
I must say I’m quite happy with this filter. I think I’ve finished it (I mean, right now, I don’t have other ideas of improvements :slight_smile: , and I’ve lot of other work to do anyway).

Of course, I’m interested by any cool experiments, so do not hesitate to share your results !


I mean, right now, I don’t have other ideas of improvements

You could see if @dubi’s bumpmap idea could be extended to create Spritelamp-like functionality, except automated.

For those who aren’t familliar with Spritelamp, it is a program that lets artists create bump-maps for sprites by also taking hand-drawn lighting angles from four directions. Images/gifs below explain it better- I copied without permission, but the intent is to save the dev of Spritelamp some bandwidth - if you’re interested in the tool and perhaps want to buy it, this is the website of the developer





Perhaps the tool can already be used as-is to generate these four inputs for Spritelamp!

1 Like

Yes, but that can be already done with a few scripting work :slight_smile:
You also made me realize than scripting this filter can also generate cool illumination animations.


I’ve added an interactive preview module in the filter Illuminate 2d shape: it is now more easy to get an idea on how the estimated normal map behaves for different light directions.


Could choose here the position of the light

  1. Wow cool.
  2. Why do you need a second preview window. Can’t you add it to the normal preview window?
  3. It would be very useful to have such a preview in the “3D elevation” filter too.

No, the G’MIC core has no control over the Qt-widgets used by the plug-in, that’s why it manages its own window. This way, the filter interactive preview can run also in the GTK plug-in, as well as from the command line.

Maybe one day, at least if someone is willing to contribute :wink:

Nothing short of wow. Enjoyed the video, David. :slight_smile:

This animation reminds me of the introductory shot of the adult Magneto moving the old German coin between his fingers in the movie X Men First Class.

I wish to use this in #software:natron @devernay