The Unity Skybox shader makes use of a vertex shader to rotate the skybox about the Y Axis (Heading).
The function is here :
float4 RotateAroundYInDegrees (float4 vertex, float degrees)
{
float alpha = degrees * UNITY_PI / 180.0;
float sina, cosa;
sincos(alpha, sina, cosa);
float2x2 m = float2x2(cosa, -sina, sina, cosa);
return float4(mul(m, vertex.xz), vertex.yw).xzyw;
}
How do I adjust this to rotate around the X Axis? I understand that the 2x2 rotation matrix is the same, but I’m a little confused by the use of quaternions in the final rotation.