View Full Version : Cleaning up bad polygons

10-12-2006, 03:31 AM
I have managed to make a right mess of an object, and I'm not sure how to clean it up...

It started out as a mesh of the nucleus of comet Halley. The points were aranged at equalyl intervals of latitude and longitude - this led to a lot of points near the poles, which produced a nasty puckering effect.

No problem I thought, merge points to get them more evenly spaced.

Which I did. It looked a it messy, so I cleaned out the 2 point polygons, and tripled everything to be safe.

Still looks a mess.

See attached....

What I think may have happned is that I have created not 2 point polygons, but three point ones where the same point has been re-used at one vertex. (Just a guess...). Anyone got any ideas on how to select these and kill them?


10-12-2006, 10:47 AM
What I think may have happned is that I have created not 2 point polygons, but three point ones where the same point has been re-used at one vertex. (Just a guess...). Anyone got any ideas on how to select these and kill them?

In your copy of AccuTrans, the "Prefs->Remove dupllicate vertices on merge" and the "Prefs->Remove duplicate faces on merge" menu items should be checked.

Read the LWO file into AccuTrans.

In the "save object with options" dialog box, the "lines" and "point cloud" check boxes should not be checked.

Save the LWO file and if three points in the triangle are at the same vertex, they should now be gone.


10-13-2006, 12:50 AM
Aha! Another use for this neat tool!

Wonder if there's a pure LW way? Or a way of avoiding the problem in the first place?


10-13-2006, 02:38 AM
If you have LWCAD 2.0 the LWCADExt -> Fix Polygons 2 takes care of a lot of polygon errors. Maybe that could do the trick. I've used it a lot recently :D

10-14-2006, 12:34 AM
OK I am nto the most experienced lightwave user but I think the problem lies in how you started. Looks like you started from a sphere and deformed it spheres have two nasty poles that cause problems; try usign a cube and subdivide it twice and start working from that point that will not give you the poles that are causing your problems.

10-14-2006, 07:29 AM
It's not an object I built, it started out in that shape...

10-14-2006, 10:12 PM
Do you still have the original object?

10-15-2006, 03:41 AM
Yes, I am not quite that dumb!
:D :D :D

10-15-2006, 12:14 PM
As you have the original, have you done any other experiments starting from the original object?

Have you checked the surface normals on the merged object?

10-15-2006, 01:05 PM
You can solve ANY polygon error in modeler itself.

Merge automatic again. Sometimes stuff gets missed first time around.
Check for 1 point polygons and 2 point polygons in the statistics panel.
Check for points without a polygon. Check.
repeat process.
If you still have errors, I would VERY much like to see that object. Can you email it to me, because it'll be the first time I would see it.
email is on my website which is linked in my signature.

10-15-2006, 03:10 PM
Thanks for the suggestions guys - I must admit I do not have any clear purpose here - I just hate that I don't understand it!

Anyway, if anyone else wants to poke with it, here's the link to the original, and the one with the merged points.


About 450k.


10-15-2006, 05:40 PM
Looks to me like the puckers are modeled into it. I think you'll just have to model them out. Putting it in the background and modeling a new object over it may be the fastest way, it's just a sphere that's been deformed. Maybe use BG_Conform?

10-15-2006, 11:01 PM
Just toss the bad file into the recycle bin.

The bad file looks like a poor job of polygon reduction. The bad file has 10838 triangles and the original file has 19584 triangles.

Except for a few triangles that have flipped surface normals, the geometry of the mesh is causing the problems.

Image 1: A close up of the north pole. There are a lot of little hills and valleys which are causing the lighting effects.

Image 2: The same view with edge display turned on. Rotating the mesh shows the geometry problems better. There are also 137 duplicate triangles in the mesh. They were removed for this display.

Image 3: Shows the north pole of the mesh from the good file. There are no little hills or valleys.

Image 4: Using the polygon reduction routine in AccuTrans, I reduced the triangle count to about the count used in your bad file.

Image 5: This is image 4 without the edges displayed. There are no little hills and valleys to cause the light scattering seen in the bad file.

