Applying Image Post-Processing Effects to Right Eye

I am running unity 5.1.2f1.

The change to VR has made the main camera automatically a Stereoscopic camera, which responds to HMD rotational input without me having a say on the matter.

The main problem is that we have post-processing scripts attached to the camera for some postprocessing effects such as motion blur and glowing outlines, but those effects do not appear on the ‘Right Eye’ view.

Is it possible to affect the other eye with an ‘OnRenderRightImage’ callback or through some other means?

Unity 5.4 supports a dual-pass camera for Both eye configuration. It’s tough to determine which eye is being rendered, but you can see it in the camera target texture name. Here’s a script that works for me with the Vive…

        /// <summary>
        /// OnPreRender is called before a camera starts rendering the scene.
        /// Note: For Stereoscopic rendering on Unity 5.4+, we'll be called twice - once for each eye.
        ///       The projection matricies will change accordingly, and we'll need to apply them to the cameras in our stack
        /// </summary>
        private void OnPreRender()
        {
            if (this._PostProcessingFXCamera == null ||
                this._CameraStackByDepth == null)
            {
                return;
            }

            // Get a temporary RenderTexture based on this._PostProcessingFXCamera.targetTexture
            // Now, the docs say RenderTexture.GetTemporary() maintains a cache, but why even incur the overhead of making the call?
            // We'll be good memory citizens and call DiscardContents() in this.OnRenderImage().
            if (this._TempRenderTexture == null)
            {
                RenderTexture sourceTexture = this._PostProcessingFXCamera.targetTexture;
                if (sourceTexture == null)
                    return;
                this._TempRenderTexture = RenderTexture.GetTemporary(sourceTexture.width,
                                                                     sourceTexture.height,
                                                                     sourceTexture.depth,
                                                                     sourceTexture.format,
                                                                     RenderTextureReadWrite.Default,
                                                                     this._AntiAliasingLevel);
            }

            // Render each camera in the stact to targetTexture
            for (int i = 0; i < this._CameraStackByDepth.Length; i++)
            {
                Camera camera = this._CameraStackByDepth*;*

camera.targetTexture = this._TempRenderTexture;
// TODO: We seem to be able to to get away with setting only these two. See if we can reduce this to one.
camera.projectionMatrix = this._PostProcessingFXCamera.projectionMatrix;
camera.nonJitteredProjectionMatrix = this._PostProcessingFXCamera.nonJitteredProjectionMatrix;
//camera.worldToCameraMatrix = this._PostProcessingFXCamera.worldToCameraMatrix;
camera.Render();
camera.targetTexture = null;
}

}

///


/// OnRenderImage is called after all rendering is complete to render image.
/// Note: For Stereoscopic rendering on Unity 5.4+, we’ll be called twice - once for each eye.
///

///
///
private void OnRenderImage(RenderTexture src, RenderTexture dest)
{
if (this._TempRenderTexture == null)
return;
Graphics.Blit(this._TempRenderTexture, dest);
this._TempRenderTexture.DiscardContents();
}