Consider a square pyramid of base length $a$ and height $H$ with vertices at coordinates $\left(\pm \frac{a}2, \pm \frac{a}2\right)$ and $(0,0,H)$. Assume that $f : \Bbb{R}^2 \to \langle 0,H\rangle$ is a $C^1$-function. I'm interested in the volume $V$ of the pyramid above the surface $z = f(x,y)$.
The idea is to divide the pyramid into infinitesimal oblique pyramids (or maybe cones?) with base $dS$ and vertex $(0,0,H)$. By Cavalieri's principle, the volume of such a pyramid is given by
$$dV = \frac13h\,dS$$
where $h$ is the height of the pyramid, which is equal to $H-z$ where $z$ is the $z$-coordinate of the base $dS$. It remains to do a surface integral
$$V = \frac13\iint_S (H-z)\,dS(x,y,z).$$
Now, we can parameterize the surface $S$ using the orthographic projection from the vertex $(0,0,H)$ onto the base:
$$\varphi : \left[-\frac{a}2, \frac{a}2\right]^2 \to \Bbb{R}^3, \qquad \varphi(u,v) = \left(u\left(1-\frac{f(u,v)}H\right),v\left(1-\frac{f(u,v)}H\right),f(u,v)\right).$$
Therefore, if my calculations are correct, we get
\begin{align}
V &= \frac13\iint_{\left[-\frac{a}2, \frac{a}2\right]^2} (H-f(u,v))\,\left\|\partial_u\varphi(u,v)\times \partial_v\varphi(u,v)\right\| du\,dv\\
&= \frac{H}3\iint_{\left[-\frac{a}2, \frac{a}2\right]^2} \left(1-\frac{f(u,v)}H\right)^2 \sqrt{\partial f_u(u,v)^2 + \partial f_v(u,v)^2 + \left(1-\frac{f(u,v) -u\,\partial_uf(u,v)-v\,\partial_vf(u,v)}{H}\right)^2} du\,dv.
\end{align}
My question is: is this approach (at least conceptually) correct? I'm quite uncertain about the part with the computation of the volume of the oblique pyramid with infinitesimal base $dS$ and then summing such volumes up.
FWIW, I've plugged in the case of the constant function $f(x,y) = C$ and it gives $$V = \frac13 (H-C)\left(a\left(1-\frac{C}H\right)\right)^2$$ as expected.