# Calculating vertex normals

This topic is 2567 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hiyas, slightly off-center question here, no code involved!

I have an exam coming up for which I am woefully unprepared. And I just can't figure out how to get this done. Could anyone fill me in? As concisely as possible? Many thanks for any help

##### Share on other sites
You have to calculate the normals of the 4 triangles that use that vertex (so you can ignore vertex <-10,15,10> and <1,18,16>), then average those 4 normals.

##### Share on other sites
interesting, if those large quads/triangles are part of that sphere then you should use the fact that its a sphere to your advantage. Are those numbers vertex positions? Can't quite work out if its possible to do with the information you've been given.

I guess your safer calculating the face vertices and smootinhg. Will these be weighted though?

##### Share on other sites
If it's a sphere....then just normalise the vertex position - job done.

##### Share on other sites

If it's a sphere....then just normalise the vertex position - job done.

If its centered at the origin yeah, but is it?

##### Share on other sites

You have to calculate the normals of the 4 triangles that use that vertex (so you can ignore vertex <-10,15,10> and <1,18,16>), then average those 4 normals.

okay so the equation I have for finding the triangle normals is

(we have three vertices v1, v2, v3)
u1 = (v2 - v1) / || (v2 -v1) || - where || A || is the magnitude of A
u2 = (v3 - v1) / || (v3 - v1) ||

normal = u2 x u1 / || u2 x u1|| - where x denotes cross product

so we get 4 triangle normals n1, n2, n3, n4

Our vertex normal vn is:

vn = ( 1/4 * (n1 + n2 + n3 + n4) ) / || ( 1/4 * (n1 + n2 + n3 + n4) ) ||

Is this correct? Seems like something of a pain in the ass.

##### Share on other sites
If it's a sphere....then just normalise the vertex position - job done.[/quote]

If its centered at the origin yeah, but is it?[/quote]

That does not make a big difference. Let's say you know the origin. Then you get the right normal by normalizing (Vertexposition-Origin).

##### Share on other sites

If it's a sphere....then just normalise the vertex position - job done.

If its centered at the origin yeah, but is it?[/quote]

That does not make a big difference. Let's say you know the origin. Then you get the right normal by normalizing (Vertexposition-Origin).
[/quote]
There is nothing in the assignment that directly indicates where the origin is.

##### Share on other sites

[quote name='thefries' timestamp='1305416000' post='4810881']
You have to calculate the normals of the 4 triangles that use that vertex (so you can ignore vertex <-10,15,10> and <1,18,16>), then average those 4 normals.

okay so the equation I have for finding the triangle normals is

(we have three vertices v1, v2, v3)
u1 = (v2 - v1) / || (v2 -v1) || - where || A || is the magnitude of A
u2 = (v3 - v1) / || (v3 - v1) ||

normal = u2 x u1 / || u2 x u1|| - where x denotes cross product

so we get 4 triangle normals n1, n2, n3, n4

Our vertex normal vn is:

vn = ( 1/4 * (n1 + n2 + n3 + n4) ) / || ( 1/4 * (n1 + n2 + n3 + n4) ) ||

Is this correct? Seems like something of a pain in the ass.
[/quote]

Can anyone verify the correctness of this?

##### Share on other sites
I *think* you can do it a bit simpler....

u1 = (v2 - v1)
u2 = (v3 - v1)

normal = u2 x u1

Then just normalise "normal"....

normal /= || normal ||

I think that's correct...

• 16
• 9
• 13
• 41
• 15