GetPixels of RenderTexture

RenderTexture Inherits from Texture, as well as Texture2D, but of course the Texture2D function GetPixels can’t be used on RenderTexture.

Is there a way to transfer the current frame of a given camera’s RenderTexture to another texture?

As explained on your other thread, the only way is making the rt the current texture, use readpixels, then disable it again

RenderTextures can not be read because they don’t exist outside the graphic card at all. so without drawing them to screen and read from screen, there is no way to transfer them through CPU commands like readpixel etc

Can’t believe it because we can put RenderTextures as texture for objects, so in any time they are accessible.

Seems clear that ReadPixels only works on screen, so this is not the way, unless we can render a camera off screen, in a back buffer o similar.

RenderTexture normally works off screen. It’s only when you try to make ReadPixels when the current RenderTexture camera becomes active and renders in the viewport.

They don’t need to be accessable to be rendered, actually being accessable is one of the worst attribute for a texture when it comes to rendering performance (thats why Unity 2.6 added a checkbox to declare a texture be readable or not).

To render, a texture only needs to be in VRAM, from where it then can be bound and rendered as texture for a specified mesh. Thats exactly that happens if you use the rendertexture on a model / GUI.DrawTexture

As for becoming active and render in the view port: When done right, this render does not even appear.

Question is: what do you in detail try to achieve?
And did you consider looking into the OnPreRender and OnPostRender callbacks to write the current render output of a camera of your choice on the fly into an RT to then grab it?

I want to create several textures with this method, and now I got it working by assigning values manually, but not in a decent loop.

I think I’m going to get it work, but the whole process has so many arbitrary tricks that I don’t know if I will be able to explain it.

A reflexion: I come from programming with Quest3D. It is not perfect, but it has the Texture object. Period. When you do a render to texture, you do a render to Texture, not to RenderTexture.
I wonder why this mess of texture types (Texture, Texture2D, RenderTexture… and there are more…)

I know… RenderTexture only exists on the card and so, but I don’t find programming with Unity productive enough.

Forget it. I’m just pissed because I spent a week with one thing in Quest3D I would had done in 30 seconds…