Jump to content
How to Install Plugins ×

Normalize normal map (17 Oct 2024)


Recommended Posts

Color->Normalize normal map

 

Short and simple effect for normalizing normal maps.

 

I got tired of having to use the Photoshop filter shim to use Photoshop-based plugins to normalize normal maps (not that most game engines these days strictly require it, they do it at run time anyway or just plain ignore it resulting in mostly unnoticeable lighting glitches, but it's Polite To Do and might make for more accurate results when blending multiple layers of normal maps together).

 

What does this mean? Normal maps are textures for 3D use and are actually not "pictures" precisely, but vectors defining the surface height details - kind of like height/bump/displacement maps -  and by definition a normal map should be vectors with magnitude 1 with the Z axis (blue) pointing upwards for the most common tangent space normal maps. A color value of 127.5 means 0 (which of course can't ever really exist since paint.net colors can't be fractional), 255 means 1, 0 means -1 along the XYZ 3-dimensional axes. This plugin does just what the spec asks for: makes every pixel have a magnitude of 1.0 in the sense of vectors.

 

There is one option: force Z positive (default on), which will flip the sign of the Z (blue) axis if it is negative. You can turn it off, in which case I suppose it would also be correct for object space normal maps, but I don't work with those. The NVIDIA and xNormal plugins do not force a positive Z axis, or have an option to do so as far as I can tell. The results seem to agree with what Blender and the NVIDIA normal map plugin produce, but differ very slightly from what the xNormal plugin suite does, due to using rounding instead of truncating numbers.

 

It might also have some artistic use for non-3D texturing people, but the end result is not particularly interesting.

 

It's a little hard to make demo images for something that's not really a picture, but I'll try: here's a non-normalized, improper tangent space normal map (the blue axis is 0, meaning it points down which it should not do):

image.png.6801f169cf377328293e50f18608502c.png

Normalized with force Z positive (default):

image.png.35ba2b683cb6f636b98b1eb1d5bd86d6.png

Normalized without force Z positive:

image.png.485a35962c140a98295eaf16987e62d6.png

It looks like this when applied to a photo of a sunset (without force Z positive):

lKPviEy.jpeg

 

 

F_NormalizeNormalMap.zip

Edited by frio
  • Like 2
  • Upvote 3
Link to comment
Share on other sites

I tried it, I like it @frio!  Very nice.  Got some interesting results.  Thank you!  😊

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...