Feeding Udon-controlled Camera View to Stream Camera

I’m working on a mechanism into my world to make it easier for a videographer to control complex camera movements for the stream camera to pick up and record/broadcast.

I found a really interesting world that does a lot of what I’m trying to do called “Udon Camera Studio” (https://vrchat.com/home/world/wrld_825f7800-0bd4-44f6-a49b-c54ce13ee601). This world has a really interesting tool where if you place the stream camera into a designated sphere, the camera view controlled by the Udon code in the world will align and project its output to the stream camera.

Does anyone know how this is done in Udon?

Thanks!

yo!

I haven’t checked out that world — but it’s likely they’re doing something with a screenspace texture shader + a secondary camera outputting to a render texture.

One important thing to know in doing this is that all Camera components get disabled by VRChat so you have to re-enable them at runtime. (Note that it’s the Camera component and not the game object.)

If you didn’t want to use the render texture approach, you can also directly render your secondary camera to the player’s desktop view (aka what displays on their desktop screen when they’re in VR) by setting your secondary camera’s depth to 100, setting it’s target eye to “None (main display)”, and re-enabling it at runtime. If you plan to enable the camera component in Start(), then it might be safe to add a little bit of a delay before doing that to ensure the camera renders last. This is an area where things may change in the near future as they already have very recently, but this is how to do it currently! Also, probably don’t do this for Desktop users :sweat_smile:

Hope that helps!

much love,
rob

1 Like

Ahh, this seems like a more user friendly (just push a button) and easier-to-code approach, and I suspect how the “Virtual TV Studio” world does it. In that world, if you turn on the desktop camera projection (via an in-world button interact), a hotkey is bound to “Q” to exit the mode so that it’s usable by desktop mode users.

That’s really helpful, thank you!

1 Like