2
$\begingroup$

What are some common techniques for making the edges on a tesselated shape less apparent without increasing the amount of tesselation which is actually carried out?

As an example, I followed along with this tutorial on tesselation shaders, and one can control the inner and outer tesselation levels. With relatively low levels of both, one can achieve a pretty good sphere. However, in order for the surface to actually appear smooth, a fairly bright light seems to be required.

This particular implementation uses triangular tesselation beginning from an icosahedron to approach a sphere.

My understanding is that performing the tesselation with quads would result in a smoother surface.

Here is a picture which illustrates how direct lighting makes it much harder to see the level of tesselation. On the top right of the sphere, where the light is hitting it strongly, no edges are visible, wheres on the bottom left, the edges can easily be seen. Perhaps in practice, simply applying a texture would mask many of the edges?

tesselation and lighting

$\endgroup$
3
$\begingroup$

GL_SMOOTH interpolates the vertex attributes of the primitive (triangle), it looks like your normals are setup per face, rather than per vertex.

If using normal per face (i.e. a single normal for the triangle), increasing the number of triangles will produce a less faceted look as there is more granularity when interpolating the normals over the surface of a given surface area given the increase in the number of triangles within that area. It is recommended to use normals per vertex for smooth surfaces when feature edges are not important (i.e. Not for cubes!).

If using normal per vertex (i.e. a normal for each vertex, resulting in each triangle having 3 vertices), each 3 vertices of a face will be slightly different if the neighbouring triangles are not coplanar to the triangle in question (i.e. not a flat surface). This will aid in the smoothness of the shading.

Normals per vertex can be easily calculated by averaging the three normals of the three vertices defining a triangle, however your surface needs to be defined with shared vertices for this. The exception to this is if you have a sphere or ellipsoid, in which case you can calculate a more precise normal easily by unitising vertex - sphereOrigin rather than averaging the three normals of the face.

On a side note: Are you using two lights in the scene of the screen shot you posted or one? If two it looks like the normals are currently not correct as the shading does not appear correct since there is a well-lit area of the surface on the bottom left region. With a single light, either the front (top right) of the sphere would be lit, or the bottom left, but not both.

Also note that simply increasing the power of the light simply over exposes the surface colour rather than improving the smoothing. You lose the surface definition.

$\endgroup$
-1
$\begingroup$

glShadeModel(GL_SMOOTH); - probably in PezInitialize - should do what you need.

$\endgroup$
1
  • $\begingroup$ I'm fairly certain that is the default mode, so will not change anything in my picture. Also, I'm more interested in, for instance, what something like that does (which is just interpolate colors between vertices), rather than just a formula to fix the problem. $\endgroup$ – jheindel Mar 28 '20 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.