Hello! I try to rotate normal map for terrain by using getPixe and setPixel functions. With texture this works ok, but with normal map some trouble. Resulting texture not looking as normal map and Ive got no idea why. Texture for splatmap looks allright, but normal map dont work properly. Instead of blue color it looks red. Thanks for any help.
public Texture2D RotateTexture2d(Texture2D tex)
{
Texture2D tex1 = new Texture2D(tex.width, tex.height);
int wid = tex.width; int height = tex.height;
tex1.Resize(height, wid);
for (int a = 0; a < wid; a++)
{
for (int b = 0; b < height; b++)
{
Color color = tex1.GetPixel(a, b);
tex1.SetPixel(b, a, color);
}
}
}