我目前正在 Unity 中开发一些反射着色器。我对着色器完全是新手。我发现了一篇关于立方体贴图旋转的文章。我已经完成了一些实现,但似乎无法正常工作。我在顶点着色器中旋转了立方体贴图,仅正常旋转。
我怎样才能达到这种效果?
float3 RotateAroundYInDegrees (float3 vertex, float degrees)
{
float alpha = degrees * UNITY_PI / 180.0;
float sina, cosa;
sincos(alpha / 2, sina, cosa);
float3x3 m = float3x3(cosa, 0, sina, 0, 1, 0, -sina, 0, cosa);
float3 r = float3(mul(m, vertex.xyz) ).rgb;
return r;
}
void vert (inout appdata_full v, out Input o) {
UNITY_INITIALIZE_OUTPUT(Input,o);
v.normal = RotateAroundYInDegrees(v.normal, _Rotate);
}