- Home /
is there a good way to make a transparent video in unity ?
hey guys. im making a 2d plattformer game. the plan was to use sprite manager for most of the animation but now im running into trouble with size issues. I got the idea to just export them as video files and use them as textures on planes. the alpha layer dose not seem to be supported in the format that unity converts the video into, but I got a simular effect with some bending mode but then I also let the background trough all the dark spots in the animation. is there a better way to get the transparency on a video texture?
-raggi
Answer by Dreamora · Jun 13, 2010 at 12:46 AM
Alternatively, as recommended in other answers and on the board, you can use 2 movies and encode your alpha data as grayscale movie in the second one. Then you can use both movie in parallel and utilize the second one as alpha channel provider for the first one in a correspondingly created shader
Just as a sidenote (due to the genre): on the iphone, movie textures don't exist at all, there movie is automatically fullscreen.
I've tried doing this same approach. It works, as in the two videos work where one acts as the alpha input to the other. But they are out of synch. Which is a huge problem.
I'm currently trying an approach in where I have both the rgb and alpha videos both on the same video on top of each other. Ins$$anonymous$$d of playing two videos I'm just playing this one video and offsets the uvs in the shader. Hope it works. Otherwise I'm out of ideas. (the current idea that I'm working on is not $$anonymous$$e by the way. I borrowed it from someone in the forum.)
Answer by Horsman · Apr 17, 2010 at 05:13 PM
Try using a shader that cuts out values that are some rediculous color like complete magenta instead of black.
I have such a shader, about to put on Asset Store, but if you'd like to beta test it, I can set you up.
Answer by 3dShark · Dec 05, 2012 at 08:15 PM
I use a GUI to display the movie.
function OnGUI() {
if (wasClicked) { //object was clicked display movie.
GUI.color.a = 0.75;
if (GUI.Button (Rect (610,210,640,360), movie)) {
}
Making the GUI transparent, and also making the movie texture transparent.
Using the GUI seems smart. I would have thought you could just put a $$anonymous$$ovieTexture on it, and also another texture that's just 50% alpha, and it would work, ins$$anonymous$$d of two full movies as people are suggesting.
3dShark: How can you post a GUI in a particular 3d space? I have a video of a checkered flag you drive through to end the race, and want it translucent. Right now it's a box with texture, but if I made it a GUI, how do I make it stay in one location 3d, not 2d?
Answer by Afassolas · Dec 16, 2015 at 06:43 PM
Use Particles Additive and texture the video for transparent background, play a bit with the alpha