Код: Выделить всё
public Texture2D source;
public Material material;
public static void Create(GameController gameController)
{
Texture2D t = source;
gameController.ImprovedPhoto = t;
gameController.ImprovedPhoto =
ImproveOriginalPhoto(gameController, material,
gameController.ImprovedPhoto, 1024);
}
//this is the method where I apply the material to the new texture, using a RenderTexture
public static Texture2D ImproveOriginalPhoto(GameController gameController, Material material, Texture2D source, int size)
{
//gameController.renderTexture.format is ARGB32 and I see in the logcat
//that
CheckSupportRenderTextureInfo(RenderTextureFormat.ARGB32) == true
RenderTexture buffer = new RenderTexture(size, size, 32, gameController.renderTexture.format);
//render material to a RenderTexture using a Blit()
Graphics.Blit(source, buffer, material, -1);
//then create a Texture2D with the same dimensions and format as the render texture
Texture2D new_Texture = new Texture2D(buffer.width, buffer.height, TextureFormat.ARGB32, true);
new_Texture.filterMode = FilterMode.Bilinear;
new_Texture.wrapMode = TextureWrapMode.Clamp;
//and use ReadPixels() to copy the render texture to the CPU memory.
new_Texture.ReadPixels(
new Rect(0, 0, buffer.width, buffer.height), // Capture the whole texture
0, 0, // Write starting at the top-left texel
true);
new_Texture.Apply();
return new_Texture;
}

Я тестировал этот метод на «старом» Redmi Note 9 (M2003J15SS), и там он отлично работает (в редакторе тоже), но когда я тестирую свое приложение на более новом Xiaomi Mi 10T Pro (M2007J3SG), сгенерированная улучшенная фотография выглядит например, ImprovedPhoto.png, с прозрачными линиями, пересекающими его.
У Redmi Note разрешение 1080x2340, у Mi 10T — 1080x2400.
Я использую Unity 2021.3.24f1.Что может быть причиной этой проблемы?
Улучшенная фотография:

Подробнее здесь: https://stackoverflow.com/questions/771 ... ific-mater