# Texture mapping and conformal transformation

I'm a 3D programmer with background in physics, interested to better know how texture mapping can be made using conformal maps for simple surfaces.

I want to texture map a paraboloid:

$(x,y,z)=(x,c(x^2+z^2),z)$

$c \in \mathbb{R}$ is a parameter. I can equivalently write it as $F(\rho,\theta)$ in polar coordinates:

$$x(\rho,\theta) = \rho \cos \theta \\ y(\rho,\theta)=c \rho^2\\ z(\rho,\theta) = \rho \sin \theta$$

My target is to find the coordinates $(u,v)$ for which the area element $dS$ is constant and such that they are orthogonal. I'm computing the area element in the usual way:

$$dS = \left\lVert \frac{\partial F}{\partial \rho} \times \frac{\partial F}{\partial \theta} \right\rVert = \det \begin{pmatrix} & \hat i & \hat j & \hat k \\ & \cos \theta & 2c\rho & \sin \theta \\ & -\rho \sin \theta & 0 & \rho \cos \theta \\ \end{pmatrix} = \lvert\rho\rvert \sqrt{4c^2\rho^2+1}$$

The simple polar coordinates are not the right choice I argue. How can I find those $u,v$ coordinates?

I hope to have put the correct tag to this question since I think that being this transformation from the cartesian grid where the coordinates are orthogonal, the map must preserve it.

-
It seems to me that conformality and equal area elements are two different concepts here. Just because coordinate lines intersect orthogonally doesn't mean that all angles will be preserved. If you have to choose between these two, which one is the stronger requirement? – MvG Jun 17 '13 at 23:11

There are two things you are asking in your question, and it is far from obvious that they will coincide. On the one hand, you ask about a constant area element, while on the other hand you ask about a conformal map. Just because the map maintains the orthogonality of your coordinate lines does not mean that the map as a whole will neccessarily be conformal.

# Conformal

Let's start with the conformality requirement, and let's also preserve the rotational symmetry and stick to polar coordinates. If your map was conformal, then the scale factor between texture coordinates and object coordinates would be independent of direction.

To compute the path length for an infinitesimal change in parameters, compute the total derivative of the path length in object space:

\begin{align*} \mathrm d s^2 &= \left\lVert\frac{\partial F}{\partial\rho}\mathrm d\rho\right\rVert^2 + \left\lVert\frac{\partial F}{\partial\theta}\mathrm d\theta\right\rVert^2 = \left\lVert\begin{pmatrix}\cos\theta\\2c\rho\\\sin\theta \end{pmatrix}\mathrm d\rho\right\rVert^2 + \left\lVert\begin{pmatrix}-\rho\sin\theta\\0\\\rho\cos\theta \end{pmatrix}\mathrm d\theta\right\rVert^2 \\&= \left(1+4c^2\rho^2\right)(\mathrm d\rho)^2 + \rho^2(\mathrm d\theta)^2 \end{align*}

Now do the same for texture space, where you have $G(r,\theta)$ like this:

\begin{align*} u &= r\cos\theta \\ v &= r\sin\theta \end{align*}

\begin{align*} \mathrm d s'^2 &= \left\lVert\frac{\partial G}{\partial r}\mathrm d r\right\rVert^2 + \left\lVert\frac{\partial G}{\partial\theta}\mathrm d\theta\right\rVert^2 = \left\lVert\begin{pmatrix}\cos\theta\\\sin\theta \end{pmatrix}\mathrm d r\right\rVert^2 + \left\lVert\begin{pmatrix}-r\sin\theta\\r\cos\theta \end{pmatrix}\mathrm d\theta\right\rVert^2 \\&= (\mathrm dr)^2 + r^2(\mathrm d\theta)^2 \end{align*}

Now you want the ratio between these two directional derivatives to be the same.

\begin{align*} \frac{\left(1+4c^2\rho^2\right)(\mathrm d\rho)^2}{(\mathrm dr)^2} &= \frac{\rho^2(\mathrm d\theta)^2}{r^2(\mathrm d\theta)^2} \\ \frac{\mathrm dr}{\mathrm d\rho} &= \frac{r}{\rho}\sqrt{4c^2\rho^2+1} \end{align*}

This is a differential equation, which you can type into Wolfram Alpha. The result will look somewhat like this:

$$r(\rho) = k_1\frac{\rho}{1+\sqrt{4c^2\rho^2+1}}e^{\sqrt{4c^2\rho^2+1}}$$

The constant $k_1$ will determine the global scale of your texture, you can choose it to suite your needs.

