处理obj模型贴图的时候发现部分贴图有摩尔纹出现,于是做了下处理。
处理之前的效果:
处理后效果
对比来看效果还是挺明显的。下面看关键代码:
var texture = TextureLoader.LoadTexture(texturePath);
texture.name = textureName;
//必须在一个新的纹理上完成
Texture2D newTex = new Texture2D(texture.width,texture.height);
newTex.SetPixels( texture.GetPixels() );
newTex.Apply(true);
currentMaterial.SetTexture("_MainTex", newTex);