Local Area Network livestreaming

Sending a Depthkit livestream over a local network has a handful of benefits:

  • Having separate computers manage the capture and rendering of a Depthkit asset results in higher performance for both processes.
  • The rendering output can reach as far as the network, enabling livestreaming into a different room, or even the far end of a large building.
  • Relatively low latency compared to streaming over the internet using a WebRTC or a CDN.

You’ll Need

🚧

Spout to NDI version 2.012 Performance

Performance has been improved between versions 2.012 and 2.015, so ensure you're using the latest version to avoid stuttering/freezing.

Setup Depthkit

  • Create a Depthkit project.
  • If using multiple sensors with Depthkit Studio, create a Studio Calibration.
  • Configure the sensors’ options, including resolution, exposure, and white balance.
  • Start Streaming
    • For Depthkit Core livestreams using a single sensor, enter the Record context, and the sensor stream will begin automatically.
    • For Depthkit Studio livestreams using multiple sensors, enter the Studio Calibration & Recording context, and click Start Streaming.
  • Set Near and Far clipping planes to remove unwanted geometry and increase the fidelity of the depth data.
  • In Edit > Preferences, check the Enable Record Context Live Stream box.
16001600

🚧

While Live Streaming is enabled, sensor settings and Near and Far clipping planes are locked. To make changes to these settings, disable Live Streaming, make your changes, then re-enable Live Streaming.

  • Set the Live Output Texture Maximum Width and Height. In this example, am using the resolution limits of UHD video - 3840x2160.
15941594

📘

High-resolution streams may affect performance, so scaling down to a lower resolution will help maintain a high framerate.

  • Start streaming again.
  • A Live Streaming indicator will now appear in Depthkit’s 3D Viewport, and you will find a livestream metadata file in your Depthkit project bin’s “_Export” folder.
621621 562562

Start Spout to NDI

  • On your Depthkit computer, run the Spout to NDI executable found in the ‘bin’ folder of the SpoutNDI tools.
  • If you have multiple Spout streams running on that computer, you may need to specify the Depthkit stream from the list of available senders in File > Select sender.
  • Under File > Settings, change the FPS to 30.
325325 642642

📘

The resolution is automatically set based on the Spout stream that Depthkit is sending.

Start NDI to Spout

  • On your rendering/receiving PC, run the NDI to Spout executable found in the ‘bin’ folder of the SpoutNDI tools.
  • If there are multiple NDI streams on your network, specify the Depthkit stream under File > Open
421421
  • Take note of the stream name in brackets at the top left of the monitor window, which will follow a SOURCE_PC_NAME (SPOUT NAME) naming convention.
867867

Setup Livestream Receiver in Unity

  • On rendering/receiving PC which will be receiving the stream, open a Unity project.
  • Add Keijiro’s Registry to your project in Project Settings > Package Manager.
11221122
  • Add the Depthkit Expansion Packages to the Package Manager in the following order:
    • depthkit.core
    • depthkit.live
    • If using Depthkit Studio assets, add depthkit.studio or depthkit.studio.lite.
    • If using URP/HDRP, add Depthkit Core (and Studio) Shader Graph and/or VFX Graph plugins.
12031203
  • Create a Depthkit Core or Depthkit Studio object from scratch, or import a Depthkit Core or Depthkit Studio prefab from the Package Manager, and add it to your scene.
  • Setup the Depthkit Clip component.
    • Change Player to Livestream Player (Spout).
    • Add the livestream_metadata.txt file to your Unity project’s Assets folder, and link it to your Depthkit object’s Metadata field.
    • Under Advanced Settings, check the box to Disable Poster.
683683
  • In the Spout Receiver component, select the Spout stream produced by the NDI to Spout tool.
676676
  • Depthkit asset should now be visible!
20002000
  • For Depthkit Studio assets, adjust bounding box and set surface buffer capacity.
  • Configure other mesh reconstruction and texture settings for your Depthkit Core or Depthkit Studio asset.

Tips and Troubleshooting

  • Dynamically loading metadata - If you ever change your sensor settings or update your Depthkit Studio calibration, you’ll need to provide updated metadata to Unity. In order to do this, you must modify the Depthkit Unity plugin to load the metadata dynamically from an external source rather than from the local file in the project.
  • Depthkit Livestream not visible in Spout-NDI Tool - If the Spout-NDI tool is not seeing the Spout stream from Depthkit, the two apps may be using different graphics hardware. Go to Windows Graphics settings, and under Graphics Performance Preference, add both the Spout-NDI tool and Depthkit items, and set both to High Performance, then restart both programs.