Search Unity

Grab Pass - VR Single Pass Coordinate calculation bug

Discussion in 'General Graphics' started by kalineh, Dec 4, 2017.

  1. kalineh

    kalineh

    Joined:
    Dec 23, 2015
    Posts:
    241
    https://github.com/kalineh/unity-grab-pass-single-pass-bug

    float4 scaleOffset = unity_StereoScaleOffset[unity_StereoEyeIndex];
    grabUV = (grabUV - scaleOffset.zw) / scaleOffset.xy;
    grabUV.x += 0.06 * unity_StereoEyeIndex;
    grabUV += _BackgroundTexture_TexelSize.xy * 0.5;​

    See sample scenes. Each material attempts to find correct grab pass coordinates according to documentation / internet searching. Final material SP4 seems to work but there is a hardcoded x += 0.6f which is reported to be different per headset. Cannot find how to correctly calculate UV for grab pass screen coordinates in VR Single Pass!

    The documentation on VR single pass coordinates and the macros/helper functions is really hard to navigate, I can't seem to find clear examples on correct intended practice for these cases. As I sort of understand it's roughly these:

    a) regular VR render (nothing special needed)
    b) stereo render (vert/frag UNITY_STEREO macros for worldspace rendering)
    c) screenspace effects (UnityScreenSpaceAdjustUV, etc)
    d) grabpass (???)

    In any case, this hardcoded offset doesn't seem to fit and I have no idea what a correct shader for VR Single Pass Render + Grab Pass is supposed to look like.

    bug reference: https://fogbugz.unity3d.com/default.asp?975537_3b6e3drr1qvcobl1
     
    ROBYER1 likes this.
  2. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    314
    I reported the same issue, bug case: 968570
     
    ROBYER1 and kalineh like this.