Search Unity

Ping-Pong RenderTextures

Discussion in 'Shaders' started by Noisecrime, Oct 25, 2011.

  1. Noisecrime

    Noisecrime

    Joined:
    Apr 7, 2010
    Posts:
    2,054
    Hi,

    Does anyone have an example of a ping-pong RenderTexture setup?

    I've been trying to get it working on Windows system and just can't stop the damn process constantly flipping (vertically) the renderTextures every frame. Even if I add code to the shader to try and counter the flip, it still does it, although visually it almost looks like it works for 2 frames, then doesn't work for a few frames, i.e the flipping is slower than when not trying to fix it.

    I'm aware that using DX and rendertextures can cause a vertical flip and account for that in the shader, but even so that shouldn't be causing it to flip every frame, i'd just expect it to be upside down.

    Can't help but think i'm missing something obvious, but I just cannot get it to work. Mind you i'm doing something a little different in that I can't use the graphics.blit feature of Unity as I need to pass information via mesh uv's to the shader, so this is being done via a camera. This causes other issues such as the render sliding across over time due to alignment issues at texel level, but I should be able to sort that out later.

    I just can't stop the damn thing flipping and its getting frustrating. So i'm going to start a new simplified project, stripped down to just doing this ping-pong method and see if that gets me anywhere. In the meantime I figured it might be worth asking here if anyone has any words of wisdom or an example project.

    Cheers