8 replies to this topic

### #1starboarder2001

Member

• Members
• 35 posts

Posted 26 July 2003 - 05:02 AM

Ok i have a patch of terrain. Right now i just calculate the normals for every polygon. Is what i am wondering is what methods there are for garoud shading. If i am not mistaken...is what you do is average the normals of all the polygons that are in contact with the polygon. Are there any faster ways of doing this? Or am i doing it wrong? :huh:
1000
0100
0010
0001

### #2baldurk

Senior Member

• Members
• 1057 posts

Posted 26 July 2003 - 09:36 AM

yes. For every vertex normal, you average each poly normal that uses that vertex
baldurk
He who knows not and knows that he knows not is ignorant. Teach him.
He who knows not and knows not that he knows not is a fool. Shun him.

### #3anubis

Senior Member

• Members
• 2225 posts

Posted 26 July 2003 - 10:11 AM

faster ways ??? preferably you precalculate this once...
If Prolog is the answer, what is the question ?

### #4starboarder2001

Member

• Members
• 35 posts

Posted 26 July 2003 - 11:42 PM

anubis said:

faster ways ??? preferably you precalculate this once...
What if you have a animated model...would you store the normals for every frame in the file or pre-calculate them for every frame at runtime?

Thanks for the help. :) I will pre-calculate them for the terrain...and probably for the models. I am still not sure what the best way to do it for the animated models. :huh:
1000
0100
0010
0001

### #5davepermen

Senior Member

• Members
• 1306 posts

Posted 27 July 2003 - 02:25 AM

recalculate or transform.. depends on how you animate it..

there are very fast algos for generating normals for terrain, and so for deformable terrain recalculation is easy (and you can do "local recalc" instead of recalc everything..)

there is a very fast general algorithm to calc normals wich is O( A+B ) where A is the amount of faces, and B is the amount of vertices..

most the time you don't animate your meshes randomly. if you have keyframes, you can interpolate normals as well (but don't use linear interpolation directly! ..)

if you do skinning, you can transform the normals by the skinning-matrices as well.. you just have to know how to:D

hope that gives some ideas.. i can write down the structure of the algo as well.. isn't it somewhere yet in those forums? ..
davepermen.net
-Loving a Person is having the wish to see this Person happy, no matter what that means to yourself.
-No matter what it means to myself....

### #6starboarder2001

Member

• Members
• 35 posts

Posted 31 July 2003 - 08:15 AM

thanks..i got it working. :)

here are the results:

before:

after:

1000
0100
0010
0001

### #7donBerto

Senior Member

• Members
• 369 posts

Posted 31 July 2003 - 08:33 PM

thanks
:yes:
Imagine.

### #8baldurk

Senior Member

• Members
• 1057 posts

Posted 02 August 2003 - 06:49 PM

gouraud shading is just using vertex normals for lighting.
baldurk
He who knows not and knows that he knows not is ignorant. Teach him.
He who knows not and knows not that he knows not is a fool. Shun him.

### #9davepermen

Senior Member

• Members
• 1306 posts

Posted 03 August 2003 - 08:02 PM

yep, nothing special in gouraud shading.. just different specified normals..
davepermen.net
-Loving a Person is having the wish to see this Person happy, no matter what that means to yourself.
-No matter what it means to myself....

#### 1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users