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: 28
Joined: Sat Jun 15, 2019 9:33 pm
Contact:

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

Post by DwayneDev »

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 5735 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
Party member
Posts: 131
Joined: Mon Sep 08, 2014 7:57 am

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

Post by Sasha264 »

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: 3468
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 »

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: 28
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 »

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 5681 times
OOF2.JPG
OOF2.JPG (30.93 KiB) Viewed 5681 times
.MPG4 does support aplha channel but does not work with Love 2D of course.
thisWorkedActually.JPG
thisWorkedActually.JPG (17.85 KiB) Viewed 5681 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: 28
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 »

oof.JPG
oof.JPG (31.37 KiB) Viewed 5681 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: 28
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 »

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
Party member
Posts: 131
Joined: Mon Sep 08, 2014 7:57 am

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

Post by Sasha264 »

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: Bing [Bot], Google [Bot], Semrush [Bot] and 7 guests