Part III: Distance Field



Return to the Project 2 Home Page


Distance Field:

Download the zip.

Specification:

Assign to each vertex a value of distance from the border. Implement this value as a change of the vertex's color and as a change of height.

Description:

To use the distance field changes, simply type 'H' when editing the graphic. This will change the colors of the mesh to reflect a change in color in relation to the border, and a change of height represented by a change on the z-axis.

Distance Field - 'H'

Detailed Explanation:

To calculate the distance field for each of the vertices, we first initialized all of the border vertices since we knew which ones they were automatically (from Phase I and II). From there we had to calculate the values of the previous and next for each of the vertex's corners to determine which layer it needed to be located.

http://www.desmith.com/MJdS/DT1.htm

As represented by the image above, the further inward you go, the change in color for each layer from the border. Also, this is an increase in the z value as well.

Examples:

The distance field for this object can be easliy seen. The outermost vertices are black, then the second to most outer vertices are blue, then yellow, and red for the center.

Conclusions:

As the vertices move away from the border, not only the color changes but also the height changes, although it is difficult to tell from the shown perspective above. The most difficult part of this section was determining how far into the mesh the vertex was, and this was based on finding at least two vertices that were in a triangle of the second layer that were border vertices. Then moving inwards, we did the same for the third layer, and again and again.

The colors of the vertices are dependent on this distance as well as the height in the z axis. This information will probably become very useful in the next and final phase of this project.