Dynamic Camera Masking (Voronoi Split-Screen)

I am attempting to develop a Voronoi Split-Screen (see Voronoi Split Screen: A Quick Tour by MattWoelk for an example), and have found frustratingly few tutorial resources to accomplish this (or something similar) in Unity. The target number of objects is 2, but ideally it would be N.

I know the math behind it, but I do not know the best way to create it in Unity is.


So far, my current train of thought is this:

  1. Have a disabled camera for each tracked object (N objects)
  2. Have N/2 shared cameras (dynamically enabled, enabled if a camera holds 2+ tracked objects).
  3. If an object is not captured by a shared camera, call a manual render to its personal camera. Else, a shared camera captures the frame. (best way to capture these frames?)
  4. If 2+ captured frames are made, stitch them together and return that as the single resulting frame. Else the 1 captured frame is the resulting frame.
  5. Set the resulting frame as the rendered frame (best way to accomplish this?).

I know some optimizations can be made to the above, like dynamically resizing the viewports of the cameras to minimize overlapping captured frames, but I’m trying to keep it simple for right now.


Is this the right approach? Should I be utilizing shaders (like a stencil buffer) instead?


Thanks for any help in advance.

Hello, I know this is quite old post by now, but I’m really interested to know if you managed to get this done!