Search Unity

  1. We would like to hear your feedback about Unity and our products. Click here for more information.
    Dismiss Notice

Adopting Single Pass Instanced. What's the proposed strategy here if any for existing packages?

Discussion in 'AR/VR (XR) Discussion' started by Thrawn75, Oct 15, 2017.

  1. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,172
    Let's assume we have a collection of working full-screen image effects that work with both multi-pass and SPSR.

    When SPSR was introduced, many shaders had to be modified to introduce the use of new macros like UnityStereoScreenSpaceUVAdjust to seamlessly support both XR rendering paths. The positive outcome of that change was the support for both multi-pass and SPSR using the same shader code, so it was just another abstraction layer to implement.

    Now, we are presented with another VR rendering path (Single Pass Instanced) which introduces a completely new set of macros to use across the shaders.

    So how is supposed we should support the new Single Pass Instanced in existing full-screen image effects? Specifically I'd like to know if the new APIs will gracefully work with SPSR (non-instanced) - or if not possible, what's the alternative to have full-screen image effects supporting all XR paths (duplicating packages/shaders?).
     
    Last edited: Oct 15, 2017
  2. scottb

    scottb

    Unity Technologies

    Joined:
    Jan 26, 2016
    Posts:
    13
    All of the stereo rendering macros should turn into NOPs in other rendering methods, so they can be combined.
     
  3. Thrawn75

    Thrawn75

    Joined:
    Nov 16, 2014
    Posts:
    2,172
    Thanks.

    Is it possible to have UNITY_SAMPLE_SCREENSPACE_TEXTURE_LOD in the future?

    May SAMPLE_RAW_DEPTH_TEXTURE_LOD be used in its place for now?
     
  4. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    898
    That one works, but seems like a hack, wish they would make a standard practice of providing _LOD for all the macros. Seems very hit and miss.
     
  5. jjxtra

    jjxtra

    Joined:
    Aug 30, 2013
    Posts:
    898
    Code (CSharp):
    1. #define UNITY_SAMPLE_SCREENSPACE_TEXTURE_LOD(tex, uv) UNITY_SAMPLE_TEX2DARRAY_LOD(tex, float3((uv).xy, (float)unity_StereoEyeIndex), uv.w)