Jump to content



normal vector and triangle strip

  • You cannot reply to this topic
3 replies to this topic

#1 arkerone   Members   -  Reputation: 100

Like
0Likes
Like

Posted 25 February 2012 - 05:57 PM

hi everybody,

i generate a map with this tuto http://www.chadverno...h-a-heightmap/and i generate the map with triangle strip but i want to calculate the normals on vertices but how calculate those normals?

Thx!

Ad:

#2 Vlad86   Members   -  Reputation: 103

Like
0Likes
Like

Posted 28 February 2012 - 11:58 AM

N = normalize( cross( v1 - v2, v3 - v2 ) );

Its a flat normal.

good luck

#3 NicoLaCrevette   Members   -  Reputation: 151

Like
0Likes
Like

Posted 29 February 2012 - 06:27 AM

Hello arkerone

Mainly the 3 steps are :

1) computation of per face normals (with the formula suggested by Vlad86)
2) computation of the adjacency data (so we know then : which vertex belongs to which faces(s) )
3) combination of per face normals accordingly to adjacency data to compute the wanted per vertex normals.

But there's not an unique technique to do the 3)
For instance, you can average the 1) normals, either directly, or taking into account the area of the triangles the vertices belong to.

Maybe you can take a look at this post?

Nico

EDIT : The best results I got were when taking into account triangle areas : a little example with this technique
[attachment=7512:exemplepournormales.PNG]

#4 BornToCode   Members   -  Reputation: 236

Like
0Likes
Like

Posted 29 February 2012 - 02:56 PM

If your Triangles are defined in CW direction do what Vlad says otherwise just compute the cross product by doing N = normalize( cross(v3 - v2, v1 - v2, ) );






We are working on generating results for this topic
PARTNERS