linear combination of vertices vs. normals

469efeebeeceb059627bcee6eec54796
0
mankind 101 Apr 20, 2011 at 21:33

Hi,

Is it possible to prove that if a new vertex is produced by linearly combining two other vertices, its normal will be linear combination of the two normals?

It seems that way experimentally.

Thanks!

14 Replies

Please log in or register to post a reply.

17ba6d8b7ba3b6d82970a7bbba71a6de
0
vrnunes 102 Apr 20, 2011 at 22:33

The average of the two normals, you mean?

6eaf0e08fe36b2c23ca096562dd7a8b7
0
__________Smile_ 101 Apr 20, 2011 at 22:43

It is not true if neighbour vertices have different weighting factor.

For example, Mesh1 & Mesh2 have only vertical normals while blended mesh not:

normalsr.png

469efeebeeceb059627bcee6eec54796
0
mankind 101 Apr 20, 2011 at 22:48

Yes, I mean let:
v1 be on mesh1
v2 be on mesh2
and create mesh3 where v3 = 0.5 * (v1+v2)
under which conditions n3 = 0.5*(n1 + n2) ?

469efeebeeceb059627bcee6eec54796
0
mankind 101 Apr 20, 2011 at 22:50

I didn’t follow your example }:+()___ [Smile], could you please explain?

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Apr 21, 2011 at 00:06

The blended mesh is created by linearly interpolating corresponding verts of Mesh1 and Mesh2, but the interpolation factor is not always 0.5, as it varies between verts (from 0 on the left to 1 on the right). In this case linearly interpolating the normals would give the wrong result.

Even if the interpolation factor is constant over the whole mesh, I do not think it completely works. It may give a good approximation in many cases however.

469efeebeeceb059627bcee6eec54796
0
mankind 101 Apr 21, 2011 at 04:07

Right the linear interpolation is constant over the whole mesh. Can someone identify the conditions under which that works?

What are the assumptions that are made in such a case?

Thanks

6eaf0e08fe36b2c23ca096562dd7a8b7
0
__________Smile_ 101 Apr 21, 2011 at 13:01

Mathematically, linear interpolation of normals is incorrect even in case of constant blending factor.

Consider interpolation between triangles {(0,0,0); pt1; pt2} and {(0,0,0); pt1+d1; pt2+d2}. Unnormalized normals will be cross(pt1, pt2) and cross(pt1+d1, pt2+d2) correspondingly.

With interpolation factor t triangle becomes {(0,0,0); pt1+t*d1; pt2+t*d2}. Right normal for this triangle is

cross(pt1+t*d1, pt2+t*d2) = cross(pt1, pt2) + t*cross(pt1, d2) + t*cross(d1, pt2) + t*t*cross(d1, d2).

Interpolated normal diverges from that expression in last term, simple linear interpolation gives t*cross(d1, d2) instead of t*t*cross(d1, d2).

In case of normalized normals expressions will be more heavy but not mathematically correct either.

Fd80f81596aa1cf809ceb1c2077e190b
0
rouncer 103 Apr 21, 2011 at 15:00

x3=(x1+x2)/2
y3=(y1+y2)/2
z3=(z1+z2)/2
(renormalize 3)
doesnt get any more complex when your subdividing a triangle.

469efeebeeceb059627bcee6eec54796
0
mankind 101 Apr 21, 2011 at 19:20

Could you explain that–how does it relate to normals?

@rouncer

x3=(x1+x2)/2
y3=(y1+y2)/2
z3=(z1+z2)/2
(renormalize 3)
doesnt get any more complex when your subdividing a triangle.

469efeebeeceb059627bcee6eec54796
0
mankind 101 Apr 21, 2011 at 19:24

I wonder if it is the correct way to define that problem. I am thinking about that as having a point p1 on one mesh and a point p1+d1 on another mesh and producing p1’ = p1 + t*(p1+d1). When normals are calculated need to take triangle around p1 to get n1 and triangle around (p1+d1) to get n2. It doesn’t seem to be the same as stretching the original triangle. Is it correct?

