RE: [Algorithms] Terrain Normals
Brought to you by:
vexxed72
From: Pallister, K. <kim...@in...> - 2000-08-14 19:42:59
|
I had similar problems that I assumed were just the gouraud shading, until I drew the normals, and then could see the problem clearly (a code bug). Draw the normals. Not hard, and it will help you. Kim Pallister We will find a way or we will make one. - Hannibal > -----Original Message----- > From: Pai-Hung Chen [mailto:pa...@ac...] > Sent: Sunday, August 13, 2000 11:23 PM > To: gda...@li... > Subject: [Algorithms] Terrain Normals > > > Hi, > > I've written a routine to read a bitmap heightfield and > construct a terrain > mesh from it. I partition each set of four pixels into two > triangles along > the upper-right-to-lower-left diagonal line. Therefore, for > example, a 128 > x 128 bitmap will produce (128-1) x (128-1) x 2 = 32258 > triangles using my > method. For each triangle I caculate its unit face normal. > For each vertex > of a triangle, I calculate its vertex normal by adding and > averaging the > face normals of all triangles that share the vertex (in my > case a vertex can > be shared by at most six triangles and at least one triganle) and then > normalize the averaged normal, which is used in redering. My > problem is > that there are some *horizontal dimmed banding* effects along > the triangle > edges of the mesh when rendering in D3D with light cast on > it. Also, there > are very visible dimmed seams between triangles when light is > cast on it. > All these artifacts seem to manifest only when light is cast > in large angles > (i.e. not directly). Is it because the arrangement of > triangles in my mesh > is too *uniform* (actually they are extremely uniform)? Or is my > calculation of vertex normals incorrect? > > Thanks in advance, > > Pai-Hung Chen > > > > _______________________________________________ > GDAlgorithms-list mailing list > GDA...@li... > http://lists.sourceforge.net/mailman/listinfo/gdalgorithms-list > |