Keywords: vertex normals

Summary

This demo shows how vertex normals can be used to help create the illusion of continuous curvature on surfaces that are created from polygon meshes.

The following demos, manuals and tutorials can provide additional information about the topics at the focus of this demo:

  • Related Demos

    • The VertexNormals2 features a similar demonstration but with a more realistic object (an automobile).

  • Related Manuals

    • N/A

  • Related Tutorials

    • N/A

Details

Vertex normal interpolation is a well established "trick" to approximate curvature on surfaces that are quantized by flat polygons. Rather than use a single vector that is always normal to the actual surface, vertex normal interpolation computes a normal that varies across the surface from normals that are stored at the vertexes. The normals at each vertex are usually the average of all polygons that share that vertex. Therefore, as you get closer to a vertex, the normals on all surfaces sharing the vertex converge to the same vector. This makes the normal vectors continuous across polygon seams and provides the illustion of curvature.

Important
It is important to note that vertex normal interpolation does not relocate the surface to make is geometrically smooth. It simply manipulates the surface normal vector to make it appear to be geometrically smooth.

In this demo, the scene contains a set of sphere objects. The first is a very low resolution polygon model of a sphere (a sub-sampled icosahedron) that uses 80 polygons (facets) to approximate the spherical surface. The second is significantly sub-sampled icosahedron that uses 1280 polygon to approximate the spherical surface. The third is a build-in sphere object that has infinite curvature since it is a mathematical model. The low and high resolution models appear in the scene with and without vertex normal interpolation so that the effects can be visualized.

Note
Only the Alias/Wavefront OBJ file format can be used to supply DIRSIG a geometry model with vertex normals. The native GDB file format does not have support for vertex normals.

Important Files

The key files in this demo are the OBJ files for the polygon sphere models. There are a pair of OBJ files for the low and high resolution sphere models. Each OBJ file pair has a with and without vertex normal version.

geometry/sphere_low.obj

Low resolution sphere (80 polygons) without vertex normals.

geometry/sphere_low_vn.obj

Low resolution sphere (80 polygons) with vertex normals.

geometry/sphere_high.obj

High resolution sphere (1280 polygons) without vertex normals.

geometry/sphere_high_vn.obj

High resolution sphere (1280 polygons) with vertex normals.

The vertex normals appear in an Alias/Wavefront OBJ file as entities starting with the keyword vn.

Adding vertex normals

If you have an OBJ geometry file that does not have vertex normals, they can be added using the DIRSIG object_tool. For this demo, the OBJ files with the vertex normals were created from the ones without them using the following command-line syntax:

$ object_tool --input_filename=sphere_low.obj --addvertexnormals --output_filename=sphere_low_vn.obj

Setup

To run the simulation, perform the following steps:

  1. Run the DIRSIG demo.sim file

  2. Load the resulting demo.img file in the image viewer.

Results

The following images demonstrate the effect of using vertex normals to interpolate the normal across the surface of a polygon. The image below shows the scene containing five spheres.

  • The middle sphere is the built-in, infinite curvature sphere.

  • The left side has the low-resolution sphere without vertex normals (top) and with vertex normals (bottom)

  • The right side has the high-resolution sphere without vertex normals (top) and with vertex normals (bottom)

vn demo radiance
Figure 1. The radiance image shows how the vertex normals make the polygon spheres appear smooth (gamma = 2 scale).

Note that the outline of the smoothed low-resolution sphere (bottom-left) still reflects the course shape and outline of the unsmoothed version (top-left). The Z intersection truth below reveals that the location of the surface in both the unsmoothed and smoothed versions is the same. This reinforces that vertex normal interpolation does not relocate the surface to make it smooth, it simply manipulates the normal to make it appear smooth.

vn demo z truth
Figure 2. The Z intersection truth shows that the smoothed polgyon spheres are still quantized into flat polygons.

The surface angle truth below shows that the smoothed polgyon spheres appear smooth because the normal was manipulated to vary even though the underlying geometry is constant (flat).

vn demo angle truth
Figure 3. The relative view angle truth shows how the interpolated normal varies across flat surfaces.