PDA

View Full Version : Normal Mapping with nodes...



JNN
05-08-2007, 01:50 PM
I've been trying to apply a basic normal map to an object...just a very simple strawberry and I have a normal map of the dimples...and I've made a node tree that pipes the normal map through a vector multiply and a vector subtract then into the normal channel of the surface.

I know very little about nodes and "why" I am doing what I am doing...I saw this node tree here on the forums and copied it to get the normal map to work. I have found that if I put -1 in the "multiply" node for all values...the map seems to work.

Can anyone tell me WHY this is? What am I doing mathematically. Why do I need to pipe it through a multiply and a subtract...shouldn't it simply be able to pipe into the normal channel directly?

Also, when I do this, it seems not to interact with the lighting in the scene. Is there any way to make it work with the scene based lighting?

Any input would be appreciated...

-John

dpont
05-08-2007, 02:54 PM
NT should add a note in its Normal node to avoid confusion,
this node works in "Tangent Space" also called "Texture Space",
if you got such normal map you don't need any math tree,
connect directly the normal output in the Node Editor normal
input.
If you got an "Object Space" normal map, this node doesn't work,
you could use NormalMapShader or TB_NormalMap shader plugins
which work in this space, or use a Image node (not the Normal node)
and then do some math, shortly a color is a positive vector clamped
to 1.0, xyz are between 0 & 1, but a normal is full normalized vector,
xyz are between -1 & 1, so you need to multiply the color by 2
with the Math Vector Multiply node, and substract 1 (-1) with the
Math Substract node to get a proper normal in local coordinates
for normal input in the root node.

The problem with the "Object Space" or local is that the mapped
normal is not correctly transformed (rotated/deformed) with the
object.The "Tangent Space" works well with transformations.

if you don't know the "Space", "Tangent" has a cyanish dominant
color, the "Object" (often) a full spectral color variation.

Denis.