Videos with an alpha channel?

Started by Monsieur OUXX, Mon 14/03/2011 11:18:56

Previous topic - Next topic

Monsieur OUXX

- If I'm not mistaken, the "ags_theora" plugin doesn't take the transparent color in account.
- I've asked the AGDi team how they did their transparent videos in KQ1, 2 and 3. They said they're actually imported frame by frame (even though they'd use the tiled import, it's not the ideal solution because it allows only short videos and  I guess it uses a lot of resources (possibly RAM)).

Are there any other alternatives?
 

Dualnames

There is a workaround, but not sure if you're gonna like it. At least if I was desperate I'd do it. I'd export my video in frames (via RAD Tools), then import in AGS as alpha blended sprites. Next thing would be to set the scene that will play the images. Then I would take pictures via AGS of every frame. Then make a video out of those frames, then export to ogg, then use the theora plugin (apparently to save space), deleting the images.

It really depends though on what exactly you're trying to accomplish, and that method above is quite stupid, but it's an emergency workaround.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Monsieur OUXX

Quote from: Dualnames on Mon 14/03/2011 13:56:56
There is a workaround, but not sure if you're gonna like it. At least if I was desperate I'd do it. I'd export my video in frames (via RAD Tools), then import in AGS as alpha blended sprites. Next thing would be to set the scene that will play the images. Then I would take pictures via AGS of every frame. Then make a video out of those frames, then export to ogg, then use the theora plugin (apparently to save space), deleting the images.

Well actually no need to go through such tremendous efforts to achive this workraound. I've used a mask in my editing software and rendered the video that way -- it already incorporates the AGS background.

However Id'like to apply filters to the frames at run time. (don't tell me about performance issues, I don't care about that). Those filters should apply only to the animation, not to the background it's blended into. So I guess I'll have to stick to the "frame by frame" export/import solution.
 

Calin Leafshade

I'm afraid that lossy compression + transparency do not mix.

If you have a movie compressed using lossy compression then the alpha channel also gets messed up or, alternatively, wont match the other channels.

if you want transparency you need to use a lossless format like FLIC or a PNG sequence.

Monsieur OUXX

Quote from: Calin Leafshade on Tue 15/03/2011 10:43:01
I'm afraid that lossy compression + transparency do not mix.

Yes, I thought of that issue too. I'm not discussing the format yet. Let's assume the colors issue is solved.

But what do you think would be the best solution to play it, assuming it was imported as tiled frames?
Would an array of DynamicSprites, each of them being simply pasted into the background in rep_exec_always, be a complete suicide?
Would there be a way to optimize that? I'll have to run tests to see how long it takes to load a video of a few hundred frames into such a structure.

Quote from: Calin Leafshade on Tue 15/03/2011 10:43:01
FLIC
The issue remains: AGs does not manage transparency natively, does it?

 

Calin Leafshade

Depends entirely on the resolution.

Eternally Us had full screen PNG renders perfectly fine.

You shouldnt load the images before you need draw them though. AGS has a dynamic sprite cache which deals with all the memory management for you.

If you load an array of DynamicSprites, AGS will be forced to keep all the sprites in memory.

If its a higher resolution (something like 1024) then I would recommend using a plugin to bypass the internals altogether.

Monsieur OUXX

Quote from: Calin Leafshade on Tue 15/03/2011 11:44:30
If its a higher resolution (something like 1024) then I would recommend using a plugin to bypass the internals altogether.

YEah, I was afaraid of that. Darn.
 

theo

In my experience the theora plugin completely ignores the alpha channel. This doesn't surprise me though, animated alpha channels are for some silly reason still sort of taboo, so people don't expect anyone to want to use them. I agree though, one could have a lot of fun with them. I can see many situations where this feature could come to good use.

Calin has a point though. Lossy image + alpha does ring warning bells in my head. It could result in some pretty awful artifacts.  (Though flash games do this all the time and get away with it somehow, it's obviously not rocket science.)

Monsieur OUXX

Quote from: theo on Tue 15/03/2011 23:10:04
Lossy image + alpha does ring warning bells in my head. It could result in some pretty awful artifacts.  (Though flash games do this all the time and get away with it somehow, it's obviously not rocket science.)

I'm not sure what you're referring to, but I suspect what you mistake with videos with an alpha channel are in fact vectorial animations (rendered in real time -- since the antialising and the alpha are built-in, the effect is achieved "by design").

At the moment I'm learning Blender (like a big n00b) but I guess I'll have to divert some precious time resources towards writing a FLC-with-transparency-plugin-for-AGS ;-)   (and also towards understanding the basics of video decoding -- and also towards installing MSVC -- and also towards managing to compile an AGS plugin). Haha, that's an unexepected twist in the plot. My game has only 8 rooms! FATALITY
 

theo

Quote from: Ouxxey_games on Wed 16/03/2011 10:32:25
I'm not sure what you're referring to, but I suspect what you mistake with videos with an alpha channel are in fact vectorial animations (rendered in real time -- since the antialising and the alpha are built-in, the effect is achieved "by design").

No. Import a png24 image with an transparency channel to flash and you will notice it (if you chose to do so) stores the picture as a lossy jpeg. I have used this in several flash projects. It works great for a series of frames, thus creating an animation with alpha. I suppose the alpha is stored in a separate jpg. OR they're using jpeg2000 which I believe -if my memory serves me right- has alpha channel support. This method however obviously won't compress as efficiently as, say, theora or any other common video codec for that matter, since it works on a frame by frame basis and does not compress based on data in previous frames.

mode7

Ouxxey,  what exactly are you trying to do? Im sure there is a workaround somehow

SMF spam blocked by CleanTalk