0
101 Jul 26, 2003 at 05:02

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:

#### 8 Replies

0
101 Jul 26, 2003 at 09:36

yes. For every vertex normal, you average each poly normal that uses that vertex

0
101 Jul 26, 2003 at 10:11

faster ways ??? preferably you precalculate this once…

0
101 Jul 26, 2003 at 23:42

@anubis

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:

0
101 Jul 27, 2003 at 02:25

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? ..

0
101 Jul 31, 2003 at 08:15

thanks..i got it working. :)

here are the results:

before:
[img]http://www.vision-software.org/garoudexample2.JPG[/img]

after:
[img]http://www.vision-software.org/garoudexample.JPG[/img]

0
101 Jul 31, 2003 at 20:33

thanks
:yes:

0
101 Aug 02, 2003 at 18:49

gouraud shading is just using vertex normals for lighting.

0
101 Aug 03, 2003 at 20:02

yep, nothing special in gouraud shading.. just different specified normals..