graphics.blit not working

How do I make a copy of rendertexture? I tried graphics.blit but the texture I end up with is still blank.
I’m trying to get a duplicate of rendertexture before changes to the screen.

Well, Graphics.Blit is the way to go when it comes to copying texture data around. Could you share some details about how you’re using it?

2 Likes

Since I couldn’t get it to work, I decided to do this:

var texture = new Texture2D(1920,1080);
        Rect rectReadPicture = new Rect(0, 0, 1920,1080);
        RenderTexture.active = Texturesource;
        texture.ReadPixels(rectReadPicture, 0, 0);
        texture.Apply();

Then I just use the texture how I want, but not sure if this is a slower way of doing things. Found that bit of code online somewhere and got it to suit my purposes after messing around a bit

That’s a lot slower than using blit. The reason is that ReadPixels() stalls the entire GPU pipeline as it reads back data from the GPU to the CPU. Unless you need access to texture data from the CPU side of things (for instance to write a screenshot to disk), there should be no need to use ReadPixels just to copy a render texture.

1 Like

Try the example under ConvertTexture.

1 Like

Thanks for this

Finally got blit to work. Thanks again, both who posted. :slight_smile:

2 Likes