There is a way to make normal maps from 4 pictures in photoshop where the light shines from different directions each time.
Step 1: Basically you take all images and grayscale them. Then you have the grayscaled images that are lighted from above, from the left, from below and lighted from the right.
Step 2: Create an image where the red channel is the light from the left and the green channel the light from above. (We name this image A
here)
Step 3: rgb = (1 - rgb) * 0.5;
(In the tutorial they use something more complex but this gets very near to those results)
Step 4: Create an image where the red channel is the light from the right and the green channel is the light from below. (We name this image B
)
Step 5: rgb = rgb * 0.5 + 0.5
(Same applies here)
Step 6:
if(B.r <= 0.5)
result.r = (2 * B.r * A.r);
else
result.r = 1 - ((1 - (2 * (B.r - 0.5))) * (1 - A.r));
Now repeat this for each channel except alpha.
This blending method is called "Overlay" in Photoshop or "Hard light" in Gimp. A
is basically the base and B
is the mask.
more details here: https://www.dropbox.com/s/ez2xhir23kkg6c9/Pixel%20blend%20mode%20algorithms.pdf?dl=0
(Note that I modified the algorithm to use a range from 0 to 1 instead of 0 to 255 or 256. This also reduces the / 256
to / 1
or basically nothing)
Step 7: Fill the blue channel with some value. A lighter blue will yield a smoother normal map. So let the user decide on this value. Best would be to start with 0.5
Further details can be found here: http://www.zarria.net/nrmphoto/nrmphoto.html