I'm creating a primarily 2d game (platformer perspective) with 2d background parallax layers. The parallax effect falls out of the fact that I'm positioning a bunch of layers in 3d and using a perspective camera. I'm using Unity which has a left-handed coordinate system with camera pointing down positive Z (positive X rightwards, positive Y is upwards).
I'd like to occasionally apply an effect that "artificially raises up" the parallax layers in the background. So that the layers further into the background increase their Y position as their Z position increases. Hopefully this diagram makes it clear:
How would I construct a 4x4 matrix that I could multiply by my usual perspective matrix in order to produce this effect? (Is it calling shearing?) I thiiink (but I'm not 100% sure without seeing it) that I want the Y change of each layer in screen space to be proportional to 1/z
.
(Note: I realise I could fake this by moving the background layers directly but I'd like to avoid that if possible!)