Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ndi consumer straight alpha #1421

Open
ducthiem90 opened this issue Mar 7, 2022 · 7 comments
Open

ndi consumer straight alpha #1421

ducthiem90 opened this issue Mar 7, 2022 · 7 comments

Comments

@ducthiem90
Copy link
Contributor

Expected behaviour

CasparCG output rgb error when alpha != 1
I think mixer needs divide by alpha when alpha != 0 and alpha != 1
color.rgb /= color.a

Current behaviour

When I try play with alpha and export to NDI, color receive in NDI Studio error


Steps to reproduce

ADD 1 SCREEN
ADD 1 NDI
PLAY 1 #FF0000
MIXER 1 OPACITY 0.5

Environment

  • Server version: 2.3.3
  • Operating system: Windows 10

Screenshots

error color

@gizahNL
Copy link
Contributor

gizahNL commented Mar 8, 2022

To me this looks like it is working correctly.

You set opacity to 50%, so 50% translucent. NDI (supposedly, never seen it working with linux based receiver) transports Alpha channel. NDI Monitor has a black background, and alpha blends your red color on top of it. Making it darker.

@ducthiem90
Copy link
Contributor Author

To me this looks like it is working correctly.

You set opacity to 50%, so 50% translucent. NDI (supposedly, never seen it working with linux based receiver) transports Alpha channel. NDI Monitor has a black background, and alpha blends your red color on top of it. Making it darker.

I don't think so. Here are the results when I change alphas:
CasparCG:
caspar
NDI Receive:
ndi

You can see color 50% in caspar = color 25% in NDI

@hreinnbeck
Copy link
Contributor

Can you check turning on the checkerboard background in studio monitor and seeing how it multiplies with white? I don't remember how studio monitor handles alpha. Or perhaps test in OBS over another source? Perhaps also taking it back into CCG on another channel.

@hreinnbeck
Copy link
Contributor

hreinnbeck commented Mar 8, 2022

Looks to me like NDI wants straight alpha but CCG (>=2.3) only does pre-multiplied (and studio monitor likely only supports straight). Various software that works with NDI have options to support pre-multiplied.

@ducthiem90
Copy link
Contributor Author

ducthiem90 commented Mar 8, 2022

Here are results with white color:

  • CCG:
    caspar

  • NDI Studio receive from CCG:
    ndi

  • NDI Studio receive from OBS:
    obs

@mint-dewit
Copy link
Member

mint-dewit commented Mar 9, 2022

This is with the NDI receiver set to straight alpha:
afbeelding

This is with the NDI receiver set to premultiplied
afbeelding

I used VMix in this case but the studio monitor looks the same as the first picture. So this clears up the issue, Studio Monitor does not handle premultiplied alpha and that's not a bug in CasparCG.

(Just as a side note, it is quite annoying that the warnings on the test pattern are incorrect, however the top bar fading from black to white at 50% opacity is a good indication of what is going on)

@ducthiem90 ducthiem90 reopened this Mar 9, 2022
@ducthiem90
Copy link
Contributor Author

This is with the NDI receiver set to straight alpha: afbeelding

This is with the NDI receiver set to premultiplied afbeelding

I used VMix in this case but the studio monitor looks the same as the first picture. So this clears up the issue, Studio Monitor does not handle premultiplied alpha and that's not a bug in CasparCG.

(Just as a side note, it is quite annoying that the warnings on the test pattern are incorrect, however the top bar fading from black to white at 50% opacity is a good indication of what is going on)

(SIGHS)! I think we need to send to ndi as yuv format to not incorrect

@Julusian Julusian changed the title OUTPUT ERROR ALPHA ndi consumer straight alpha Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants