I want to create some image effect. I've written a script that draws a cube mesh at the render target and then copies the render texture at the screen. I don't want to render anything except Mesh(M) in my RenderTexture(rt):
void OnRenderImage(RenderTexture src, RenderTexture dest)
{
RenderTexture rt = RenderTexture.GetTemporary(Screen.width / 1, Screen.height / 1 );
Graphics.SetRenderTarget(rt);
Graphics.DrawMeshNow(M, new Vector3(0.0f, 0.0f, -8.0f), Quaternion.identity);
Graphics.Blit(rt, dest);
Graphics.SetRenderTarget(null);
RenderTexture.ReleaseTemporary(rt);
}
Where M is GameObject.CreatePrimitive(PrimitiveType.Cube).GetComponent<MeshFilter>().sharedMesh;
When I moved my camera, I see this:

It seems like the RenderTexture didn't cleared itself when released. Or maybe I did something wrong? Please explain why this happened and how can I fix this.