4
votes

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
Improper normal calculation. Most likely default sphere isn't exactly a truly solid object and is created from several segments aren't connected to each other. I.e. faces that are connected to edge with seam don't share same vertices - only copies of vertices that simply have similar coordinates.SigTerm
That is correct, they are 8 separate meshes that when aligned look like a solid sphere. The 8 meshes could be moved apart individually. You think the issue with the MakeTerrain function is the normal calculation? That would cause the edges of the 8 separate meshes to become raised or lowered more noticeablely than the rest as a result?Justin808
I'm only guessing based on the image, but it looks like the terrain is always the same height as the base mesh at the seams, as if the terrain is constrained to have 0 height above the mesh along the seams.cape1232

1 Answers

2
votes

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.