made a small animation with an alpha channel in blender https://mega.co.nz/#!RJBSQKpb!fMRk4P_PJ ... CLjE3VAPlE .
strange thing: if i play the video in the vlc (by default a black background too "nothing"), the behaviour is the same, the fadeout is not visible. coincidence?
\\edit: i think vlc just doesnt support an alpha channel anyway. why should it.
here's the clip itself if that helps: https://mega.co.nz/#!ZFp2lSoS!161okDe5x ... wJyhLrrnkE . it's compressed with the png video codec and includes RGBA.
any ideas?
to use it as a video file in magic. works fine and as expected, but only as long as i dont have a black background. if there is a black background (black polygon or nothing), the fading of the object isnt visible anymore. made a little screen capture to elaborate: bug or feature? alpha channel ignored when background black
Re: bug or feature? alpha channel ignored when background bl
The issue here is premultiplied alpha. Referencing your earlier post (http://magicmusicvisuals.com/forums/vie ... p?f=2&t=88):
Does that help? If not, let me know. It could still be a bug.If you create your content in blender from the beginning, rendering as png image sequence or video sequence as described above, is not the only thing important. you'll also need to tick "transparent" under rendersettings>Film to make the "world background transparent with premultiplied alpha".
Re: bug or feature? alpha channel ignored when background bl
Also, as an interim fix, you can use this shader in the GLSLShader module:
Hook it up directly after each Video module in your scene.
Code: Select all
void main()
{
// get the current pixel coordinate:
vec2 pixelLocation = gl_FragCoord.xy / iResolution.xy;
// get the color at the current pixel coordinate:
gl_FragColor = texture2D(iChannel0, pixelLocation);
// multiply the rgb value by the alpha value:
gl_FragColor.rgb *= gl_FragColor.a;
}
Re: bug or feature? alpha channel ignored when background bl
without premultiplied alpha, the video file doesnt seem to include an alpha channel. it looks like this then:
\\Edit: wow that was quick. your temp fix as glsl module works perfectly. everything as expected now, thanks a lot! :O
even using a colour HSB node and putting "alpha" to 0 doesnt help (dont know if it's supposed to though).\\Edit: wow that was quick. your temp fix as glsl module works perfectly. everything as expected now, thanks a lot! :O
Re: bug or feature? alpha channel ignored when background bl
Great, I'm glad it worked. The only thing though is that using the GLSLShader module to premultiply the alpha is a bit inefficient. The best thing would still be if the video could be exported from Blender with alpha already premultiplied; then you wouldn't have to use GPU resources to do it. Does this page help at all? http://wiki.blender.org/index.php/Dev:R ... ansparency
The problem is that some video codecs premultiply, and some don't. So it's impossible for Magic to know how to deal with the alpha channel. In general, alpha channels in video aren't widely supported. The only other solution would be for me to add another toggle parameter to the Video module, which you'd have to manually set. I'm not sure if that's the best way to go about it. But maybe it's necessary... I'll think about it a bit more.
The problem is that some video codecs premultiply, and some don't. So it's impossible for Magic to know how to deal with the alpha channel. In general, alpha channels in video aren't widely supported. The only other solution would be for me to add another toggle parameter to the Video module, which you'd have to manually set. I'm not sure if that's the best way to go about it. But maybe it's necessary... I'll think about it a bit more.
Re: bug or feature? alpha channel ignored when background bl
hmm. the clip i initially made, acuatlly was with premultiplied alpha. at least i think this is what the "film>transparent (premultiplied blabla)" setting does. the wiki link you posted states "The Transparent option remains unchanged, when it is enabled a render with premultiplied alpha will be created" (at cycles render alpha). maybe this is only true if you export to png images though. maybe using that png-video-codec produces streight-alpha ?
Videos with alpha are rare anyway as we found out. maybe you want to scratch this support anyway and provide support for masking (assuming this allows for semi transparency)? i mean i could easily render out the alpha channel as another greyscale clip and use that instead. incase this would be more convienient for other people as well. (apparently noone uses videos with alpha , even the blender guys were surprized that there is a png-video codec hidden inside blender).
Videos with alpha are rare anyway as we found out. maybe you want to scratch this support anyway and provide support for masking (assuming this allows for semi transparency)? i mean i could easily render out the alpha channel as another greyscale clip and use that instead. incase this would be more convienient for other people as well. (apparently noone uses videos with alpha , even the blender guys were surprized that there is a png-video codec hidden inside blender).
-
- Posts: 712
- Joined: Sun Sep 14, 2014 8:15 am
- Location: UK
- Contact:
Re: bug or feature? alpha channel ignored when background bl
Yes please! That would be perfect for handling existing video assets regardless of codec. Re-rendering is not always an option, and pre-multiplied alpha can be disadvantageous http://dvd-hq.info/alpha_matting.phpEric wrote:...other solution would be for me to add another toggle parameter to the Video module
With great respect, lots of people (myself included) use videos with alpha in video post-production.blackdot wrote:..apparently noone uses videos with alpha...
There are some nice clips with alpha on videoblocks http://www.videoblocks.com/videos/transparent+alpha, illustrating the utility of these.
Further examples in this article http://www.provideocoalition.com/alpha- ... s-straight
(I'm not claiming to understand any of this ).
In the wild I would agree that videos with alpha are rare, but in video compositing they are in common use.
IMHO it would be valuable for Magic's Video module to handle as many variants as possible.
Re: bug or feature? alpha channel ignored when background bl
what container and codec are you using for your videos with alpha? as far as i understand image-sequences with alpha are much more often used in compositing, no? at least in non-realtime stuff.
anyway glad to see, i'm not the only one, so scratch my previous statement. in that case a toggle for the user straight/premultiplied would be great.
anyway glad to see, i'm not the only one, so scratch my previous statement. in that case a toggle for the user straight/premultiplied would be great.
Re: bug or feature? alpha channel ignored when background bl
You could do that right now actually. You would just need a very simple shader, similar to my Alpha Mask, but tweaked a bit:maybe you want to scratch this support anyway and provide support for masking (assuming this allows for semi transparency)? i mean i could easily render out the alpha channel as another greyscale clip and use that instead.
Code: Select all
void main()
{
vec2 pixelLocation = gl_FragCoord.xy / iResolution.xy;
gl_FragColor = texture2D(iChannel0, pixelLocation) * texture2D(iChannel1, pixelLocation).rrrr;
}
But having 2 videos is still inefficient. The toggle parameter is a better solution, or maybe I can figure out how to actually fix the transparency issue properly .
-
- Posts: 712
- Joined: Sun Sep 14, 2014 8:15 am
- Location: UK
- Contact:
Re: bug or feature? alpha channel ignored when background bl
@blackdot, with apologies for my delayed reply.
I'm considering using Quicktime RLE format for certain footage, but haven't yet tried. I'm working entirely on PC, which is sometimes restrictive.
Currently, AVI RGBA with Lagarith lossless codec (reducing them to half-huge ) http://lags.leetcode.net/codec.html.blackdot wrote:what container and codec are you using for your videos with alpha?
I'm considering using Quicktime RLE format for certain footage, but haven't yet tried. I'm working entirely on PC, which is sometimes restrictive.
I'm sure you're correct, but some footage in libraries such as VideoBlocks does not have an image-sequence option. I'm keen to be able to handle any footage without re-rendering, so a toggle on the Video module could be an efficient solution.blackdot wrote:as far as i understand image-sequences with alpha are much more often used in compositing.
Re: bug or feature? alpha channel ignored when background bl
Thanks. Never heard of either container nor codec . But yeah those royalty free footage platforms dont support imgseqs. I often noticed them offering masks though where at the end of a clip, it's extended by a masked version of it.
Sincr your codec is also lostless i doubt my exports will get much smaller than with the png video codec. Will have to try this ouz though.
Thanks
Sincr your codec is also lostless i doubt my exports will get much smaller than with the png video codec. Will have to try this ouz though.
Thanks