When writing a shader, for some reason if I try to blend using a MovieTexture, the blending gets ignored. I'm trying to use one movie as an alpha channel to another movie.
I've tried all the built in shaders Unity comes with, but none seem to work properly with MovieTextures. Is this even possible?
Is there a shader out there that's known to blend movie textures properly?
Thanks for heading us in the right direction Kevin. Now, there's a little drawback in your implementation, it uses the same UV for both images, which might not be what everyone needs. I've especially noticed that if you use a regular image as the main texture and a movie texture/quicktime for the alpha texture (great for custom transitions, you can have the alpha QT at a much lower resolution), they do NOT coincide because movie textures apparently use just the bottom left corner of the UV space. To remedy that, I had to make a custom object with two UV sets, the second taking double the size of the first and anchored at the bottom left corner (0,0 in UV space). That plus the fixed script did the trick. Here it goes:
After alot of digging and experimentation with other people's examples, I came up with a shader that seems to work.
The solution involved writing a fragment program. I'm not sure if I'm taking a performance hit by doing it this way, and I'm not sure that it's really impossible to do this without one.
Thanks for the solution. Nevertheless the two movies do not always run perfectly synchronized.
So I tried to have one movie only that includes both: it is double height, has the normal video on top and the grayscale video for the mask on bottom. The material uses this one movie for both textures, while the tilings and offsets are adapted. But for the culling mask the tiling and offset values are ignored - it looks like I need to adapt the shader, but sadly I have no idea about shader scripting. Any help?
One thing I noticed, however, is that there seems to be a tiny delay between the movie and the mask so they may not line up perfectly when they are played.
Anyone with a sample project file? I tried the script but get total transparent material even in preview within Unity Inspector. I use After Effects to output the Alpha quicktime in H264.
Just to confirm in case it is reverse, White is to show and Black is transparent, right?