Creating and writing to UTexture2D in the PF_R8G8 pixel format at runtime works well (for direct color lookup onto 256 x 256 textures, R = UV.x, G = UV.y). But I can’t get to save them without them losing their format.
texture->GetPlatformData()->PixelFormat = EPixelFormat::PF_R8G8;
texture->GetPlatformData()->Mips[0]->BulkData.Lock(LOCK_READ_WRITE);
void* data_ptr = texture->GetPlatformData()->Mips[0]->BulkData.Realloc(sizeof(uint16) * source._num);
memcpy(data_ptr, source, sizeof(uint16) * source_num);
texture->GetPlatformData()->Mips[0].BulkData.Unlock();
texture->UpdateResource();
This works fine. But at some point I have to write the following so the texture is saved across sessions :
texture->Source.Init(height, height, 1, 1, ETextureSourceFormat::TSF_BGRA8, (uint8*)source);
Problem is that there is no PF_R8G8 or seemingly compatible 16 bit format in the ETextureSourceFormat enum.
Any workaround?