2017.2.0f3 single pass stereo blit

I’m seeing this fail in my OnRenderImage() function when the player is set to single pass stereo

tmp = new RenderTexture(source.width, source.height, 0, RenderTextureFormat.Default);
tmp.Create();
Graphics.Blit(source, tmp);
Graphics.Blit(tmp, source);
Graphics.Blit(source, destination);

Where this does not:
Graphics.Blit(source, destination);

Am I doing something wrong setting up my tmp texture? I’m pretty sure I had this working in b9.

I even tried running the blit with a custom material that attempted to do the right thing. FWIW the two UnityStereo* functions seem to do the same thing and I was never clear when to use one versus the other.

Shader “Hidden/SinglePassthrough”
{
Properties
{
_MainTex (“Texture”, 2D) = “white” {}
}
SubShader
{
// No culling or depth
Cull Off ZWrite Off ZTest Always

Pass
{
CGPROGRAM
#pragma vertex vert_img
#pragma fragment frag

#include “UnityCG.cginc”

sampler2D _MainTex;
half4 _MainTex_ST;

fixed4 frag (v2f_img i) : SV_Target
{
// fixed4 col = tex2D(_MainTex, UnityStereoTransformScreenSpaceTex(i.uv));
fixed4 col = tex2D(_MainTex, UnityStereoScreenSpaceUVAdjust(i.uv, _MainTex_ST));
return col;
}
ENDCG
}
}
}

Any thoughts here?

The issue exists, since 5.6.1 version and for me it doesn’t work even with
Graphics.Blit(source, destination) option…
I’ve opened the issue as bug on Unity, and warned Microsoft, but so far there is no solution…

  1. 2017.2.0f3 single pass stereo blit
  2. Graphics.Blit doesn't work when the "Single pass Instanced" is chosen. · Issue #1201 · microsoft/MixedRealityToolkit-Unity · GitHub
  3. https://fogbugz.unity3d.com/default.asp?961425_hnsplal6l8flnpue

Thanks)

Interesting - I had seen these (your?) posts.

The last link to fogbugz is specifically for "single pass instanced" on HoloLens. I’m seeing this for “single pass” (non-instanced) for VR. I’m not saying they aren’t the same bug, I just wanted to point that out in case a dev. was looking at this.

FWIW, blit was working with the pass-through material in 2017.2.b9.

you can try explicitly pass VRTextureUsage.TwoEyes to RenderTexture.GetTemporary(), this will return a doublewide rendertexture which automatically enables single pass stereo when blitting into it.

@syenet
similar issue here… is it a try or are you sure that it could be a solution to the problem?
thx in advance

From my experience, the VRTextureUsage.TwoEyes argument must be passed to make sure the rendertexture works in single pass stereo mode in 2017.2, and it works fine to me.