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.
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.
Well, you usually calculate your normals even before the 1st frame !!!
Your program should look like this:
- Build Terrain
- Calculate Poly Normals
- Calculate Point Normals
- 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 !).
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 !
[This message has been edited by Eric (edited 09-25-2001).]
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).]
thanks for your suggestions, 't was a big help!