PDA

View Full Version : garoud shading


starboarder2001
07-25-2003, 11:02 PM
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:

baldurk
07-26-2003, 03:36 AM
yes. For every vertex normal, you average each poly normal that uses that vertex

anubis
07-26-2003, 04:11 AM
faster ways ??? preferably you precalculate this once...

starboarder2001
07-26-2003, 05:42 PM
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:

davepermen
07-26-2003, 08:25 PM
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? ..

starboarder2001
07-31-2003, 02:15 AM
thanks..i got it working. :)

here are the results:

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

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

donBerto
07-31-2003, 02:33 PM
anybody got some code/links to code about garoud shading? sounds interesting.

thanks
:yes:

baldurk
08-02-2003, 12:49 PM
gouraud shading is just using vertex normals for lighting.

davepermen
08-03-2003, 02:02 PM
yep, nothing special in gouraud shading.. just different specified normals..