public static Texture2D toNormalMap(Texture2D t){
Texture2D n = new Texture2D(t.width,t.height,TextureFormat.ARGB32,true);
Color oldColor = new Color();
Color newColor = new Color();
for (int x=0; x<t.width; x++){
for (int y=0; y<t.height; y++){
oldColor = t.GetPixel(x,y);
newColor.r = oldColor.g;
newColor.b = oldColor.g;
newColor.g = oldColor.g;
newColor.a = oldColor.r;
n.SetPixel(x,y, newColor);
}
}
n.Apply();
return n;
}
Unity3D之将图片转成NormalMap
最新推荐文章于 2020-12-22 22:57:50 发布