Mesh Smoothing Demo

Community Forums/Showcase/Mesh Smoothing Demo

TeraBit(Posted 2009) [#1]
Hi All,

Long time! Just been playing with my old dismantled 3D Engine in BlitzMax and thought I'd show what I was tinkering with.

Mesh Smoothing Demo (150kb)

The above demo shows a sphere and all the normals that go with it (Vertex & Face Normals (Grey & Red Lines respectively)).

There are two common methods (I know of) to set up vertex normals on arbitrary created meshes, both have problems.

1) Fully Smoothed - This is where every vertex that shares a common position has the normals added together and normalised. This makes cubes look bizarre since they try to smooth around the 90 deg. edges.

2) Smooth Welded - This is where welded vertices (triangles that share the same physical vertex) are smoothed across, whereas separate unwelded triangles are not. This causes problems because getting discontinuous UVs set up means unwelding some triangles, which means they don’t get smoothed.

The solution I went with on my engine was to go with adding a smoothing angle to #1.

So for each vertex which shares the same space, compare the face normals for the triangle they came from and measure the angle between them (dot product).

If below a material defined threshold (Default 89.9 degrees) then smooth the normals between the triangles else leave them as they are.

The effect is best observed on the demo:

You use the up and down arrows on the keyboard to increase or decrease the smoothing angle respectively.


TeraBit(Posted 2009) [#2]
UPDATE:
I have updated the demo to use a Cylinder instead of a Sphere since this shows the advantage of having things smoothed by angle.

Note the ends of the Cylinder do not get smoothed in until you go over 90 degrees, but the sides will once you get to 45 degrees.