Open tjenkinson opened 11 years ago
I would say that it treats the input as premultiplied since it is not modified in any way before sending to the mixer (the mixer expects premultiplied). Furthermore I am not sure this is an undesirable behaviour, I think it should be up to the user (or client) to make sure it is premultiplied (just like with any other content played by Caspar).
Caspar could verify that none of the R, G or B values are higher than the A value and give an error otherwise, but I think it is good for debugging purposes that it is possible to on purpose overflow the compositing in the mixer.
We could also implement support for premultiplication on any layer in the mixer, so that any producer could output straight alpha but be premultiplied before compositing. That would also avoid the CPU premultiplication done in the image and image scroll producers (one time cost), although it would add a small cost on the GPU on every frame (probably negligable).
I think that having a premultiply flag on the mixer would make more sense and this is the same solution that is being discussed in https://github.com/CasparCG/Server/issues/167.
However, if this becomes the case then I think it would be nice if Caspar would log a warning if any of the R, G or B values exceeds the A value when it's being premultiplied in the MIXER so the user gets some kind of feedback, even though it would still let it though and overflow etc.
The color producer at the moment is treating the input as straight, and then passing the alpha and color channels directly into the mixer. It should either:
I personally think the first option makes more sense and all that needs to happen is the producer needs to premultiply the input before sending it to the mixer, the other option would require the user to premultiply it first as it's something that would always need to be done, and the server would need to check the input.
Related forum topic: http://casparcg.com/forum/viewtopic.php?f=3&t=1566
Thanks for all the time and effort that goes into this amazing project! Tom