PDA

View Full Version : normals per point



martinzwigl
09-25-2001, 05:21 AM
hi folks

i got lighting-normals per poly in my terrain. now i want to do normals per point. building the average from the four planes around my point.
is it a good i idea to calc the normals per plane in the first frame? in the second frame i wanted to calc the normals per point and save it in an array and from the third rendercycle on i just wanted to read from the array. since i got apx. 40 fps i don't think the user would "see" the first two frames.

is there other "fast" possibilities. i don't think there is a way around of first calculating normals to the poly and then building the average.

cheers,
martin

harsman
09-25-2001, 05:52 AM
If the normals are static, how is this a performance problem? You do it once at startup and then you're done. Or are you retriangulating for LOD or something like that? Also, I don't really see the point of spreading it over two frames, unless you have to do it constantly, with a dynamic mesh. Then thy might not notice, try it and see how it looks.

Eric
09-25-2001, 05:54 AM
Well, you usually calculate your normals even before the 1st frame !!!!

Your program should look like this:

1) Build Terrain
2) Calculate Poly Normals
3) Calculate Point Normals
4) RENDERING LOOP

You should never try to calculate normals within the rendering loop (except if your terrain is dynamic in which case you will have to recalculate the normals each frame !).

Regards.

Eric

P.S.: you can do what you describe, but I'd qualify that as a bad programming practice...

P.S. 2: hem, harsman was faster ! http://www.opengl.org/discussion_boards/ubb/wink.gif


[This message has been edited by Eric (edited 09-25-2001).]

DFrey
09-25-2001, 05:56 AM
I'm guessing you are using a streaming procedural terrain, e.g. fixed function. If so, then that sounds like a reasonable method (especially if the new points are beyond the fog or far plane). Otherwise I'd just precalculate all the normals before drawing any of the terrain.



[This message has been edited by DFrey (edited 09-25-2001).]

martinzwigl
09-25-2001, 07:54 AM
thanks for your suggestions, 't was a big help!

cheers,
martin