Averaging normals

Blitz3D Forums/Blitz3D Programming/Averaging normals

JoshK(Posted 2004) [#1]
Okay, I have two adjacent terrain tiles. I used UpdateNormals() to calculate most of their normals, but the edges need to be "locked" so there isn't a visible line between terrain tiles.

I find the adjacent vertices, sum their normals, then normalize and set both vertices to this same normal. This looks a lot better, but I still have a little bit of a visible line between them in some spots. By definition, summing the normals and normalizing should give a really smooth result that looks good on both the tiles...but I can still see as line. Any ideas?

				nx#=(VertexNX(surf,v0)+VertexNX(topsurf,v1))
				ny#=(VertexNY(surf,v0)+VertexNY(topsurf,v1))
				nz#=(VertexNZ(surf,v0)+VertexNZ(topsurf,v1))
				mag#=Sqr(nx*nx+ny*ny+nz*nz)
				nx=nx/mag
				ny=ny/mag
				nz=nz/mag
				VertexNormal surf,v0,nx,ny,nz
				VertexNormal topsurf,v1,nx,ny,nz



JoshK(Posted 2004) [#2]
I found the problem. I havew verts in the right row, but I am comparing the wrong verts.