I'm trying to concatenate/add a texture into a bigger one but I fail to keep the result of the bigger texture.
I have a shader that takes some variables like a position for the smaller texture within the bigger one, the smaller texture itself and of course the bigger one.
Basically, my shader works correctly ( I think ), in the result I see the smaller texture in the bigger one at the right position. However my bigger texture is never saved, so all the precedent pass is ignored.
How can I save the result to send it again into the shader to concatenate all the small textures into it?
I try this : Graphics.Blit(_RTConcat, _RTConcat, _concat);
RTConcat
is my bigger texture, it's a RenderTexture
, I've tried to create it both in editor or in script but the result is the same and _concat
is the material using the shader.
PS : I'm using unity 4.5.3 and can't upgrade, it's a pro version.
Edit / Update :
I "success" to made something that look like what I want, but I don't understand why it work.
In my main script I init a resulting renderTexture and set it to a mat which apply it on a plane
_radarVision = new RenderTexture(_radarTextureWidth, _renderHeight, 24);
_renderHeight, 24);
_radarScreen.SetTexture("_MainTex", _radarVision);
_radarVision
and _radarScreen
are never edit again in my scripts.
The Graphics.Blit
is now in a new script attach on a camera create only to run a single script :
`void OnRenderImage(RenderTexture source, RenderTexture destination) {
Graphics.Blit(save, save, _concat);
rttmp = RenderTexture.GetTemporary(camera.targetTexture.width, camera.targetTexture.height);
save = rttmp;
camera.targetTexture = save;
RenderTexture.ReleaseTemporary(rttmp);
}`
There is nothing else and it made my stuff working but I'm still bemused because it shouldn't be working... no?