View Full Version : "True" normal

arieb

05-11-2001, 01:31 PM

Hello ,

I don't quit understand the "true" normals....

In my text book(OpenGL Super Bible 2nd Edition) they say that for smooth appearance

it better calc the average normal for each shared vertex, and use this average value before assign the vertex for render.

is this mean that :

when I parse my complex mash object (x-wing fighter) I look for all the triangles where my vertex let say 112 in the array appear (12 times) calc normals for all those triangles and the average will use me when render vertex[112] ????

Is this "true" normals really needed if my object create from many triangles ???

Arie

Korval

05-11-2001, 01:51 PM

That quote is assuming that you want smooth blending across all faces. On something where there are supposed to be hard edges, you should not include those faces in the average of the vertices in question.

arieb

05-11-2001, 02:05 PM

yes , but what shell I do if mesh made of many triangles (the xwing spaceship) , I really cant tell where is hard edges

ffish

05-11-2001, 09:34 PM

From a linear algebra book I've got:

If v and w are nonzero vectors then (v dot w)/(| |v| | | |w| |) = cos theta

where theta is the angle between the two vectors. Therefore acos of the lhs of that formula gives you the angle between two vectors. In your program, if the angle is greater than some threshold, you have a hard boundary so don't average normals, otherwise, average them. You'll have to determine the threshold through trial and error - whatever looks best for your model.

<edit>The bottom of that formula doesn't look very good - it's the length of v * the length of w</edit>

Hope that helps.

[This message has been edited by ffish (edited 05-11-2001).]

Dario

05-15-2001, 01:54 AM

Originally posted by ffish:

From a linear algebra book I've got:

If v and w are nonzero vectors then (v dot w)/(| |v| | | |w| |) = cos theta

where theta is the angle between the two vectors. Therefore acos of the lhs of that formula gives you the angle between two vectors. In your program, if the angle is greater than some threshold, you have a hard boundary so don't average normals, otherwise, average them. You'll have to determine the threshold through trial and error - whatever looks best for your model.

<edit>The bottom of that formula doesn't look very good - it's the length of v * the length of w</edit>

Hope that helps.

[This message has been edited by ffish (edited 05-11-2001).]

hmm, isn't that supposed to read: "if the angle between the two vectors is *less than* the threshold..." ?

Dario, I think ffish is right: let's say the normal have got the same direction (so you want to smooth between the faces). The angle is 0. Now, let's suppose that the angle between the two normals is 50: say, our threshold for the angle is 30, so you do not want to smooth here.

ffish is right when he says: "if the angle is greater than some threshold (here 30), you have a hard boundary".

Of course, when theta increases from 0 to 90, cos theta decreases from 1 to 0. So, if you use cos theta for your test (which is a usual optimisation !), you can say "if the cosine of the anle is lower than some threshold, you have a hard boundary".

Regards.

Eric

Powered by vBulletin® Version 4.2.5 Copyright © 2018 vBulletin Solutions Inc. All rights reserved.