Download

Can I convert XYZ rotation values to be used with the "RotateAboutAxis" shader node?

UE4’s “Rotate About Axis” Shader node takes a normalized rotation axis, and a rotation angle.
I have a bunch of vector 3 rotation values for yaw pitch and roll. How would i convert these values to be compatible with this shader node?

The conversion doesn’t have to be done in the shader, as I could do this conversion in blueprints or c++ and write the result to a texture for use in my shader.

If the material is rotating the object it is applied to around a local axis then you can just do that entirely in the material, I wrote about this here: https://forums.unrealengine.com/development-discussion/rendering/1821595-material-rotate-about-local-y-or-x-axis?p=1821619#post1821619

There is also a blueprint node GetRotationXVector (UE4’s forward vector)

I already tried GetRotationXVector, it wasnt working. Are you sure that is what the RotateAboutAxis shader node needs Akiras?

If I convert the rotator to a quaternion in c++, this seems to give me the correct rotation axis vector. But im not sure how to get the correct angle scalar value to plug into the RotateABoutAxis shader node. Does anyone have any suggestions?

Ah I figured it out. To get the angle, is used ACOSd on the z value of the quaternion. Then divided the z value by 180.