- Home /
Dynamic Camera Masking (Voronoi Split-Screen)
I am attempting to develop a Voronoi Split-Screen (see https://mattwoelk.github.io/voronoi_split_screen_notes/ 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:
Have a disabled camera for each tracked object (N objects)
Have N/2 shared cameras (dynamically enabled, enabled if a camera holds 2+ tracked objects).
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?)
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.
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.
I too would love to hear people's thoughts on this, it seems like a challenging task.
Answer by sergioschiavo · May 14, 2020 at 02:22 PM
Hello, I know this is quite old post by now, but I'm really interested to know if you managed to get this done!
Your answer
Follow this Question
Related Questions
Cutting a hole in the camera 0 Answers
Masking camera image with transparent background in combination with UI 0 Answers
Stencil and mask shader not working when building on Windows Desktop. 0 Answers
Unity 5 image effects for multiple cameras 1 Answer
How to hide Unity terrain trees when they are blocking the camera view? 0 Answers