Does Love 2D support video with an alpha channel for video overlay?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
DwayneDev
Prole
Posts: 22
Joined: Sat Jun 15, 2019 9:33 pm
Contact:

Does Love 2D support video with an alpha channel for video overlay?

Post by DwayneDev » Thu Sep 12, 2019 3:00 am

I made a video with alpha transparency to overlay it on another video. I wanted to do this to make layers animated backgrounds through video.

Code: Select all

--I've tried it and the transparency of video 2 isn't there
love.graphics.draw(video,425,0)
love.graphics.draw(video2,425,0)

I know this might be weird and ineficcient, I'm already thinking of easier solutions I'm just curious at this point if it's possible in love 2D.

here's what I'm trying to overlay.
transparent.gif
transparent.gif (2.36 MiB) Viewed 292 times
Visit my blog or social medias to play or follow my current game projects:
My blog: https://blog.dwaynedev.dev/
My Twitter: https://twitter.com/Animoodl
My itch.io: https://dwaynedev.itch.io/

User avatar
Sasha264
Citizen
Posts: 60
Joined: Mon Sep 08, 2014 7:57 am

Re: Does Love 2D support video with an alpha channel for video overlay?

Post by Sasha264 » Thu Sep 12, 2019 10:39 am

Hello! :awesome:
I made a video with alpha transparency...
Wow!! How did you do that?
There are surprisingly few video file formats that can contain alpha channel.
Love2d supports only OGV video format https://love2d.org/wiki/love.graphics.newVideo
Just googled it for a bit and couldn't find something about alpha channel inside Ogg Theora.
Are you sure your file contains alpha channel? Can you share it here (not a .gif but .ogv)? Can you see this transparence in some player software?

A few month ago I was looking for some way to store animation with alpha-transparency and found only apng format for me. A good question about supporting it in Love2d :nyu:

And if the is no such options, then I suggest 2 separate videos: one with color + one with alpha along with simple shader will be simplest solution for your task.

User avatar
zorg
Party member
Posts: 2665
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Does Love 2D support video with an alpha channel for video overlay?

Post by zorg » Thu Sep 12, 2019 2:03 pm

Alternatively, if you can sacrifice some shades of black, for instance, you could just use that one video (encoded as an ogv without an alpha channel i mean) and use a simple shader where you discard / draw 100% transparent where the video pixels are below a combined rgb threshold (i'd say 0.0,0.0,0.0 but depending on video quality, that may be too steep of a threshold, experiment)
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.

User avatar
DwayneDev
Prole
Posts: 22
Joined: Sat Jun 15, 2019 9:33 pm
Contact:

Re: Does Love 2D support video with an alpha channel for video overlay?

Post by DwayneDev » Thu Sep 12, 2019 4:15 pm

OKAY. So I was using blender to export video with an alpha channel. after some testing it turns out .ogv doesn't have an alpha despite blender suggesting otherwise. Iused the following settings to export the ogv and the alpha did not work.
mistake.JPG
mistake.JPG (17.55 KiB) Viewed 238 times
OOF2.JPG
OOF2.JPG (30.93 KiB) Viewed 238 times
.MPG4 does support aplha channel but does not work with Love 2D of course.
thisWorkedActually.JPG
thisWorkedActually.JPG (17.85 KiB) Viewed 238 times
Visit my blog or social medias to play or follow my current game projects:
My blog: https://blog.dwaynedev.dev/
My Twitter: https://twitter.com/Animoodl
My itch.io: https://dwaynedev.itch.io/

User avatar
DwayneDev
Prole
Posts: 22
Joined: Sat Jun 15, 2019 9:33 pm
Contact:

Re: Does Love 2D support video with an alpha channel for video overlay?

Post by DwayneDev » Thu Sep 12, 2019 4:15 pm

oof.JPG
oof.JPG (31.37 KiB) Viewed 238 times
Visit my blog or social medias to play or follow my current game projects:
My blog: https://blog.dwaynedev.dev/
My Twitter: https://twitter.com/Animoodl
My itch.io: https://dwaynedev.itch.io/

User avatar
DwayneDev
Prole
Posts: 22
Joined: Sat Jun 15, 2019 9:33 pm
Contact:

Re: Does Love 2D support video with an alpha channel for video overlay?

Post by DwayneDev » Thu Sep 12, 2019 4:28 pm

Thanks for the suggestions, I'll experiment with those concepts.
Visit my blog or social medias to play or follow my current game projects:
My blog: https://blog.dwaynedev.dev/
My Twitter: https://twitter.com/Animoodl
My itch.io: https://dwaynedev.itch.io/

User avatar
Sasha264
Citizen
Posts: 60
Joined: Mon Sep 08, 2014 7:57 am

Re: Does Love 2D support video with an alpha channel for video overlay?

Post by Sasha264 » Sun Sep 15, 2019 10:00 am

Thanks for sharing blender settings!
Transparent videos is a truly mysterious mysteries in our world :3

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests