Shear(?) matrix projection along Z (depth) axis 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 &quot;artificially raises up&quot; 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!)
I belive what you are looking for is a scale Matrix, or actually it will end upp with as a shear matrix for you.
Usually they look like this
Sx  0   0   0
0   Sy  0   0
0   0  Sz   0
0   0  0    1

If you have no scaling, Sx, Sy, Sz represent the scaling in corresponding dimension.
So put the to 1 for no scaling.
But now you want to scale the height depending on the z value. So we want to modify it abit. If you would put Sx, Sy, Sz to the value one. And the put a higher value than one on Syz, then it would scale the height (Y), the futher away you are.
Sx  0    0   0
0   Sy  Syz  0
0   0   Sz   0
0   0   0    1