Re: [Algorithms] Terrain Normals
Brought to you by:
vexxed72
From: Jim O. <j.o...@in...> - 2000-08-14 18:10:35
|
I use a form of bilinear filtering to calculate my vertex normals, like so: +-----+ |\ 1 /| | \ / | |4 X 2| | / \ | |/ 3 \| +-----+ Where the normal of vertex X is the average of the normals of triangles 1...4. Note that the above does _not_ represent the actual layout of my terrain mesh, which has the following (probably quite familiar) layout: +-----+ | /| /| |/ |/ | +--+--+ | /| /| |/ |/ | +-----+ This seems to work when it comes to avoiding the gray bands you are referring to. Hope this helps, Jim Offerman Innovade - designing the designer ----- Original Message ----- From: "Pai-Hung Chen" <pa...@ac...> To: <gda...@li...> Sent: Monday, August 14, 2000 8:22 AM 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 > |