# Polygonal Modelling

## Summary


Polygonal modelling is a 3D modelling approach that utilizes edges, vertices and faces to form models. Modellers start with simple shapes and add details to build on them. They alter the shapes by adjusting the coordinates of one or more vertices. A polygonal model is called faceted as polygonal faces determine its shape.  

Polygonal or polyhedral modelling fits best where visualization matters more than precision. It's extensively used by video game designers and animation studios. Assets in video games form whole worlds for gamers. Features of these assets are built using polygonal modelling. 

Computers take less time to render polygonal models. So, polygonal modelling software run well on browsers. For higher precision, advanced 3D models such as NURBS are suitable. However, NURBs can't be 3D printed unless they are converted to polygons. Many industrial applications easily handle polygonal model representations.

## Discussion

### Can you describe the basic elements of polygonal modelling?

A **vertex** is the smallest component of a 3D model. Two or more edges of a polygon meet at a vertex. 

**Edges** define the shape of the polygons and the 3D model. They are straight lines connecting the vertices. 

Triangles and quadrilaterals are the polygons generally used. Some applications offer the use of polygons with any number of edges (N-gons) to work with. 

Faces of polygons combine to form polygonal **meshes**. One can **deform** meshes. That is, one may move, twist or turn meshes to create 3D objects using deformation tools in the software. The number of polygons in a mesh makes its **polycount**. 

**UV coordinates** are the horizontal (U) and vertical (V) axes of the 2D space. 3D meshes are converted into 2D information to wrap textures around them. 

Polygon density in the meshes is its **resolution**. Higher resolution indicates better detailing. Good 3D models contain high-resolution meshes where fine-detailing matters and low-resolution meshes where detailing isn't important. 


### How are polygonal meshes generated?

Polygonal meshes are generated by converting a set of spatial points into vertices, faces and edges. These components meet at shared boundaries to form physical models. 

Polygonal mesh generation (aka meshing) is of two types: **Manual** and **Automatic**. In manual meshing, the positions of vertices are edited one by one. In automatic meshing, values are fed into the software. The software automatically constructs meshes based on the specified values. The automatic method enables the rapid creation of 3D objects in games, movies and VR. 

Meshing is performed at two levels. At the model's surface level, it's called **Surface meshing**. Surface meshes won't have free edges or a common edge shared by more than two polygons. 

Meshing in its volume dimension is called **Solid meshing**. The solid surfaces in solid meshing are either polyhedral or trimmed.  

There are many ways to produce polygonal meshes. Forming primitives from standard shapes is one way. Meshes can also be drawn by interpolating edges or points of other objects. Converting existing solid models and stretching custom-made meshes into fresh meshes are two other options. 


### What are free edges, manifold edges and non-manifold edges?

A **free edge** in a mesh is an edge that doesn't fully merge with the edge of its neighbouring element. The nodes of meshes with free edges won't be accurately connected. Such edges within the geometry will affect the overall output. Therefore, unwanted free meshes should be removed. 

A **manifold edge** is an edge shared utmost by two faces. It means, when there is a third face sharing the edge, it becomes a **non-manifold** edge. 

A non-manifold edge cannot be replicated in the real world. Hence it should be removed while modelling. In the event of 3D printing, non-manifold edges will produce failed models. 


### How would you classify the polygonal meshing process based on grid structure?

A grid structure works on the principle of Finite Element Analysis (FEA). An FEA node can be thought of as the vertex of a polygon in polygonal modelling. An FEA element shall represent an edge, a shape and a solid in three different dimensions. 

Dividing the expanse of a polygonal model into small elements before computing forms a grid. Grid structure-wise, meshing is of two types: 

    + **Structured meshing** displays a definite pattern in the arrangement of nodes or elements. The size of each element in it is nearly the same. It enables easy access to the coordinates of these elements. It's applicable to uniform grids made of rectangles, ellipses and spheres that make regular grids.
    + **Unstructured meshing** is arbitrary and forms irregular geometric shapes. The connectivity between elements is not uniform. So, unstructured meshes do not follow a definite pattern. It requires that the connectivity between elements is well-defined and properly stored. The axes of these elements are unaligned (non-orthogonal).

### How are mesh generation algorithms written for polygonal modelling?

