I'm trying to build a game that uses the Pix2Pix post-processing effect for Unity, which is an image-to-image translation with deep neural networks. It works well but I want to fade this effect with the non-post-processing render. The post-processing effect allows only an off-on feature.
I'm trying to get an in-between that I could access via script in order to change the render
Here with the post processing :
Is there a way to get an in-between?
EDIT:
I tried to follow Gabriele's idea of using color.lerp method to lerp the input and output (named as sourceRT and resultRT), It gives me a gray output, here is what I tried (in Postprocessing.cs) :
// RenderTexture Source to Color[]
Texture2D texSources = new Texture2D(256, 256, TextureFormat.RGB24, false);
texSources.ReadPixels(new Rect(0, 0, 256, 256), 0, 0);
Color[] sourcePixels = texSources.GetPixels(0, 0, 256, 256);
// RenderTexture Result to Color[]
Texture2D texResult = new Texture2D(256, 256, TextureFormat.RGB24, false);
texResult.ReadPixels(new Rect(0, 0, 256, 256), 0, 0);
Color[] resultPixels = texSources.GetPixels(0, 0, 256, 256);
// Blend Pixel comporte un lerping de chaque pixel selon un float
Color[] blendPixel = new Color[resultPixels.Length];
Texture2D blendTexture = new Texture2D(256, 256, TextureFormat.RGB24, false);
// Lerping via a loop in the array
for (int i = 0; i < resultPixels.Length; i++)
{
Color c = Color.Lerp(sourcePixels[i], resultPixels[i], ratio);
blendPixel[i] = c;
}
// tranformation of blendPixel to Texture2d
blendTexture.SetPixels(blendPixel);
// END LERP
// blendpixel
cmd.Blit(blendTexture, context.destination);