<p>I'm doing linear tweening of a cyllinder to a cone of equal radius and height in OpenGL. I know parametric equations of both of them, so I derived vertex normals accordingly. Now, I know, that proper interpolation of normals here should be quadratic, but, for some reason, linear looks better. </p>

<p>Let's call cyllinder $C(u,v) := (r\cos(u),\ v,\ r\sin(u))$</p>

<p>and the cone $K(u,v) := (\frac{r\cos(u)(h-v)}{h},\ v,\ \frac{r\sin(u)(h-v)}{h})$ where $u \in [0, 2\pi]$ and $v \in [0,h]$. $r, h$ are radius and height, respectively. </p>

<p>At the moment $t \in [0,1]$, body has equation $T(u,v) := (1-t)C(u,v)+tK(u,v)$.</p>

<p>Given that the normals are computed using partial derivative cross product formula, we get that normal to $T$ at $(u,v)$ is</p>

<p>$$(1-t)^2(C'_u\times C'_v)+t^2(K'_u \times K'_v)+t(1-t)M(u,v),$$ where $M(u,v) := C'_u \times K'_v+K'_u \times C'_v$.</p>

<p>So, apart from $M$, vertex normals to $T$ can be expressed as a quadratic inerpolation of corresponding normals for $C$ and $K$.</p>

<p>Linear interpolation of normals does not work perfectly, but performs way better in general, because whenever I try and implement the correct interpolation formula, somewhere halfway through, all those polygons in the mesh become very apparent.</p>

<p>For the reference GL_NORMALIZE is on, but I store parametrically generated normals (so I can apply my formula for intermediary bodies).</p>

CC BY-SA 3.0
2017-09-11T15:20:39.057Z
So  what is your question?
Simon F
CC BY-SA 3.0
2017-09-11T16:10:43.727Z
Mainly, I'm wondering if I'm missing something obvious in this scenario. Also, I'm quite surprised that cheating way looks much better than proper way.
Drinkwater
CC BY-SA 3.0
2017-09-18T11:02:10.743Z
What if you try to normalize also before passing your calculated normals to glNormalXXX(). As documentation says: "normal vectors are normalized to unit length AFTER transformation and before lighting". So in cases when interpolated normal has really small length (may happen during interpolation if C and K normals look in opposite directions) it may be distorted even more after transformation. This may happen in both interpolation schemes, but could be that effect is more visible if using quadratic interpolation
alariq
<interpolation><shading><animation>
Interpolating normals during animation
Drinkwater
# Interpolating normals during animation

(Asked by: username_0 on 2017-09-11)

I'm doing linear tweening of a cyllinder to a cone of equal radius and height in OpenGL. I know parametric equations of both of them, so I derived vertex normals accordingly. Now, I know, that proper interpolation of normals here should be quadratic, but, for some reason, linear looks better.

Let's call cyllinder $C(u,v) := (r\cos(u),\ v,\ r\sin(u))$

and the cone $K(u,v) := (\frac{r\cos(u)(h-v)}{h},\ v,\ \frac{r\sin(u)(h-v)}{h})$ where $u \in [0, 2\pi]$ and $v \in [0,h]$. $r, h$ are radius and height, respectively.

At the moment $t \in [0,1]$, body has equation $T(u,v) := (1-t)C(u,v)+tK(u,v)$.

Given that the normals are computed using partial derivative cross product formula, we get that normal to $T$ at $(u,v)$ is

$$(1-t)^2(C'\_u\times C'\_v)+t^2(K'\_u \times K'\_v)+t(1-t)M(u,v),$$ where $M(u,v) := C'\_u \times K'\_v+K'\_u \times C'\_v$.

So, apart from $M$, vertex normals to $T$ can be expressed as a quadratic inerpolation of corresponding normals for $C$ and $K$.

Linear interpolation of normals does not work perfectly, but performs way better in general, because whenever I try and implement the correct interpolation formula, somewhere halfway through, all those polygons in the mesh become very apparent.

For the reference GL\_NORMALIZE is on, but I store parametrically generated normals (so I can apply my formula for intermediary bodies).

**Tags:** interpolation, shading, animation

> **Comments:**
> **username_1**: So  what is your question?  
> **username_0**: Mainly, I'm wondering if I'm missing something obvious in this scenario. Also, I'm quite surprised that cheating way looks much better than proper way.  
> **username_2**: What if you try to normalize also before passing your calculated normals to glNormalXXX(). As documentation says: "normal vectors are normalized to unit length AFTER transformation and before lighting". So in cases when interpolated normal has really small length (may happen during interpolation if C and K normals look in opposite directions) it may be distorted even more after transformation. This may happen in both interpolation schemes, but could be that effect is more visible if using quadratic interpolation  

---

## 0 answers

