Adding Spout2 from OBS into VNyan Worlds¶
Written by lunazera
It is possible to get live video feeds from OBS (or other sources) into your 3D environment in VNyan. If you just need a simple window on a floating plane, VNyan has a built-in Spout2 Receiver prop you can add. But you can also that video feed directly into your World with Spout2 plugins.
If you are instead looking to get rendered images from Unity/VNyan into OBS, see here.
Everything here will be in terms of Spout2, but it is also possible to use NDI in the same way.
OBS Setup¶
For both options, if you are sending video from OBS you will need to have the Spout2 Plugin for OBS.
Simply add a Spout Filter to the sources you would like to send over Spout2. In the filter settings, change the name to something you can use to identify it easily. You can add a Spout Filter to any source in OBS, including groups or folders of sources. It might be good to make a separate scene for your Spout senders, but avoid putting the filter on the scene directly as this can be a bit more taxing on performance.
Having multiple Spout2 Senders in OBS and Spout2 Receivers in your world could become taxing on some systems. You can optimize a bit by combining multiple sources in OBS into a single grouped image to send instead. In Unity you would then adjust the material settings for the image size and offset to position the image on each screen.
Spout2 Receiver Prop¶
In VNyan's Props menu, if you click the Prop to Add drop down you will find Spout2 as an option. This will spawn a square plane that you can position as you need.
The Spout2 image will scale to the size of the plane, so you might need to adjust the scaling to recover the aspect ratio. For example, if you are a sending 1080p image, try setting Scale X to 1.778
One of the benefits of Spout2 is that it supports transparency. If you put the filter onto a folder with multiple sources but space in between, that empty space will show transparent in this VNyan prop.
Spout2 in VNyan World¶
You can build Spout2 receivers directly into your VNyan world using the free klakSpout asset for Unity. Instructions for how to add this asset to your Unity project can be found here.
Once you have it installed, you will have access to a Spout Sender Component (which can be used to create additional camera feeds) and Spout Receiver Component. You need to at least create a new Texture in unity for the image to be rendered onto. In Unity, you can do this by right-clicking in your Project window and selecting Create > Render Texture.
- Dimension should be set to 2D
- Size should ideally match the size of the OBS Source.
- Color Format should be set to R8G8B8A8_UNORM_SRGB
You can then use this render texture in your materials where you would like to put it. For example, you could use it as the image texture in a VRM material, or add it as a Decal in a Poyomi material.
Alternatively, you could use set the component's Target Rendered to point to the mesh of the GameObject you want it to apply to and have it change the image texture directly.