2
$\begingroup$

Here’s a customized shape which has surface’s texture to be the z coordinate of all pixels, from Normal Texture Coordinate:

enter image description here

enter image description here


Here’s what I tested:

The z coordinate of the pixels which are…:
…orthogonal to the z axis, are evaluated 1 (i.e. the maximum value).
…rotated 45° from the z axis, are valuated 0.7.
…0° from the z axis, are valuated 0 (i.e. the minimum value).


I have questions, please help me:

Biggest question:
How does Normal Texture Coordinate evaluates pixels?

Smaller questions:
If a face is 90° to a direction specified by Normal Texture Coordinate (in this case, the z axis), then that face has the maximum value, which is 1, OK makes sense.
But if a face is 45° to that direction, then the value of that face should have also been half the value of 1, which is 0.5, right? Why and how did Blender calculate it to be 0.7?
What would happen if I rotated the pixels 170° instead, which means almost parallel to the z axis?

Thank you.

$\endgroup$

1 Answer 1

6
$\begingroup$

Texture coordinate/normal outputs the object space normal, a unit-length vector.

If we separate the Z component of that, we're getting the amount that the normal extends in the object-space Z axis.

If all edges are sharp, as they are in your pic, it'll depend only on the faces. If they are not, this only depends indirectly on the face angle: the face normals are used to generate vertex normals, which are then interpolated across the face and renormalized to create the output.

But if a face is 45° to that direction, then the value of that face should have also been half the value of 1, which is 0.5, right? Why and how did Blender calculate it to be 0.7?

You are getting the cosine of the angle. The cosine of 45° is the square root of 2, divided by 2-- about 0.7. One way to imagine this is to imagine a circle at the center of a graph: if we draw an angle through that circle at 45 degrees, we'll get about 0.7,0.7 as our coordinates. Those coordinates are cos(45°), sin(45°). We won't get 0.5,0.5 because that's not 1 unit long, and a circle is defined as being the set of points exactly 1 unit distant from some center point-- and a normal is 1 unit long as well.

What would happen if I rotated the pixels 170° instead, which means almost parallel to the z axis?

You will get a Z coordinate of -0.98ish-- cos(170°). If you output this directly to your surface, as in your pic, this will get clamped to 0,0,0 black.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .