How to include post processing in manual camera render?

Hi, I am using Unity 2019.3.13 and URP. I want to take a super resolution screenshot from a particular camera in the game and have always used the same code for this. Now I have run into the problem that the bloom effect is not being included in the image. The code I had been using in LateUpdate is:

RenderTexture rt = new RenderTexture(resWidth , resHeight, 24);
            rt.antiAliasing = 8;
            camera.targetTexture = rt;
            Texture2D screenShot = new Texture2D(resWidth, resHeight, TextureFormat.RGB24, false);

   = rt;
            screenShot.ReadPixels(new Rect(0, 0, resWidth, resHeight), 0, 0);
            camera.targetTexture = null;
   = null;
            byte[] bytes = screenShot.EncodeToPNG();
            string filename = string.Format("C:\\Desktop\\screen" + (counter++).ToString() + ".png");
            System.IO.File.WriteAllBytes(filename, bytes);

Does anyone know what a fix might be?


I am running into this very same issue today, though in edit mode. In play mode, you can solve this by using a coroutine and waiting for the frame to finish rendering.

void LateUpdate()

protected IEnumerator _RenderFrame()
    yield return new WaitForEndOfFrame();

    // Then your code to capture the image

I'm still trying to figure out a way to do this in edit mode.

I believe I found a viable solution for my purposes. Maybe it will help you or others trying to do the same. Here is the basic code outline. One caveat to this approach is you cannot use camera.Render(), or at least it resulted in a pipeline error about recursive rendering. So instead, I'm using CaptureScreenshotAsTexture to get the existing camera texture without re-rendering.

using UnityEngine.Rendering;
public void EditorStartSequence()
    RenderPipelineManager.endCameraRendering += EndCameraRendering;

public void EditorStopSequence()
    RenderPipelineManager.endCameraRendering -= EndCameraRendering;

private void EndCameraRendering(ScriptableRenderContext context, Camera camera)
    if (camera == myCamera) { // check which camera in case you have multiple rendering cameras
        screenShot = ScreenCapture.CaptureScreenshotAsTexture(ScreenCapture.StereoScreenCaptureMode.LeftEye);
        // then save to file using screenShot.EncodeToPNG();

Ok, thanks for your reply, I will use your first suggestion, as I have a vr project where I want to capture a screenshot from a 3rd camera and using ScreenCapture only captures from the headset.