UnityPlugin-AVProVideo
UnityPlugin-AVProVideo copied to clipboard
Add VR Single-Pass Instanced mode support to AVPro
Right now video and Media Player UI only rendered in one eye in VR mode when using Single-Pass Instanced mode. Starting from Unity 2020.1 they removed regular Single Pass mode support and only left Multipass and Single-Pass Instanced modes so AVPro not usable when using SPI mode on new Unity versions. (And Multipass is a bad alternative since it much slower)
Is is possible to add SPI support to AVPro by default?
For now after every AVPro update I have to modify shaders manually to add SPI support to them.
It's a simple edit, I have to add:
UNITY_VERTEX_INPUT_INSTANCE_ID
to appdata struct
UNITY_VERTEX_OUTPUT_STEREO
to v2f output struct
and
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_OUTPUT(v2f, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
to v2f vert
and #pragma multi_compile_instancing
More info about SPI integration can be found here: https://docs.unity3d.com/Manual/SinglePassInstancing.html
As far as I know we do support this in most of our shaders. The MediaPlayer demo scene just isn't assigned a shader that supports stereo by default. If you assign a stereo shader then it should work?
I checked demo scene and creating custom material with one of AVProVideo Lit/Unlit/Transparent shaders then plugging in this material into VideoPlayerUI/Video/VideoDisplay/Display uGUI component indeed works for video but not for demo Media Player UI parts.
For example for default demo scene AVPro selects AVProVideo/Internal/UI/Transparent Packed
shader that does not support Single-Pass Instanced mode. Also some demo media player elements rendered only in left eye because Unlit/MediaPlayerUI
also missing SPI support.
Can this support be added to media player demo UI shader and internal shaders from Shaders/Resources folder too, so I won't need to manually create custom material with SPI supported shader each time?
Can you just support Single pass? We've got a complex app which uses 3D and video (including spherical video) and we need all the performance we can get for all this.