Skip to main content
GameDev.net gamedev.net
🔒 Locked

Smooth normal computing

Started by dVil Sep 7, 2010 at 12:09 PM 4 replies 1.8k views
Original Post
dVil
dVil
Hi, here is my issue :
Consider 5 vertices :
A( 0., 0., 0. ),
B( 0., 0., 1. ),
C( 1., 0., 1. ),
D( 1., 0., 0. ),
E( 1., -1., 1. );

with 3 faces :
1 : A, B, C
2 : A, C, D
3 : B, E, C

If these free faces are in the same smoothing group,
could you explain me how to compute the correct normal at the C point ?
Algorithm i saw run through faces and sum face normal to the vertex normal.
Then apply a division to mean and finally normalization.

Two questions :
1) Isn't the division useless ???
2) considering the exemple above, using this algorithm, the normal at the C point will be :

Nc = N1( 0., 1., 0. ) + N2( 0., 1., 0. ) + N3( 0., 0., 1. )
= N( 0., 2., 1. ).Normalize()

why did I expect my normal to be :
Nc = N( 0., 1., 1. ).Normalize()

Apologize my engl,
feel free to answer
thx
ginkgo
ginkgo
This might be useful to you: http://iquilezles.org/www/articles/normals/normals.htm
dVil
dVil
Great, thanks for the link, it solves my first question, and bring me a new information for these face normals that you dont normalize.
BUT....
My interest was more on the second question :S
Buckeye
Buckeye
N( 0., 2., 1. ).Normalize() = N( 0, 0.89, 0.45 )

To normalize a vector, divide each component by the length of the vector.

Length of (0,2,1) = sqrt(2*2+1) = sqrt(5) = 2.236.

2/2.286 = 0.89.
1/2.286 = 0.45.
Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly. You don't forget how to play when you grow old; you grow old when you forget how to play.
dVil
dVil
humm, i do know how to compute the length of a vector thanks, even then how to normalize it.
But, this is another way to my issue :

open 3DS max :
Test 1 :
create cube on 0,0,0
Convert to trimesh
Select all faces, clear smooth groups, click on 1st group
Apply Edit normals modifier.... observe nice normals

Test 2 :
Remove modifier
Remove faces and move vertex to reproduce given exemple in my first post,
and apply normal modifier.

Normals looks like ponderated due to the additive algorithm

I cant believe its the same algorithm for test1 and test2
and i would like to perform test1 results !

Once again, apologize my engl level ^^
dVil
dVil
!!! SOLVED !!!

I found this :
http://www.gamedev.net/community/forums/topic.asp?topic_id=486058

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.