'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..)
Does that sound right?
-Jon
Does that sound right?
-Jon
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.
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.
©h€ck øut µy stuƒƒ åt ragdollsoft.com
New game in development Rubber Ninjas - Mac Games Downloads
aarku Wrote:Looks like there isn't a way to do a filter from a script. I'm out.
-Jon
You can run the script from the script menu, doesn't really need to be a filter does it?
Chopper, iSight Screensavers, DuckDuckDuck: http://majicjungle.com
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.
http://www.adobe.com/devnet/photoshop/pd...pt_ref.pdf
Cheers,
-Jon
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!
Done!
Binary: http://www.sacredsoftware.net/temp/NormalizePNG.zip
Source: http://www.sacredsoftware.net/temp/NormalizePNG.c
Usage:
Let me know if that does the trick.
Binary: http://www.sacredsoftware.net/temp/NormalizePNG.zip
Source: http://www.sacredsoftware.net/temp/NormalizePNG.c
Usage:
Code:
./NormalizePNG inputFile.png outputFile.png
Let me know if that does the trick.
ThemsAllTook Wrote:Done!
Binary: http://www.sacredsoftware.net/temp/NormalizePNG.zip
Source: http://www.sacredsoftware.net/temp/NormalizePNG.c
Usage:Code:
./NormalizePNG inputFile.png outputFile.png
Let me know if that does the trick.
You, my friend, are the MAN. I will let you know how it works out, would you mind if I hosted this on my webserver?
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:
![[Image: 1695896199_dd16369a49.jpg?v=0]](http://farm3.static.flickr.com/2351/1695896199_dd16369a49.jpg?v=0)
After normalization script with correction (Image>Adjust>Auto Levels on Blue channel):
After normalization script without correction:
![[Image: 1695896199_dd16369a49.jpg?v=0]](http://farm3.static.flickr.com/2351/1695896199_dd16369a49.jpg?v=0)
After normalization script with correction (Image>Adjust>Auto Levels on Blue channel):
![[Image: 1695896215_ce01a740f5.jpg?v=0]](http://farm3.static.flickr.com/2351/1695896215_ce01a740f5.jpg?v=0)
Whoops, I definitely messed up. Wasn't thinking right when I wrote the normalization algorithm. Fixing...
ThemsAllTook Wrote:Whoops, I definitely messed up. Wasn't thinking right when I wrote the normalization algorithm. Fixing...
I did a render test, left side is before correction, right side is after...altho the differences are nominal, they are there. Thanks for working on a fix.
![[Image: 1696773347_bb099d0a32_o.png]](http://farm3.static.flickr.com/2016/1696773347_bb099d0a32_o.png)
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.
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.
![[Image: 1698013704_ceadf5ae5b_o.png]](http://farm3.static.flickr.com/2272/1698013704_ceadf5ae5b_o.png)
Possibly Related Threads...
Thread: | Author | Replies: | Views: | Last Post | |
Good tools for editing 2D game data? | Ingemar | 18 | 15,760 |
Jul 7, 2009 08:57 PM Last Post: tcIgnatius |