Mesh generation algorithms are written according to the principles of the chosen mesh generation method. There are many methods to generating meshes. It depends on the mesh type. 

A mesh generation method serves the purposes of generating nodes (geometry) and connecting nodes (topology). 

Let's take the Delaunay triangulation method for instance. According to it, the surface domain elements are discretized into non-overlapping triangles. The nodes are so created that the angles between them when triangulated are the least. The circumcircle drawn about each triangle cannot accommodate an additional triangle within it. 

Delaunay triangulation is applied through several algorithms. Boyer-Watson algorithm is one of them. It's an incremental algorithm that adds one node at a time in a given triangulation. If the new point falls within the circumcircle of a triangle, the triangle is removed. Using the new point a fresh triangle is formed. 


### How does one fix the polygon count for models?

Polygon count or polycount gives a measure of visual quality. Detailing needs a high number of polygons. It gives a photorealistic effect.  But high polycount impacts efficiency. It may take more time to load and render. When a model takes more time to download, we may run out of patience. Real-time rendering delays cause a video or animation to stop and start. So, a good polygonal model is a combination of high visual quality and low polycount. 

The threshold number to call a polygon count high is subjective. For mobile devices, anywhere between 300 to 1500 polygons is good. Desktops can comfortably accommodate 1500 to 4000 polygons without affecting performance. 

These polycount numbers vary depending on the CPU configuration and other hardware capabilities. Advanced rendering capabilities smoothly handle anywhere between 10k to 40k polygons. Global mobile markets are vying to produce CPUs that can render 100k to 1 million polygons for an immersive 3D experience. 

Higher polycount increases the file sizes of 3D assets. Websites will have upload limits. So it's also important to keep file sizes in mind while fixing the polygon count. 


### What are some beginner pitfalls to polygonal modelling?

**Irregular meshes**: As beginners, we may miss triangles and create self-intersecting surfaces. Or we may leave holes on mesh surfaces or fill in with backward triangles. Irregular meshes will affect the model's overall appearance. Eyeball checks and use of mesh generation software will help us avoid mesh-related errors. 

**Incorrect measurements**: It may distort the model's proportionality and ruin the output. It's best to train our eyes to compare images and estimate the difference in depths. Comparing our model with the reference piece on the image viewer tool will tell us the difference. 

**Too many subdivisions early in the modelling**: It will disable us from making changes without tampering with the measurements. So, we may end up creating uneven surfaces. Instead, it's better to start with fewer polygons and add to them as we build the model. 

**Topology error**: We may get the edge structure and mesh distributions wrong. We need to equip ourselves by learning how to use mesh tools. It's important to learn where to use triangles, quads and higher polygons. Duplicates are to be watched out for. Understanding the flow of edges is vital. 

## Milestones

1952

Geoffrey Colin Shepherd furthers Thomas Bradwardine's 14th-century work on non-convex polygons. He extends polygon formation to the imaginary plane. It paves the way for the construction of complex polygons. In polygonal modelling, complex polygons have circuitous boundaries. A polygon with a hole inside is one example. 

1972

Bruce G Baumgart introduces a paper on **winged edge data structure** at Stanford University. Winged data structure is a way of representing polyhedrons on a computer. The paper states its exclusive use in AI for computer graphics and world modelling. 

1972

Newell introduces the **painter's algorithm**. It's a painting algorithm that paints a polygon. It considers the distance of the plane from the viewer while painting. The algorithm paints the farthest polygon from the viewer first and proceeds to the nearest. 

1972

Edwin Catmull and Fredrick Parke create the **world's first 3D rendered movie**. In the movie, the animation of Edwin's left hand has precisely drawn and measured polygons. 

1992

Fowlery et al. present *Modelling Seashells* at ACM SIGGRAPH, Chicago. They use polygonal meshes among others to create comprehensive computer imagery of seashells. 

1998

Andreas Raab suggests the **classification of edges** of a polygonal mesh. They shall be grouped as sharp, smooth, contour and triangulation edges. It solves the problem of choosing the right lines to draw. 

1999

Deussen et al. successfully apply Adreas Raab's algorithm that constructs a skeleton from a 3D polygonal model. They use it in connection with the intersecting planes.