Adjacent Triangles

Blitz3D Forums/Blitz3D Beginners Area/Adjacent Triangles

octothorpe(Posted 2005) [#1]
The shape below is single-surface. It was constructed by addmesh()ing together four meshes. Note the two black pixels along a junction between two quads. There are actually a lot of parallel quads which are joined together without artifacts in this mesh, but that junction is the only one that causes any artifacts. How can I fix this?






octothorpe(Posted 2005) [#2]
A (much) simpler program to reproduce the problem:




sswift(Posted 2005) [#3]
I think you will find the only way to fix it is to trianglulate the mesh properly.

You should tesselate the mesh like so:
   _
 _|_|_
|\|\|\|
 - - -


With one vertex where each vertical and horizontal line meets. That top square should have a \ in it too, but I can't draw both a horizontal line across the bottom, and a slash.

Anyway, that shows that you should have 8 polygons in the T shape, not 4. The reason you get black dots is simply because of floating point inaccuracies. Sometimes you can get away with it, sometimes not. But pretty much all pro game developers set up the meshes like this to avoid those issues.

Also, the difference between this paralell quad and the others is that the others all share vertices on all edges, whereas these two KIND OF share an edge, but the two edges each use seperate vertices, so they're really not the same edge. That's the source of the problem. The two edges don't pass through precisely the same space. When you have two edged which use the same vertices, they're guaranteed to pass through the same space, but here you aren't sharing vertcies, so floating point inaccuracy causes them to be slightly different.


Ice9(Posted 2005) [#4]
This may be a quick and dirty method that may produce
the results you want. There are UnWeldMesh and WeldMesh
functions in the code archive.


sswift(Posted 2005) [#5]
Ice:
If those functions do what I think they do, then those won't help. His problem is not vertices which are placed at the same location in space but not welded, it's edges which are not sharing vertices because the vertices are far away from one another and the edges they form just happen to lie on the same line in space.


octothorpe(Posted 2005) [#6]
That solved it, thanks sswift!