For the past several weekends, I’ve been working to recreate the “dynamic splitscreen” (or “voronoi splitscreen”) effect demonstrated by Squirrel Eiserloh’s 2016 GDC talk Juicing Your Cameras With Math.

Ultimately, the approach I landed on didn’t use the Voronoi algorithm, but the effect is dang close. As I build all of my weekend projects from scratch, I decided to settle on supporting only two players, since I already had to work on building cameras, stencil buffers, etc. I will write a blog post about my experience building those cameras from scratch at some point in the near future.


How it works

The high-level gist of the approach is to find the formula for the perpendicular line between two players, and then use that formula to determine how to split the screen. From there, some calculations are done to offset the camera’s focal point, and bada bing we’re set.

Using the perpendicular formula to determine the screen splits, we have in hand the clipping polygons for each camera. Upon getting a new clipping polygon, the camera will then calculate the centroid of the polygon, which essentially becomes the camera’s focal point.

At this point, we have cameras that can split and focus on players, which is great. However, since each player is at the center of their respective cameras, there is a disconnect and slightly jarring jank as the players merge together.

The key to solving the disorienting screen jank is to simply adjust the camera’s focal point pffset as the players move closer/farther apart. As players move closer to one another, the cameras will position themselves to reflect the position of their player as they would appear on the shared camera.


Demo