I saw that somebody made a tool to convert standard normal maps into the format that is used by the SC2 engine, but is there a tool that converts normal maps from the engine into regular normals? If not, can I do it by hand and if so, how do I do it?
I haven't worked with sc2 normal maps at all, but from what I can see, they have the green and alpha channels with stuff in them.. Assuming they corrospond to the x and y of the normal map, and that the normals should be unit vectors, you could copy the alpha back into the red layer, invert the green (if it was inverted when creating the sc2 normal map), and then calculate the blue based on the red and green.
Having the rgb colors in the range [0, 1]
r = a
r = r * 2 - 1
g = g * 2 - 1
b = sqrt(1 - r*r+g*g)
r = r/2 + 0.5
g = g/2 + 0.5
b = b/2 + 0.5
If r*r+g*g ever becomes > 1, then there is really no way it could be a unit vector.. you could assume that the b should be 0, and then normalize the vector, or you could assume that the b should be 1 always (although that would make it impossible to make normals lie down, so I don't think that is the case).
I don't think it can be done in photoshop, but it is possible to make a program to convert it back.. if those assumptions hold.
Edit:
Just to prove it, I made this quick program.
It can't read the dds format from sc2 though, so use photoshop to convert the pixel format to 8.8.8.8 ARGB
Awesome! Now how do I use it? :) I tried opening a .TGA version of the normal with the program which did nothing, and if I just double click the .exe, I get the message that the program has stopped working (Windows 7 x64) . If you could get this program to work for me I would be eternally grateful.
Yeah, I didn't have XNA 3.1.0 installed, that did the trick :) Now to go though 250 normal maps ^^
BTW, I don't know if you're familiar with the spec maps, some of them are just fine, like this one:
Others have some weird shit in their blue channel, like this one:
Do you have any idea what's going on there? So far what I've been doing is just deleting the blue channel and then taking the remaining channels like they are if they're usable. Sometimes though it just returns unusable color which I "fix" by just turning it greyscale (or just copying the red channel into the rest of the channels, effectively giving me a greyscale image as well). Hope you have any insights on this, and again, I can't thank you enough for the normal map converter :)
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hey again,
I saw that somebody made a tool to convert standard normal maps into the format that is used by the SC2 engine, but is there a tool that converts normal maps from the engine into regular normals? If not, can I do it by hand and if so, how do I do it?
To the best of my knowledge you can't reverse the process.
@Spudnik_II:
yea no. you can't convert black and white to color
all that information is deleted when the normal map is made
I haven't worked with sc2 normal maps at all, but from what I can see, they have the green and alpha channels with stuff in them.. Assuming they corrospond to the x and y of the normal map, and that the normals should be unit vectors, you could copy the alpha back into the red layer, invert the green (if it was inverted when creating the sc2 normal map), and then calculate the blue based on the red and green.
Having the rgb colors in the range [0, 1]
r = a
r = r * 2 - 1
g = g * 2 - 1
b = sqrt(1 - r*r+g*g)
r = r/2 + 0.5
g = g/2 + 0.5
b = b/2 + 0.5
If r*r+g*g ever becomes > 1, then there is really no way it could be a unit vector.. you could assume that the b should be 0, and then normalize the vector, or you could assume that the b should be 1 always (although that would make it impossible to make normals lie down, so I don't think that is the case).
I don't think it can be done in photoshop, but it is possible to make a program to convert it back.. if those assumptions hold.
Edit:
Just to prove it, I made this quick program.
It can't read the dds format from sc2 though, so use photoshop to convert the pixel format to 8.8.8.8 ARGB
Awesome! Now how do I use it? :) I tried opening a .TGA version of the normal with the program which did nothing, and if I just double click the .exe, I get the message that the program has stopped working (Windows 7 x64) . If you could get this program to work for me I would be eternally grateful.
Here's the error message:
It uses .Net 4.0 client profile, and XNA 3.1.0 - make sure you got that installed.
It only works for dds files with the pixel format 8.8.8.8 ARGB 32 bit unsigned. I use Photoshop to convert it.
Might add an installer later.. I just made it quick and dirty before going to bed..
Off to bed now as well - not sure I'll get to work on it tomorrow.
In case you know a bit of programming yourself, and you can't get it to work, the important code is this.
Thank you, thank you, thank you, thank you, THANK YOU! I cannot express how happy you've just made me :)
I assume you found out how to get it to work then :)
Yeah, I didn't have XNA 3.1.0 installed, that did the trick :) Now to go though 250 normal maps ^^
BTW, I don't know if you're familiar with the spec maps, some of them are just fine, like this one:
Others have some weird shit in their blue channel, like this one:
Do you have any idea what's going on there? So far what I've been doing is just deleting the blue channel and then taking the remaining channels like they are if they're usable. Sometimes though it just returns unusable color which I "fix" by just turning it greyscale (or just copying the red channel into the rest of the channels, effectively giving me a greyscale image as well). Hope you have any insights on this, and again, I can't thank you enough for the normal map converter :)