private Texture2D RenderTextureToTexture2D(RenderTexture texture)
{
RenderTexture RT = RenderTexture.active;
RenderTexture.active = texture;
Texture2D texture2D = new Texture2D(texture.width, texture.height);
texture2D.ReadPixels(new Rect(0, 0, texture2D.width, texture2D.height), 0, 0);
return texture2D;
}