# Constant area element

So now about this constant area element. This would be a parametrization such that equal changes in $r$ and $\theta$ correspond to equal area on the paraboloid, no matter the current position. Let's have a look at this area element, similar to what you already did in your question.

\begin{align*} \left\lvert\mathrm dS\right\rvert &= \left\lVert\frac{\partial F}{\partial\rho}\mathrm d\rho\times \frac{\partial F}{\partial\theta}\mathrm d\theta\right\rVert = \left\lVert\begin{pmatrix}\cos\theta\\2c\rho\\\sin\theta \end{pmatrix}\times\begin{pmatrix}-\rho\sin\theta\\0\\\rho\cos\theta \end{pmatrix}\,\mathrm d\rho\,\mathrm d\theta\right\rVert = \left\lVert\begin{pmatrix} 2c\rho^2\cos\theta\\ \rho\\ 2c\rho^2\sin\theta \end{pmatrix}\,\mathrm d\rho\,\mathrm d\theta\right\rVert \\&= \left\lvert\rho\sqrt{4c^2\rho^2+1}\,\mathrm d\rho\,\mathrm d\theta\right\rvert \end{align*}

Nothing new so far, just confirming your computation and adding a slightly different notation. Now let's introduce a constant $a$ for the constant area element you want for our texture coordinates. This is a unitless scale factor.

\begin{align*} \mathrm dS &= a\,\mathrm d r\,\mathrm d\theta = \rho\sqrt{4c^2\rho^2+1}\,\mathrm d\rho\,\mathrm d\theta \\ \frac{\mathrm dr}{\mathrm d\rho} &= \frac{\rho}{a}\sqrt{4c^2\rho^2+1} \\ r(\rho) &= \int\frac{\rho}{a}\sqrt{4c^2\rho^2+1}\,\mathrm d\rho = \frac{\left(4c^2\rho^2+1\right)^{\frac32}}{12ac^2} + k_2 \end{align*}

You could also use Wolfram Alpha to compute this integral, or directly type in the differential equation. You'd probably want to choose the constant $k_2$ in such a way that for $\rho=0$ you get $r=0$.

\begin{align*} k_2 &= -\frac1{12ac^2} \\ r(\rho) &= \frac{\left(4c^2\rho^2+1\right)^{\frac32}-1}{12ac^2} \end{align*}

As you can see, this form is very different from the one obtained for the conformal map, so constant area element is something else entirely.

-
Thanks for the accurate response. In fact I would also like to understand how to get the constant area element. Excuse me for the double question. You are suggesting that my new coordinates should be $\theta = \arctan(y/x)$ and the $r(\rho)$ in your last equation? – linello Jun 18 '13 at 14:20
@linello: More like $\theta=\operatorname{atan2}(z,x)$, since you have $y$ as the axis of rotation. I updated my answer to include my thoughts and computations about a constant area element. Not sure whether this makes sense, neither for the concept nor for my computation. – MvG Jun 18 '13 at 16:05
Hey, thanks for the ideas! This is the result of conformal and constant area requirements. imgur.com/ygrMoFw My biggest problem is that, i think, the theta is wrong. This is basically the GLSL code to do this texture mapping if your are interested (the constant area case) float rho = sqrt(v.x*v.x+v.y*v.y); float theta = (atan(v.y,v.x)+pi/2)/(pi); float s= sqrt(4*rho*rho+1); float a=1.0; float r = (pow(4*rho*rho+1,1.5) -1)/(12*a) ; texture_coordinate = vec2(r,theta); gl_Position = gl_ModelViewProjectionMatrix*v; – linello Jun 19 '13 at 7:31
I'd assume u and v as the texture_coordinate, which you can compute from r and theta. Probably with some added computation to get the size correct and to have r==0 correspond to the center of the texture. – MvG Jun 19 '13 at 7:35
Oh yes! I've been wrong putting $(r,\theta)$ instead of $(r \cos(\theta), r \sin(\theta) )$ this in fact makes much more sense! Stupid me, seeing the same thing for 2 days hides the evident things! This is the result of conformal requirements: and the resulting shader code float rho = sqrt(v.x*v.x+v.y*v.y); float theta = atan(v.y,v.x); float a=1.0; float r = (pow(4*rho*rho+1,1.5) -1)/(12*a) ; texture_coordinate = vec2(r*cos(theta),r*sin(theta)); gl_Position = gl_ModelViewProjectionMatrix*v the effect is the following: imgur.com/jqusOyl – linello Jun 19 '13 at 7:49