garoud shading

F699ebb187331fdf7f7875320e3e7e3e
0
starboarder2001 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

Please log in or register to post a reply.

0684f9d33f52fa189aad7ac9e8c87510
0
baldurk 101 Jul 26, 2003 at 09:36

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

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Jul 26, 2003 at 10:11

faster ways ??? preferably you precalculate this once…

F699ebb187331fdf7f7875320e3e7e3e
0
starboarder2001 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:

6ad5f8c742f1e8ec61000e2b0900fc76
0
davepermen 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? ..

F699ebb187331fdf7f7875320e3e7e3e
0
starboarder2001 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]

C24eb7e6aaefba78b94c831ddc7b4d0b
0
donBerto 101 Jul 31, 2003 at 20:33

anybody got some code/links to code about garoud shading? sounds interesting.

thanks
:yes:

0684f9d33f52fa189aad7ac9e8c87510
0
baldurk 101 Aug 02, 2003 at 18:49

gouraud shading is just using vertex normals for lighting.

6ad5f8c742f1e8ec61000e2b0900fc76
0
davepermen 101 Aug 03, 2003 at 20:02

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