Any clues on how to create a split-screen effect like the lego harry potter game?

How would you create a split screen effect like the one from the latest Lego games (Harry Potter Years 1 - 4 and Indiana Jones 2), here is a video showing it:

http://www.youtube.com/watch?v=fnN7Gje7gbo The effect can be seen from 1:00

I want to create the effect of having the divisor line moving around the screen depending on the players position and when they reunite the perspective is the same for both cameras and looks seamless.

How would you suggest to create such effect?

Unity draws viewports as rectangles as far as I'm aware, so I'd imagine the shifting diagonal effect would be tricky if not currently impossible. Perhaps if you render one of the views to a texture that fills the screen, you could shift an alpha mask around it to show parts of the view behind. No idea how well that would work, though. Alternatively you might be able to write your own extension to the camera, although I have no experience of such a thing; so again, not sure.

There are other ways you can split the view however, which are much more straightforward. Upon detecting your players are too far apart, you can create another viewport on top of the current one at the same size, drawn from a duplicate camera. Then, over a few seconds, reduce each viewport to half the screen each and you now have split screen.

To re-unite them, simply Lerp/Tween camera 2 to camera 1's position when the players enter a certain distance from each other. Once the cameras are pretty much aligned, you can remove the second view and return to one screen. This will not be as smooth as the example of course, but such are the perks of building your engine from scratch :)

Your video got taken down so I can't see the exact diagonal effect you refer to.

You could render the 2nd camera to a texture (Pro feature.) Then you can use a custom shader to compose the final texture that you show to the player. One of the inputs to the shader could be a mask; this would let you do arbitrary shapes. The Unify wiki has a custom shader that appears to do this.

You may be able to manage without a shader. You could use the 2nd camera's render texture as the texture on some shape (for example a triangle.) Then you'd put that shape in front of the main camera to show what the 2nd camera sees. You'd have to line it up perfectly with the camera view to avoid distortion, so I suspect the shader is the better solution.

I very much like Novodantis's idea of merging the views by lerping the cameras to the same point. Once they are together the views should merge.

This video on YouTube demonstrates the effect.

Unity3d dynamic two player split screen

The video by the same person shows the basic technique used to achieve it:

Unity3d Custom View Ports Part 1: Mini Map