'Normalize' normal map after editing in PS

Ok, here is the deal, I am using the method shown here (http://www.cgtextures.com/content.php?ac...normalmap) to recover large scale normal map data from photos with NormalMappr and CS3. The problem is, as noted after step 7, that the blue channel is more or less gone after all this editing, and the texture needs to be normalized to recover the blue channel (as said in the article, 'The reason for the normalize step is a bit complicated. In short, the normalmap is a texture which contains the 'normal vectors' of the surface. The direction of each vector is defined by the red, green and blue channel, the length of the vector is always equal to 1. Because we have been changing the colors, the values might no longer be correct. The normalize step solves this problem, it will make sure each vector has a proper length of 1.')...the problem is, they use the NVidia normal map PS plugin to do this. Now, I do own a Mac Pro and COULD install Windows, and PS, to do this ONE step, but I would much rather not, as it would be a real hassle to go thru all of that for something like this. Not to mention I don't want to repurchase CS3. Can anyone tell me of a reliable way to 'normalize' the normal map on the Mac side of things?

Read you loud and clear. That is a nice technique, too! We just upgraded to CS3 and it looks like it supports JavaScript scripts... I'm going to look into writing a script to do this, that will just normalize the RGB values of each pixel as if they were a Vector3. Hopefully you can make JavaScript filters. (Obviously they'd be slow, but who cares..)

It wouldn't take much effort at all to write a small utility program that reads a PNG, normalizes the color components in each pixel, and writes it back out... If you haven't found an easier way, I'll try whipping one up when I get home.

reubert Wrote:You can run the script from the script menu, doesn't really need to be a filter does it?

No indeed, but looking at the scripting reference I couldn't find a way to get at the actual pixels of a layer. I would sure like to be wrong about this. It looked like the scripting only let you do things similar to what Actions can do.

Najdorf Wrote:Sorry for the OT, but you say "Not to mention I don't want to repurchase CS3": I think you can install it also on windows without having to buy it again, after all it's on the same computer.

My issue is more one of not wanting to have to fracking restart my machine just to perform this one step in the process. Also, I will want to be able to do this multiple times for each texture so that I can ensure the level of detail I recover from the photo is correct for the effect I am trying to achieve.

aarku Wrote:Read you loud and clear. That is a nice technique, too!

Yeah, its a fantastic method for doing this sort of thing, saves me all kinds of time from modeling detail I don't want to have to if I can avoid it. zBrush is great, but the less time I can spend in there, the more time I can spend developing content!

ThemsAllTook Wrote:It wouldn't take much effort at all to write a small utility program that reads a PNG, normalizes the color components in each pixel, and writes it back out... If you haven't found an easier way, I'll try whipping one up when I get home.

This would be great, as I am not a programmer, but rather an asset artist, so anything I can do to shorten my workflow pipeline, the better!

I believe the darks on the blue channel need to be darker...here are some flickr links to show what I mean. I will load both versions of the texture, one without correction and one after, into a normal map in Maya and let you know, ill post renders of both here.

After normalization script without correction:

After normalization script with correction (Image>Adjust>Auto Levels on Blue channel):

ThemsAllTook Wrote:New binary and source posted. Redownload from the same links as posted above. I'm not 100% sure the new version is accurate, but it's certainly closer than the old one... Let me know if it works.

Thank you so much, that works perfectly.

New comparison image, old algorithm on the left, new one on the right. Again, minor differences, mostly in the specular details, but the difference is there if you are looking for it.