# How to align wave texture perfectly?

Is it possible to align procedural wave texture in Cycles perfectly - say - vertically? Because when assigned to an object (in node editor), it's rotated ~45° or so... I tried playing with mapping, but it's never perfect...

Sphere; loc, rot, scale applied; not unwrapped:

Node setup:

Ok, I'm years late to the party, but the reason the texture is rotated is because it's applying the mapping using the X, Y, and Z coordinates equally. If you want to constrain it to a single axis, you can just use a "SeparateXYZ" node followed by a "CombineXYZ" node and only use the axes you want. For example, as gandalf3 pointed out, if you want the texture aligned along the Z-axis, simply connect the Z output of the SeparateXYZ node to the Z input of the CombineXYZ node.

Likewise, if you want it to follow the X-axis, connect only the X output to the X input. If you choose both Y and Z, your texture will be at a 45-degree angle because it's affected half by the Y coordinate, and half by the Z. You can also think of it bisecting the axes you use.

That's why when you use X, Y, and Z all at once, it points at exactly the center between the X, Y, and Z axes. You might think that's 45 degrees from each axis, but it's not. Since the rotations are applied on top of each other, you get the "weird" values of 35, 45, and 90 degrees (look up Euler angles if you want more info). It's not a mystery once you understand the math (or at least how the math works).

• Thank you for both your answer and your time, however I don't have time to test it. As soon as some people prove it's the right answer, I'll mark it accordingly :) – Selrond Jun 22 '17 at 10:19

I managed to do this with this peculiar set of angles on the mapping node:

Rotations: X: 35d Y: 45d Z: 90d

• Weird... Looks like the default values are not totally random, but why those strange angles then? Isn't this a bug? :P – Selrond Dec 17 '15 at 21:35
• Answering this requires delving into the source, for which the hours is much too late :-P Not sure you can call this a bug, but it's certainly not a feature! – TLousky Dec 17 '15 at 21:37

I'm not sure why, but it appears the wave texture adds the X and Y components of its input coordinates. You can easily correct it feeding it coordinates with the X and Y subtracted: