NME Cube Normals

Hey there,

I’m poking around with NME and I tried a basic shader that takes in the normal and compares it to a vector and uses that to pick a gradient. Here’s how it looks on a sphere:

Here’s how I’m seeing it as a cube

This is not what I would expect, since each face would have a different normal, but half of the faces are white (1.0) and half are red (0.2).

I’m inexperienced so it’s entirely possible that I’m doing something wrong, and if so I’d love for some guidance on this.

I’m not sure what you want to achieve, but the result you get is expected.

The Dot(v1, v2) function will compute v1.x*v2.x + v1.y*v2.y + v1.z*v2.z. As you remapp -1…1 component values to 0…1 values, each factor is positive (with v2=(1,1,1) as in the node material), and when a normal as a 1 somewhere, the result is >= 1, which will pick the white color. For a cube, one component of the normal as a 1 or -1 value, and the two other values are 0. So, when the normal as a -1, you will see a red face, and if it is a 1, you will see a white face.

Hmm, ok. I have since fixed a few bugs and moved away from the example, so it might just be me not understanding it properly. I’ll keep at it.