Murloc_Knight писал(а):возможно ты не так понял мне нужно чтоб при накладывании производилось смешивание цветов с учётом прозрачность или хотя бы прозрачные пиксели игнорировались а ели я правильно понял эти методы просто заменяют пиксели.
Нечто подобное, но только не складывал, нужно было просто хранить альфаканал.
.
Синтаксис:
Используется csharp
....
// load texture rgba32 (source)
Texture2D tex = array[i] as Texture2D;
// check texture format
if (tex.format != TextureFormat.RGBA32)
{
Debug.Log("bad texture format: " + tex.format + ", name: " + name);
continue;
}
// create alpha texture 8 bits (destination)
Texture2D tex_alpha = new Texture2D(tex.width, tex.height, TextureFormat.Alpha8, false);
tex_alpha.filterMode = FilterMode.Point;
tex_alpha.anisoLevel = 0;
// create and fill temp buffer
Color32[] tex_color = tex.GetPixels32();
byte[] buffer = new byte[tex_alpha.width * tex_alpha.height];
// fill buffer
for (int j = 0; j < tex_color.Length; j++)
buffer[j] = tex_color[j].a;
// fill destination
......
// load texture rgba32 (source)
Texture2D tex = array[i] as Texture2D;
// check texture format
if (tex.format != TextureFormat.RGBA32)
{
Debug.Log("bad texture format: " + tex.format + ", name: " + name);
continue;
}
// create alpha texture 8 bits (destination)
Texture2D tex_alpha = new Texture2D(tex.width, tex.height, TextureFormat.Alpha8, false);
tex_alpha.filterMode = FilterMode.Point;
tex_alpha.anisoLevel = 0;
// create and fill temp buffer
Color32[] tex_color = tex.GetPixels32();
byte[] buffer = new byte[tex_alpha.width * tex_alpha.height];
// fill buffer
for (int j = 0; j < tex_color.Length; j++)
buffer[j] = tex_color[j].a;
// fill destination
......
Имея два массива byte[] buffer и byte[] buffer2 с данными альфаканалов, там уже сам можешь воротить что заблагорассудится. Код, что выше, используется только единожды, при загрузке игры. Из-за GetPixels, но это уже другая тема.