Aaron Franke 43dcf5c1e7 Clean up editor/display_folded 5 år sedan
..
CameraController.gd b93d9028a9 Coding style 5 år sedan
PlayerMovement.gd b93d9028a9 Coding style 5 år sedan
README.md f922bcb8c7 Add dynamic split screen demo 5 år sedan
SplitScreen.shader f922bcb8c7 Add dynamic split screen demo 5 år sedan
SplitScreen.tscn 43dcf5c1e7 Clean up editor/display_folded 5 år sedan
Walls.gd f922bcb8c7 Add dynamic split screen demo 5 år sedan
default_env.tres f922bcb8c7 Add dynamic split screen demo 5 år sedan
icon.png f922bcb8c7 Add dynamic split screen demo 5 år sedan
icon.png.import f922bcb8c7 Add dynamic split screen demo 5 år sedan
project.godot 566c7e15f8 Use second controller's left stick for player2 5 år sedan

README.md

The project

This sample project showcases an implementation of dynamic split screen, also called Voronoi split screen, using the Godot engine.

Dynamic split screen

A dynamic split screen system displays a single screen when the two players are close but a splitted view when they move apart.

The splitting line can take any angle depending on the players' position, so it won't be either vertical or horizontal.

This system was popularized by the Lego videogames.

How it works

Two cameras are placed inside two separate viewports and their texture, as well as some other parameters, are passed to a shader attached to a TextureRect filling the whole screen.

The SplitScreen shader, with the help of the CameraController script, chooses wich texture to display on each pixel to achieve the effect.

The cameras are placed on the segment joining the two players, either in the middle if they're close enough or at a fixed distance otherwise.

How to use it

Open and launch the project inside the Godot engine and then you can use WASD keys to move the first player and IJKL keys to move the second one.

The Cameras node has parameters to tune the distance at which the screen splits and also the width and color of the splitting line.

Try it out

An HTML5 export is testable here.