How to rotate normal map texture
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);
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Unity WebCamTexture looks squashed in RawImage 0 Answers
Convert a java script in a c#??? thank you 1 Answer
RenderTexture to Texture2D 0 Answers
How best to implement a tileable ground. 0 Answers