Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Help with Transparent Video in Unity

Discussion in 'Audio & Video' started by GameDevOverdose, Nov 11, 2023.

  1. GameDevOverdose


    Mar 5, 2018
    Hey Guys, so I made this video in After Effects with a transparent background. I rendered the video in .AVI format with RGB + Alpha Channel, now the thing is I need the video in VP8 (.Webm) format, in order to run it in unity with transparency, which is not available in After Effects, so I import the rendered AVI into either Adobe Media Encoder or Premiere Pro but whenever I convert it to VP8 (I enable the "Include Alpha Channel" option) the video has this artifacts as shown in the image. I have tried converting to VP8 .Webm from several different formats with alpha channels but to no avail. I tried softwares like Shutter Encoder and FFMPEG, to convert to webm and while they did give me the transparency with no artifacts, the overall video quality was pretty low after the conversion (even if I dialed up the video's bitrate to the highest value). I tried a Chroma Key Shader to remove the video's background inside Unity, but it doesn't give me the sort of result that I want. Someone suggested me to use PNG image sequence but I feel like for a video that's 15 seconds long, it would have be intensive on the game's FPS. I have also tried finding a way in which I can play a video in unity and then mask it with an alpha video but I don't think that works either. What should I do?

    Note: The reason I'm trying to get .webm working is because I have tried to Apple Prores 4444 format but it simply doesn't drag into my video player component (I use Windows).
  2. mcmount


    Nov 15, 2015
    I've done the same thing just with 'green screen' method with normal mp4 file. Just set inside the shader alpha to the desired 'green screen' value, like;
    if (c.g==1) o.Alpha=0; else o.Alpha=1;

    Another method I've used was a split screen video, side by side, where the right side had the alpha/depth info. This was actually additive hologram shader:

    It was just matter of setting the shader for it.