views:

92

answers:

1

Hi :)

I'm working in Unity3D, but my issue is with 3D meshes. I'm hoping someone here can help or point me in the right direction.

I have 2 version of code, http://www.pasteit4me.com/695002 (old) and http://www.pasteit4me.com/690003 (new). The old code, makes a single mesh sphere and creates a terrain on it. The new code makes an 8 mesh sphere and creates a terrain on it.

On the new version the edges of the meshes are obviously seen and I'm not sure why. It looks like the edges are adjusted no much, almost 2-3 times more than they should have been. GenerateB() in the old code and Generate() in the new code creates the sphere. MakeTerrain() in both create the terrain.

If I dont run the MakeTerrain() function the new sphere looks like a solid mesh. I'm not sure where to start looking in the MakeTerrain() function in the new code to solve the issue :-/

Any ideas?

An image of the issue is at http://img28.imageshack.us/img28/3784/screenshot20100611at850.png.

+1  A: 

You don't have the same normals along the edges for all of the segments. You have to take into account the triangles on both sides of a seam to calculate the normal. You can't do that when you are only looking at each segment individually.

Jose