RenderHeads / UnityPlugin-AVProVideo

AVPro Video is a multi-platform Unity plugin for advanced video playback
https://www.renderheads.com/products/avpro-video/
231 stars 28 forks source link

Fade video using Android OES shader #399

Closed mbzworld closed 4 years ago

mbzworld commented 4 years ago

Hi there. I am trying to create a cross-fade between two 360 stereoscopic videos. Since the OES shader doesn't offer transparency I had to create a copy of it and add this line which I borrowed from this shader: Shader "AVProVideo/VR/InsideSphere Unlit Transparent(stereo+color+fog+alpha"

Line: Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" }

Unfortunately, changing the alpha of the color had no effect whatsoever, both in the editor and in the Quest build. I tried the shader mentioned above and it worked on my editor. However, I need to use the OES so I can utilize the Fast OES feature since the video specs are demanding.

AndrewRH commented 4 years ago

Hi @mbzworld

I believe you also have to add one of these lines to the shader to set the blend mode you require:

Blend SrcAlpha OneMinusSrcAlpha // Traditional transparency Blend One OneMinusSrcAlpha // Premultiplied transparency Blend One One // Additive

You may also have to change ZWrite field so it doesn't write to the ZBuffer.

Does that solve the issue?

Thanks,

mbzworld commented 4 years ago

Hi Andrew,

Thanks for the quick response.

I just tried to add what you recommended and it didn't work.

I am attaching the shader here for your reference:

AVProVideo-VR-InsideSphere-AndroidOES-Transparency.zip

AndrewRH commented 4 years ago

Try this one: AVProVideo-VR-InsideSphere-AndroidOES-Transparency.zip

mbzworld commented 4 years ago

Thanks Andrew you are awesome! The shader worked indeed on my Quest. However, it didn't work on my PC.

I guess for debugging I should switch the material in my editor. Right?

Ste-RH commented 4 years ago

Yes, but this is depending on your setup I guess. If you are using something like the AVPro Video DisplayUGUI component, no...this will auto select the correct shader for you.

AndrewRH commented 4 years ago

@mbzworld just add this to the bottom of your custom shader:

Fallback "AVProVideo/VR/InsideSphere Unlit Transparent(stereo+color+fog+alpha)"

As the old fallback from the original shader wasn't one that supported transparency.

Hope that helps. I'm closing this issue now.