Saturday, April 14, 2012

Photoshop Tutorial: Balancing Contrast in Grayscale Images

I just spent the better part of the day trying to figure out how to reduce the contrast in the red channel of my snake’s normal map. The problem was that some scales were darker than others, but I wanted them to be shaded more or less the same. Here's how the red channel of my normal map originally looked.



The picture below shows what happens when the scales are not uniformly shaded. Notice that the neck is darker than the rest of the body and that there are some vertical patches of dark scales going from the neck to the middle of the snake. In addition, the lower part of the body is plunged abruptly, not gradually, into shadow. All this can be corrected by balancing the contrast among the scales.



I’m sure there is more than one way to do this in Photoshop, but the method I came across is fast and reasonably effective. If I had known how to do this from the get go, I would have saved myself several hours of frustration. Before I forget my hard-earned knowledge, I’ve documented the procedure here.
  1. Duplicate your original image as a new layer on top of it. If this layer isn’t a grayscale image, convert it to grayscale by clicking the Image menu and selecting Adjustments/Black & White. Press [Ctrl]+I to invert the duplicated image. Let’s call this layer Inverted.



  2. For the this step, you can do one of two options. I recommend changing the Opacity of the Inverted layer to 50% without changing its blending mode, as shown below.  This will completely neutralize the two layers, forming a uniform gray.


    Alternatively, in the Layers palette, you may change the blending mode of the Inverted layer to Overlay. I tried doing this option initially, but the results were not particularly good. Nevertheless, it may work better with some images, so I included this alternative approach here.



  3. Click the Filter menu, and select Blur/Gaussian Blur. Make sure that the Preview checkbox is checked. Adjust the Radius until you can’t improve the contrast any better this way.




  4. You can adjust the contrast further if you aren’t fully satisfied with the outcome. With your Inverted layer still selected, click the Image menu and select Adjustments/Curves. Tweak the curve a little bit until your contrast is as balanced as you can make it.



  5. Merge all layers so that only the Background layer is left.

That’s it. As can be seen from the picture in step 4, the scales are now toned more evenly than before. Simple if you know how. From here, you can enhance your image further through proper use of layers. In my case, I adjusted the contrast further with the Curves tool to enhance the image. I also made sure that only the scales were affected by the whole procedure and that all other parts of the image retained their original appearance. The final result can be seen below.



I then copied the above image to the red channel of my normal map. Below can be seen the result of this simple correction. Notice that the scales are now shaded more uniformly and that the lower part of the body blends more naturally into shadow.



Edited on 23 April 2012 to illustrate the application of this procedure and to incorporate two alternative options in step 2.

3 comments:

Eguintir Eligard said...

I have a quicker solution that may help you. If you download the free irfanview, you can simply adjust the color correction manually, and you can choose contrast, brightness, gamma and so on by individual color channel. So its basically a 1 step process.

Frank Perez said...

Thanks for the heads up. It's always good to know about free software. That said, I doubt if a quick contrast adjustment would have solved my problem. Photoshop also has this feature, but if I had used it, some of the scales would still have wound up being darker than the rest.

The proper solution involves mixing each tone with its polar opposite to bring it to a halfway tone. Black, when mixed with white, makes gray. This is essentially what is being done in the process I documented here. By inverting a copy of an image, we are creating its "polar opposite" -- its negative in other words. Mixing it with the original image would have formed a uniform gray, however, which is useless for my purposes. By applying a Gaussian blur on the inverted image, we allow some of the details to be retained instead of being completely neutralized.

Photoshop tutorials said...

May be through free software we have limited of resources.