Heteroclinic.net logo

www.heteroclinic.net

In Depth 3D Computer Graphics
Chapter 1 Mesh File I

201512

In this project, we have a in depth study of 3D computer graphics. The first thing we will look at will be a typical mesh file and give our explanation how it represents a real life 3D object.

Let's look at a GTS model * for a simple cube.

This file is saved as cube.gts in the harddisk. It looks basically the same as the above if you run a cat or type command.

* http://gts.sourceforge.net/

In Depth 3D Computer Graphics
Chapter 1 Mesh File II

201512

We render the mesh as the following figure.

CubeDemo.png

The figure is drawn in a orthorgonal projecting mode. In this figure, we paint the x-axis as red, y-axis as green and z-axis as blue. We are looking at (0,0,0) from (5,8,10). We also mark the eight vertices that are in the mesh file. The visible edges are drawn as solid lines. The lines that are supposed to be invisible as aligned with such view vector are drawn in dash lines. This model has a particular point of view making it difficult to sketch it with pencil only.

In Depth 3D Computer Graphics
Chapter 1 Mesh File III

201512

The first line of this model states, for this model there are eight vertices, eighteen edges and twelve triangles. From line two to line nine, each line has the three-dimensional coordinate (x,y,z) of a vertex. The first vertex was assigned a index 1 and so on so forth, though computer programming usually start the first as an index 0. From line ten to line twenty-seven, each line of model file has the connection information of two vertices. For example "3 1" states vertex 3 is connected to vertex 1, namely there is an edge for some triangle(s). Starting from 1, each edge is also given an index incremented by 1 from the previous line.
From line twenty-eight to line thirty-nine, each line of model file indicates a triangle. Each triangle has three edges. For example "9 13 1" states edge with index nine, thirteen and one form the triangle with index one. At earlier times, I had drawn this model by hand many times, to find out what it is, to find out how the triangle is oriented counter-clock-wise or the vice. We know the vertices show the geometry, the edges show the topology of the model. The triangles will talk about the completeness of the mesh. Three edges connected three vertices, but the area bounded may be a hole. Normally, I just drew the orthogonal draft like traditional geometry or mechanics, machine design text book, an axonometric(al) drawing. The above model is the mathematical record of a cube as we have shown in previous section. This is why it is still important to practice engineering drafting. It is almost impossible to see through the text or even the mathematical representation of an object. But language still can go of high abstraction, I simply tell you, it is a cube.

In Depth 3D Computer Graphics
Chapter 1 Mesh File IV

201512

I would like to share how the mesh is rendered. The following program is written in Java, it will depend on JOGL libraries -- Java Binding for the OpenGL API *. In the section following, I will attach a Maven pom file to help resolving the dependencies. When I got a chance, I will clean up my local git and commit the project to github.


* https://jogamp.org/