From this page Derivatives of a Bézier Curve, I can see that the derivative of a degree $N$ Bezier curve is just a Bezier curve of degree $N-1$ and it explains how to calculate the control points by each control point just being $P_{i+1} - P_i$.
Is it also true that the derivative of a Bezier rectangle of degree $(M,N)$ is also just a Bezier rectangle of degree $(M-1,N-1)$? If so, how would you calculate the control points for the rectangle?
By Bezier rectangle, I mean a tensor product Bezier surface, like the kind described here Wikipediate: Bezier Surface.
I've been trying to work it out on paper but no luck so far. I've been able to make progress on coming up with a derivative, but it has quite a few terms even for a biquadratic patch, and i'd like to do this with higher degrees.
My end goal is that I'm trying to calculate the gradient of a univariate Bezier rectangle that has scalar control points. Specifically, the rectangle takes $X$ and $Z$ values from 0 to 1 and outputs a $Y$ value for the given $(X,Z)$. I want to find the gradient so that I can use it to calculate surface normals, as well as get a distance estimation for sphere tracing (ray marching).
Thanks for any help you guys can provide!
Yes, it's true (almost). If the surface parameters are $u$ and $v$, the partial derivative wrt $u$ is a Bezier patch of degree $(M, N-1)$ and the partial derivative wrt $v$ is a Bezier patch of degree $(M-1, N)$.
If you are using the deCasteljau algorithm to calculate points on your patch, then the partial derivatives will be natural by-products.
Often the best way to handle a surface computation is to reduce it to a curve computation. So, suppose you want to calculate the partial derivative wrt $u$ at parameter values $(\bar u, \bar v)$ on the Bezier patch $(u,v) \mapsto \mathbf{S}(u,v)$. The curve $\mathbf{C}(u) = \mathbf{S}(u,\bar v)$ is a Bezier curve, whose control points are easy to obtain. The desired partial derivative is just the derivative of the Bezier curve $\mathbf{C}$ at the parameter value $u = \bar u$.