AccuTrans uses a polygon reduction routine developed by Stan Melax. This is typical polygon reduction where the algorithm knows nothing about the shape of the object. Distances are calculated between the vertices. Vertices are dropped and new triangles are created based solely on the distances between the vertices. Depending on the shape of the mesh, it is hit and miss whether the polygon reduction in AccuTrans will be acceptable.

Other software will add additional rules to improve the polygon reduction.


Note: All of the distances between the vertices are calculated when the polygon reduction routine is started in AccuTrans. For very high polygon counts, there can be quite a delay as I haven't figured out how to speed up the calculation.

10-16-2006, 01:15 AM
I agree with Micromouse. There's nothing 'wrong' with the object. The seams and glitches are produced by triangles which are very thin and have odd geometry because they share only two of their vertices with the rest of the object. What caused this?

These triangles can be removed by selecting the points which are only connected to 2 other points (statistics panel, point mode), and delete them, and then the subsequent 2 point polys.

There are also triangles which just stand up and create seams while being properly connected, but sitting perpendicular to the surface.
These can be gotten rid of only by smoothing the object (I used the interactive smoothing script to see realtime how many iterations and strength was needed, find it on flay). I tried subpatching the object and freezing it but there are polygon loopbacks and all sorts of weird stuff happening.

Using LW's Reduce polygons+, or the updated version of it findeable on flay, called qemmloss3, this doesn't happen at all. Also the old but very useable reduction tool 'decimate' worked wonders on the original without any such garbage. As well as accutrans, LW has ample tools to suit your needs, I think.

10-16-2006, 01:40 AM
I think image #5 is a close-up of the big pucker at each pole that he's trying to remove in the first place.

10-16-2006, 11:49 AM
Thanks Again,
Toby has it correctly - the pucker is an error caused by data points too close together. I did not do a straightforward poly reduction, as it would try and preserve the creased detail, and I wanted to eliminate it.

Merging points that were too close seemed a more reasonable first step, as it would remove them.

The smothing script sunds like a much better way to get rid of creases to me...


10-16-2006, 01:35 PM
Image 6: Taking a closer look at the good file which was polygon reduced by AccuTrans. Vector normals for smooth rendering were calculated and smooth render display was turned on. There are dark areas on the mesh such as the one circled in red. Why?

Image 7: Edge display was turned and the red circle area was zoomed in on. The area appears quite smooth except why are 3 triangles dark and one is shiny.

Image 8: The three dark triangles were moved to layer "t1" and the layer was turned off for display purposes. Double sided display is turned on so you can see inside the mesh.

Image 9: The shiny triangle was moved to layer "t2" and turned off. Single sided display (cull back surfaces) was turned on. You can see a small thin triangle that was between the three dark ones and the shiny one. The surface normal had to be flipped on the thin triangle so that it could be seen when culling back faces.

Image 10: The thin triangle was moved to layer "t3". "Edit points" mode was selected and layer "t3" was selected. Zooming in on the thin triangle it has a vertex in the center and the three edges of the triangle actually surround an area in 3D space. In my world, this is NOT a 2 point poly but a thin triangle.

The polygon reduction in AccuTrans and some other programs is based on measuring the distances between the vertices. Working from the smallest distance to the largest distance, vertices are collapsed on to other vertices.

If you were doing this in manual mode, this would mean you would grab vertex C16 and drag it to and drop it on vertex K45.

While dragging vertex C16 all the polygon edges connected to it are dragged along. This changes the shape of all the triangles connected to the vertex. It is perfectly normal to get thin triangles when reducing polygon meshes.

To determine angles for lighting calculations, normal vectors are calculated at each vertex of the polygon. For smooth rendering if several polygons meet at a common vertex, an average normal is calculated from the individual normals and this normal is used for lighting calculations for all the polygons that meet at that common vertex.

For the example shown here, even if the thin triangle is deleted, there will still be three dark triangles and one shiny one.

The three dark triangles meet at the center of one of the edges of the shiny triangle. As the dark triangles do not share a vertex with the shiny triangle at this point and the triangles are not on the same plane in 3D space, different normal vectors are used and the lighting effects are different.

The only way to fix the lighting problems is to repair the geometry in the problem areas.

If you do a lot of polygon reduction, you may require several different programs that do polygon reduction. The algorithms vary between the programs and any one of them may not provide acceptable results on all the different mesh shapes.