![]() ![]() Though I did this test on a slightly older version of the NDI plugin. On a disconnect if the NDI source's bandwidth in the main OBS has been set to Highest or Lowest but the source OBS' NDI disconnected the last frame of that will freeze on the main OBS NDI source. Just a note though, this only works if no connection was established or if after the disconnect the Audio Only bandwidth (in the main OBS NDI source) was set as that resets the image back to black. This will then color key the full black area of the NDI source but then also restore the brightness after that to compensate for the adjustments in the source OBS. Then in your main OBS give the NDI Source a Color Key filter (the Chroma Key filter doesn't work as well as the Color Key) and set the Similarity and Smoothness to 1, the Key Color to fully black and set the brightness to -0.02 (or -0.04 as this produces a bit of a better result imo). This will make your black color offset just enough to never be actually full black but subtle enough to not be noticed too much. In the source OBS give your output scene a Color Correction filter and set the Brightness to 0.02. Black however may be too common so it wouldn't work as well but I may have found you a workaround on that. #include Ĭonstant float &hueAdjust ])Ĭonst float4 kRGBToYPrime = float4 (0.299, 0.587, 0.114, 0.0) Ĭonst float4 kRGBToI = float4 (0.596, -0.275, -0.321, 0.0) Ĭonst float4 kRGBToQ = float4 (0.212, -0.523, 0.311, 0.0) Ĭonst float4 kYIQToR = float4 (1.0, 0.956, 0.621, 0.0) Ĭonst float4 kYIQToG = float4 (1.0, -0.272, -0.647, 0.0) Ĭonst float4 kYIQToB = float4 (1.0, -1.107, 1.704, 0.0) įloat4 color = inTexture.I actually have something similar, I have a DxTory virtual camera in my Captures scene but have set up one of its outputs to a specific color and then tossed a color key filter on it so it becomes transparent where-ever that color shows but since it's so specific you'll never notice when there is an actual signal. MSL(Metal Shader Language) version for changing the hue of a texture. xy) įloat YPrime = dot (color, kRGBToYPrime) Vec4 color = texture2DRect (inputTexture, gl_TexCoord. Then convert back to RGB as described on the above web pages.ĮDIT: Here's a solution that I've tested and seems to give me the same results as your reference. To get back to RGB, calculate the new Cb and Cr (or I & Q) using Cr = chroma * sin (hue), Cb = chroma * cos (hue). ![]() Once you've done that, you can calculate the magnitude of the chroma with chroma = sqrt(cr*cr+cb*cb). Simply rotate it by adding the hue rotation amount. Once in one of those spaces, you can get the hue from the angle formed by the chroma channels, by doing hue = atan(cr/cb) (watching for cb = 0). (You can learn how to do that here and here.) I talked with a color scientist about this recently, and his recommendation was to convert to YIQ or YCbCr space and adjust the the chroma channels (I&Q, or Cb&Cr) accordingly. HSV and HLS color systems are problematic for a number of reasons. While what says is correct, that method may cause issues with changes in luminance, I believe. If needed for comparison, this is the original unmodified image: I have tried to switch I with Q inside atan but the result is wrong even around 0° Gl_FragColor = vec4(yiq2rgb*yFinalColor, 1.0) Īnd this is the result compared with a reference: Vec3 yFinalColor = vec3(圜olor.r, chroma * cos(finalHue), chroma * sin(finalHue)) Vec3 圜olor = rgb2yiq * texture2DRect(texture, gl_TexCoord.st).rgb įloat originalHue = atan(圜olor.b, 圜olor.g) įloat chroma = sqrt(圜olor.b*圜olor.b+圜olor.g*圜olor.g) Is there a way to efficiently change hue of a 2D OpenGL texture using GLSL (fragment shader)? ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |