Skip to main content
Notice removed Draw attention by Felox
Bounty Ended with Gabriele Stramandino's answer chosen by Felox
tried to solve the issue
Source Link
Felox
  • 77
  • 6

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.

pix2pix effect postprocessing

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 : pix2pix effect

Here without : without effect

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);

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.

pix2pix effect postprocessing

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 : pix2pix effect

Here without : without effect

Is there a way to get an in-between?

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.

pix2pix effect postprocessing

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 : pix2pix effect

Here without : without effect

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);
Notice added Draw attention by Felox
Bounty Started worth 50 reputation by Felox
Embed repo link with markdown, minor formatting
Source Link
liggiorgio
  • 4.9k
  • 6
  • 26
  • 37

I'm trying to build a game with a specific post-processing effect (available here:that uses the https://github.com/keijiro/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-post-processing render. The PostProssesingpost-processing effect allows only an off-on feature.   

pix2pix effect postprocessing

I'm trying to get an in between-between that I could access via script in order to change the render

Here with the post processing : pix2pix effect

Here without : without effect

isIs there a way to get an in-between  ?

Thanks in advance

I'm trying to build a game with a specific post-processing effect (available here: https://github.com/keijiro/Pix2Pix ). It works well but I want to fade this effect with the non post processing render. The PostProssesing effect allows only an off-on feature.  pix2pix effect postprocessing

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 : pix2pix effect

Here without : without effect

is there a way to get an in-between  ?

Thanks in advance

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. 

pix2pix effect postprocessing

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 : pix2pix effect

Here without : without effect

Is there a way to get an in-between?

Source Link
Felox
  • 77
  • 6

Unity fade post-processing effect

I'm trying to build a game with a specific post-processing effect (available here: https://github.com/keijiro/Pix2Pix ). It works well but I want to fade this effect with the non post processing render. The PostProssesing effect allows only an off-on feature. pix2pix effect postprocessing

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 : pix2pix effect

Here without : without effect

is there a way to get an in-between ?

Thanks in advance