User Tools

Site Tools


Computing a normal map from a 3D surface and several lightings (Polynomial Texture Mapping)


This plugin compute a normal map from an image stack (surface views) and it's associate lighting positions.

The image stack contains images captured from a fixed camera position under spatially variable source of illumination.

I write this plugin using this paper informations : “Polynomial Texture Mapping and 3D representations” / Lindsay MacDonald and Stuart Robson (ISPRS

You can download the paper here :

To test my plugin, I was using a 3D virtual scene done with Blender (


Virtual PTM measures

Here is the scene configuration in Blender (if you haven't real PTM hardware to capture pictures)

Virtual scene for testing

With Blender, I produce 61 pictures of the 3D surface by moving the lamp on each 61 positions.

Here is my Blender test file : Play animation to generate whole picture set.


I use a flat RGB texture on the 3D surface, but the plugin use 8 bits grayscale.

Colored view

61 pictures from the 3D surface :

The 61 captured pictures


For each picture, I record the attached lamp position in world origine. Here is the 61 lamp positions (a text file. Each row contains x y z position).


User manual


1) You can also run the plugin from menu “Analyze / Tools / Normal map computing using PTM”. The image stack containing PTM measure must be already opened

Plugin calling

2) Choose the lamp position file

Lamp positions

(The stack size must be the same than the lamp positions, not necessary 61)

3) Choose the texture size and position in the real world (using same origin than lamp position)

Texture size setting


If you checked “Invert normals”, it produce the second map.

Normal map Inverted normal map

(For example, Blender use inverted normal map)

Plugin download


It use this following libraries : “Jama”, “JLapack”.

Plugin installation

Copy the .jar file to your plugins directory and restart “ImageJ”.

You can use the script by menu “ImageJ / Analyze / Tools / Normal map computing using PTM”

Source files


Vincent Vansuyt.

Contact me for any questions or suggestions : vincent dot vansuyt at edf dot fr (preferred language : french)


GPL distribution (see licence ). Sources for plugins are available freely. Sources for core are available on request.


First version

Know bugs


plugin/stacks/normal_map_computing_using_ptm/start.txt · Last modified: 2019/04/12 13:13 by

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki