I'm trying to compute the partial derivative for ($x = $PX) where ($P$) is a Projection Matrix and $X$ is the World Space coordinates and $x$ is the image space coordinates. We have $$ {p_{3,4} = \begin{pmatrix}a_{11}&a_{12}&a_{13}&a_{14}\\ a_{21}&a_{22}&a_{23}&a_{24}\\ a_{31}&a_{32}&a_{33}&a_{34}\end{pmatrix}}, \\ x = {a_{11} . X + a_{12} . Y +a_{13} . Z +a_{14} . 1 \over a_{31} . X + a_{32} . Y +a_{33} . Z +a_{34} . 1}, \\ y = {a_{21} . X + a_{22} . Y +a_{23} . Z +a_{24} . 1 \over a_{31} . X + a_{32} . Y +a_{33} . Z +a_{34} . 1},$$ We want: $$ {∂x\over ∂X} ,{∂x\over ∂Y}, {∂x\over ∂Z}, {∂y\over ∂X} ,{∂y\over ∂Y} ,{∂y\over ∂Z}$$ I started with the first one but I'm not sure if it is correct or not: $$({a_{11} \over {a_{11} . X + a_{12} . Y +a_{13} . Z +a_{14} . 1}} - {{a_{31}} \over {a_{31} . X + a_{32} . Y +a_{33} . Z +a_{34}}}) . x$$
Plz, correct me if I'm wrong(Sorry, I'm so bad at math). Thanks in advance.