Bug in Add/Subtract compositing modes.

farss wrote on 4/28/2009, 7:05 AM
This took me a while to grasp. If I Add black to black I'd assume I should get black. Vegas gives me grey. If I subtract black from black it gives superblack. I get the same funky outcome with 100% white as well.
I can understand why Vegas is doing this but clearly it's wrong and it's not trivial to work around.
The real brain buster is what happens when there's also an alpha channel. I suspect that Vegas's "ComputerRGB" centric view of video is causing the compositing issues I and others have noted with Vegas and things like fog, smoke and fire with alpha channels. The maths of how alpha values are computed into compositing modes seems to be a dark secret so I'm totally lost trying to understand the issues let alone how one might correctly work around this issue. This is not a personal show stopper, I've simply given up using Vegas for some compositing work as I have AE and it seems to get this right. Still it'd seem selfish of me not to make a noise about this, not everyone can afford AE and I like to see Vegas do what it does correctly.

Bob.

Comments

Marco. wrote on 4/28/2009, 7:44 AM
Take care of the RGB values. To me it seems like Vegas behaves correctly.

Have a RGB 0/0/0 video in track #1 and track #2 - use Compositing Mode "Add" and it keeps its 0/0/0 property.

Have a mid grey of RGB 125/125/125 for both the videos and compose it using Add mode it results in RGB 250/250/250.

Do same with Compositing mode Substract results in RGB 0/0/0 for both the cases because the math result must be 0.

Have a RGB 255/255/255 in track #1 and RGB 100/100/100 in track #2 using Substract results in RGB 155/155/155.

Should be fine the way it works.

Marco
farss wrote on 4/28/2009, 4:08 PM
"Take care of the RGB values. To me it seems like Vegas behaves correctly."

So what you're saying is to convert everything going into the composite to ComputerRGB and apply the reverse after compositing.
That's the fairly obvious work around I was talking about.
The bigger issue is what happens to the alpha channel, come to think of it I'm not so certain if Vegas's FXs preserve or can manipulate the alpha channel.

Bob.


Udi wrote on 4/29/2009, 1:39 AM
The alpha value is multiplied by the value before the composition -
100/100/100 with alpha 0.5 - add to 100/100/100
the result is 150/150/150

farss wrote on 4/29/2009, 5:34 AM
Thanks,
that's what I'd have thought too. Question is, this is what Vegas does but is it that simple. Vegas converts Y'CbCr to R'G'B', multiplies by the alpha values, composites and converts the result back to Y'CbCr. Something goes wrong in all this.

1) Add a drop shadow using track motion and it looks fine.
2) Render the output to an uncomp AVI, bring that back into Vegas and comp it.
We should get the exact same result but don't.
Take the file rendered by Vegas in 2) and comp it onto the same background using AE and I get the same result as 1).
I've tried switching Vegas into 32bpc and linear light, no difference, still the dip to grey near where the alpha value goes to zero.

I watched a video someone from here had linked to showing what they'd done using Particle Illusion generated fog, they'd comped several layers of this fog using Vegas and the same problem was quite visible, near the edge of each layer of fog is this band of grey.

Based on these two results Vegas seems to render the alpha data correctly, it's compositing from a video source file that it has this problem. I probably should bounce this to support but I'd like to have a better understanding of how this is going wrong first.

There's an example of 1) here.

It doesn't look that bad at first. If you look closely though you'll see that the drop shadow goes lighter than what it's being compositied onto which is wrong and looking at the whole image in motion the drop shadow was a light band in it. By comparison After Effects gets it right.

Bob.
TheHappyFriar wrote on 4/29/2009, 6:17 AM
Maybe I'm doing something wrong. I took a generated media, used track motion to shrink it & add a drop shadow. Then I rendered that out to an uncompressed AVI &, for testing, a QT-PNG mov. Then I brought them back in to Vegas, put them on another track. I then put a white background behind each. Took screenshots. I replaced white with grey (like you had), took screenshots. They all look identical in the shadows (uncompressed QT looks BETTER then AVI though! A surprise!!! Look at the color edges!).

http://img115.imageshack.us/my.php?image=alpharender.png[/link]

Not that I don't believe you, I think I've seen this before. What did you do to comp it? I just used the alpha channel in the image (right click-properties-straight).
Udi wrote on 4/29/2009, 10:06 AM
Don't fully understand the way you used drop shadow.
I placed a color gradient left is 128/128/128/255 and right is 128/128/128/0
So I have a gray gradient with linear alpha from 1 to 0.
Render to uncomp avi.
Bring back to vegas
Comp (add mode) both to solid color 0/100/200 and as far as I can test with color picker - got same result from the original and the rendered.

Maybe drop shadow is doing something else

Edit: When I added drop shadow the 2 are completely different!

Udi
TheHappyFriar wrote on 4/29/2009, 7:00 PM
I just used a drop shadow.... no sure how else you'd add a drop shadow? Is there a FX or something?
farss wrote on 4/29/2009, 7:18 PM
No FX, I'd simply used the track motion however the dropped shadow was pale grey.
I'll have to dig around and find the precise steps to repo this problem. I'm certainly not the only one whose posted about this issue over the years but it just kind of fades away which is a pity. Things like Vegas crashing get huge coverage and yet they'll no doubt get fixed. These kinds of subtle errors don't cause much excitement as either people affected don't even notice or they're so few in number as to not raise a blip on SCS's radar.

Bob.