Material function 'RotateAboutAxis' not behaving like I expected it to

I’ve managed to narrow this down to the most basic use case that doesn’t make sense to me. So as we all know, hooking up the vertex normals of a sphere to the base color in a material produces that classic multicolored look, with one part of the sphere completely black, the opposite part completely white, and then a mixture of red, green and blue in between.


All I want to do is rotate this pattern around an abitrary axis, with time. I thought the ‘RotateAboutAxis’ function sounded like the perfect way to do this:


With this material, I’m rotating about the X axis. It appears that the rotation has killed the X component of every input position, so the sphere now only shows Y and Z (green and blue).


The animation is also really messed up - it rotates 180 degrees, then snaps back to the start. And the colors are faded in the first and last few degrees of the rotation. Changing the axis doesn’t help - Normalize(1, 0.1, 0, 0), then the red component comes back faintly, Normalize(0, 1, 0) then the red comes back entirely but the green component disappears. What am I not understanding about this function?

You need to add result of the node to your original vertex normal and normalize the result, since the node outputs the difference between original position and rotated position.

To add to the last post, although you probably know this already, your Axis, is already normalized, no need to normalize it again before passing it into the rotation function.

Thanks, that explains why the axis component is being completely dropped in this case. I’m new to Unreal material development, is there some kind of convention or reason this returns an offset instead of the actual returned value?

Axis is a parameter, so it isn’t guaranteed to be normalized.

I’d guess for a convenience. Primary usage for this node would be vertex manipulation that would be supplied to material world position offset input pin, which takes the offset rather than new position.


I’ll be in the dunce corner. :smiley: