Home

Remove Lighting From Photos

In a computer game, the lighting is computed in real-time by the game engine. In the real world, where we take photos to use as a basis for textures, lighting comes as part of the photo. The first step is to make sure that your photos are taken on cloudy days, as that avoids strong shadowing (which is nearly impossible to remove). The method presented here will remove diffuse shadows - such as caused by the curvature of a surface, or perhaps slight shadowing by the photographers hand.

The Process

On the left is our starting image. It was taken as a close-up of a rusty barrel, and you can see there is a noticeable lighting gradient across it's surface. On the right is the final image, from which we can extract the rust texture. As can be seen, we didn't lose the colours or the fine detail of the texture.

Now I work in Gimp image editor, but this is easy to replicate in any image manipulation toolbox. The first step is to duplicate the layer and desaturate that layer. Now blur the layer and invert the colour. Finally, set the layer's blending mode to "Soft Light".

If it hasn't equalized the lighting enough, duplicate the layer and adjust it's opacity until it does:

Why does this work?

By desaturating the image and blurring it we extract the lighting data of the image - so long as the lighting has no harsh shadows). Then we invert it and tell the computer to apply it "like light". This results in the computer adding light into the places that were dark and darkness into the places that were light.