I found that I really enjoy the capabilities of Adobe Lightroom and Adobe Camera Raw (ACR) in their capability to just click a little icon and be able to dynamically see which pixels were over/under exposed as you made image adjustments. I have found no direct built in way to do the same in Photoshop. I am somewhat surprised that Adobe has not included a similar piece of functionality into Photoshop.
After searching the internet I did not find any real equivalent solution. The closest I found was various incantations using either the Layers or Curves adjustment sliders neither which would show dynamic results. It was time for some home brew solutions.
I developed about a half dozen ways to dynamically detect and display the over/under exposed pixels in Photoshop and will initially share one of them below (otherwise the post gets too long). First though, we need to define what is over and under exposed. For the purpose of this post a simplified definition would be when any 8 bit pixel reaches its min value of 0 or its max value of 255. An even simpler definition would be when all three channels of an 8 bit RGB image reach a min of 0,0,0 or a max of 255,255,255 (Pretty much the same as when the gray level reaches 0 or 255). This method described below works on this last simplified definition and is similar to what Lightroom and ACR.
Here is a small sample of a Colorado sunset where I purposely set both underexposed and overexposed area.
Here is the same picture with a single added blend layer that shows the over exposures in "red" and the under exposures in "cyan". These "red" and "cyan" areas will dynamically grow and shrink as you make image adjustments in Photoshop so you can tune in your adjustments just like in Lightroom or ACR.
Note that this single blend layer described below should always be the top layer in your layer stack in Photoshop to work correctly (since you do not want it to be a permanent part of your picture). I use Photoshop CS4 yet this method should work with any version that supports an "Invert" adjustment layer and "Blend If" options
Now for simple step by step cooking instructions.
1) Make sure your "Layers" panel is displayed through the tool command
"Window > Layers" and open an image file on which you want to try this method. Having pre-existing layers is just fine.
Click the top layer so when we add the Invert layer it will be inserted at the top of your Layer Stack
2) Add an "Invert" adjustment layer through the menu:
"Layer > Layer Adjustment Layer > Invert..."
You can accept the default options in the "New Layer" dialog box that pops up or preferably type in a name such as "Over/Under Exposure Detector". Click "OK"
Your image will look pretty odd right now with inverted colors. My sunset became a surreal blue.
3) Bring up the "Layer Style" dialog box with the tool command
"Layer > Layer Style > Blending Options..."
4) Only 5 sub-steps in this Layer Style dialog box and your done!
a) Deselect the "R" channel in the Advanced Blending section
b) With the "This Layer" sliders in the "Blend If" section drag the black triangle almost all the way to the right
c) Now drag the white triangle all to the left
d) Finish dragging the black triangle all the way to the right
e) Click "OK"
5) Done (or Voila) and enjoy the feast. You should now be able to make changes to your image any way you want in Photoshop and this detection layer should dynamically show you over/under exposed pixels. By clicking the detection layer's "eye" icon you can toggle this detection on and off just like in Lightroom and ACR (also helps see the detected pixels). There are many sub options to play with in the Layer Style dialog box yet will leave that for discussion. Let me know if you have any problems with these instructions and I will update with fixes or clarifications.
Please provide this blog link to others that might benefit. Attribution would be appreciated if you plan to pass this technique on to others. Or if someone has posted this approach before me, let me know and I will give them attribution. If there is interest, I will post other dynamic over/under exposure techniques
John Wheeler of JKW Consulting LLC