Auto-illumination of 2d shapes

(David Tschumperlé) #1

I’ve started to work on a new G’MIC filter able to automatically illuminate 2d shapes.
This is a work in progress, I’ll post some results here when new things appears.
Also, any suggestion is appreciated.

For now, what I have currently is a code that automatically transforms an input binary shape as an illumination layer, like in the examples below.
I use a Gouraud model for the illumination.

The idea is that if the user gives an image of a disc as an input, the filter interprets it as a 3d sphere, and illuminates it accordingly:


So far, I’ve tried only simple shapes, but I think it already looks cool :slight_smile:



The plans for now are : allowing more than one shape in the input images (layers with several regions with flat colors).

What do you think ?

Natron SVG animation
(Morgan Hardwood) #2


Game (height)map designers may find this very useful.


I like this!

(Glenn Butcher) #4


  1. Is the light source’s position fixed?

  2. There’s some indication of back-reflection; is that it, or do you specify some sort of ‘fill’ light?

Again, Neat! Neat!

(David Tschumperlé) #5

No, light position (in 3D) is a setting of the filter, so you can place it anywhere.

No, I’ve just implemented the formulas from and got that rendering. I haven’t checked if this was correct as the results already looked cool to me :slight_smile:

(Glenn Butcher) #6

Well, I’d assert “looks cool” is a fundamental test of ‘correctness’ in imaging!

(I am the Knight who says ‘Neat!’ And so I say, ‘Illuminate a Shrubbery!!!’ )


:thinking: Makings of a good filter. First impressions:
– Illumination currently makes it look like it is over- or unevenly inflated. Something between this and the render in Gmic for animation might be an improvement.
– The sharp edges and their illumination break the illusion of 3d-ness.

Source: Wikipedia

Source: My Little Day

When this is done, could we have I chocolate filter? :wink:

Source: Wikipedia

(This might be a joke. Secretly, I am hoping for the illumination of not just empty shapes but ones with relief as well, like the ridges on the chocolate piece.)

( #8

It would like me that it was multilayer. Putting each inflammation in different “Z” levels

(Lyle Kroll) #9

Looks impressive David; sort of like Bevel Reflect Logo. Maybe give option to add different types of textures to would be cool. :slight_smile:

(David Tschumperlé) #10

So, here it is !
A first version of the filter Light & Shadows / Illuminate 2d shape has been published today, and should be available for users of the G’MIC plug-in for GIMP and Krita (requires version 2.2.2+).
Here is a video that shows what it can do.

Right now, I admit I’m quite enthusiastic by this filter, as it really allows shading complex shapes with a few clicks.
Remind also that this is a first version, so subject to changes.

Please let me know what you think about it !

Some before/after comparisons :

( #11

I love this! <3

The Effect could separate by layers and attain something like this:


(David Tschumperlé) #12

Just select Output modes -> New layers and you will get the illumination layer alone, blended with your original image.
Then you can re-work on this illumination layer to create various effects or correct light locally if you want.

( #13

I what thought was in slight variations for each level and something similar to colorize [interactive] for the levels.

(David Tschumperlé) #14

Not planed like this sorry :slight_smile:

( #15

I will have to automate it in a script :stuck_out_tongue:


Melts from the cuteness of the lion. Awesome wizardry you have there, @David_Tschumperle!


I like it, thanks…

( #18

Processing each colour separately

The effect is less a globe and similar to the animations of 2.5D

(David Tschumperlé) #19

That’s interesting.
Have you used the exact same parameters of the filter for all colors ?

( #20

yes. But no it apply it to him to line (black)