About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
Alpha channel in video
Author Message
neuroliquid Offline
Member

Post: #1
Alpha channel in video
I am trying to display video with transparency effect.

At this moment I have solution of using other video as mask:

Code:
IMAGE_TYPE gpu_image_type=film.image().type();
   if(!(gpu_image_type==IMAGE_R8G8B8A8 || gpu_image_type==IMAGE_B8G8R8A8))Exit(S+gpu_image_type);
  
   Int gpu_image_size=film.image().hwH()*film.image().hwW()*4;
  
   film.image().lock(LOCK_READ_WRITE);
   film_mask.image().lock(LOCK_READ);
  
   Byte* data=film.image().data();
   Byte* data_mask=film.image().data();
  
   for(int c=3; c<gpu_image_size; c+=4)data[c]=data_mask[c-1];
  
   film.image().unlock().drawFs();

But with full screen video it takes 100% of cpu and framerate drops. Last line seems be the main cause.

Drawing video normally and feeding FadeFx with the mask Images seems to work, so I could use it with lower resolution mask (so extracting image frames would be faster) but the fade effect itself interferes with desired effect.

How can I do it fast?

I also found some information about alpha channel in WebM (http://wiki.webmproject.org/alpha-channel ) but does or will ever Esenthel supports this?
(This post was last modified: 01-15-2016 03:41 PM by neuroliquid.)
01-15-2016 03:40 PM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #2
RE: Alpha channel in video
Hi,

The document link you've attached to the alpha channel in webm video does not mention anywhere if that video codec supports it, or is it a planned feature for the future.
I think the easiest thing to do would be to grab esenthel source and make a custom shader that combines two videos, uses one as rgb and another as the alpha channel.
01-16-2016 11:50 AM
Find all posts by this user Quote this message in a reply
neuroliquid Offline
Member

Post: #3
RE: Alpha channel in video
I've lowered the resolution and It works fast enough at this moment but I am still considering playing with shader.

If it comes to codec - it seems that Chrome supports alpha in WebM:
https://developers.google.com/web/update...rome-video

Thanks for reply
(This post was last modified: 01-25-2016 03:53 PM by neuroliquid.)
01-25-2016 03:48 PM
Find all posts by this user Quote this message in a reply
Post Reply