@’

‘]Mathematically, linear interpolation of normals is incorrect even in case of constant blending factor.

Consider interpolation between triangles {(0,0,0); pt1; pt2} and {(0,0,0); pt1+d1; pt2+d2}. Unnormalized normals will be cross(pt1, pt2) and cross(pt1+d1, pt2+d2) correspondingly.

With interpolation factor t triangle becomes {(0,0,0); pt1+t*d1; pt2+t*d2}. Right normal for this triangle is

cross(pt1+t*d1, pt2+t*d2) = cross(pt1, pt2) + t*cross(pt1, d2) + t*cross(d1, pt2) + t*t*cross(d1, d2).

Interpolated normal diverges from that expression in last term, simple linear interpolation gives t*cross(d1, d2) instead of t*t*cross(d1, d2).

In case of normalized normals expressions will be more heavy but not mathematically correct either.

469efeebeeceb059627bcee6eec54796
0
mankind 101 Apr 21, 2011 at 20:13

I think this is the derivation:

p1 is the point on mesh1 and p2=p1+d is the point on mesh2.
n1 = p1 x (p1+v) –> this basically assumes that there is a dense mesh
n2 = (p1+d) x (p1+d+v) —> this assumes again density, that the neigh point on mesh2 is close by v to p2.

then the new point p = p1+ t*(p1+d) and its normal will be
n = (p1+t*(p1+d)) x (p1+t*(p1+d)+v)
= (p1+t*(p1+d)) x v
= n1 + t*n2

what do you guys say?

@mankind

I wonder if it is the correct way to define that problem. I am thinking about that as having a point p1 on one mesh and a point p1+d1 on another mesh and producing p1’ = p1 + t*(p1+d1). When normals are calculated need to take triangle around p1 to get n1 and triangle around (p1+d1) to get n2. It doesn’t seem to be the same as stretching the original triangle. Is it correct?

6eaf0e08fe36b2c23ca096562dd7a8b7
0
__________Smile_ 101 Apr 21, 2011 at 21:13

@mankind

p1 is the point on mesh1 and p2=p1+d is the point on mesh2.
n1 = p1 x (p1+v) –> this basically assumes that there is a dense mesh

What is ‘v’? For correct definition of normal we need at least 3 points: n1 = (p2-p1) x (p3-p1).
@mankind

then the new point p = p1+ t*(p1+d) and its normal will be

Wrong formula, must be p = (1-t)*p1 + t*(p1+d) = p1 + t*d.

A normal is nonlinear (quadratic in simple case) function of points position. Simple interpolation works only in case of linear functions.

469efeebeeceb059627bcee6eec54796
0
mankind 101 Apr 21, 2011 at 21:21

It doesn’t matter what interpolation, I just formulated exactly the same way as you did to be consistent.

I assumed each triangle is consists of 0,0,0 p1 and p1+v

I’m trying to say that maybe the way you defined it is not completely correct–since it’s not like we’re stretching the triangle when we interpolate but we take other points (which are close to the interpolated point) to get the normal.

@’

‘]What is ‘v’? For correct definition of normal we need at least 3 points: n1 = (p2-p1) x (p3-p1).

Wrong formula, must be p = (1-t)*p1 + t*(p1+d) = p1 + t*d.

A normal is nonlinear (quadratic in simple case) function of points position. Simple interpolation works only in case of linear functions.

6eaf0e08fe36b2c23ca096562dd7a8b7
0
__________Smile_ 101 Apr 22, 2011 at 09:30

Well, ‘v’ isn’t constant between triangles, so interpolated normal will be
n = (p1 + t*d) x (v + t*dv) != n1 + t*(n2-n1).
Error is t*(1-t)*[d x dv] – then rotation and deformation of each triangle is small compared with its size, error is small also.

Interpolation is essentially stretching triangles and normals usually calculated as weighted sum of neighbour triangle normals. But even if our meshes are approximation of some mathematic surfaces and normals calculated from exact derivatives, error will be the same order as normal is nonlinear function of that derivatives.