Search Unity

Question Removing UI when capturing scene with OBS

Discussion in 'General Graphics' started by Denchi_, Apr 9, 2021.

  1. Denchi_

    Denchi_

    Joined:
    Dec 17, 2018
    Posts:
    23
    I'm working on a tool for streamers that most people use with OBS or Streamlabs.

    Would it be theoretically possible to have certain elements in my scene removed from an OBS/Streamlabs "GameCapture"?

    Details: In my scene, I have one camera that renders the main scene (cam 1, this should be shown in OBS) and one camera that renders the tool UI on top of that (cam 2, this should not be shown in OBS). Currently, I do this by providing a virtual webcam or NDI stream of cam 1 that can be included as a webcam or NDI source in OBS.

    But the normal way to record Unity apps in OBS would be by using a GameCapture source, which essentially hooks into the Unity game process and reads out the back buffer before it is swapped (I think, not 100% sure about the process. OBS code isn't very easy to understand).

    Is there some rendering setup that will allow me to have only cam 1 show up in the OBS capture while in the actual game, it still shows cam 1 + cam 2 on top?

    I understand this is a very specific use-case, but if anyone has any ideas, I'd be happy to hear them.