Elements of 3D computer graphics

Over the past decade, computer graphics have moved increasingly to the world of 3D. With the release of 3D graphics libraries like Unreal and Unity, more players are entering the game, figuratively and literally. But it takes a lot to change your perception from a 2D world to one of 3D. It is more than just adding a third axis named Z. We wouldn’t simply want to see flat 2D shapes floating around in our 3D world, would we?

Everything becomes 3D along with our world. All shapes gain volume instead of just area. Things can suddenly stack up from front to back and still be visible at a certain angle. Different camera angles are possible and even lighting can throw up different effects at different angles.

In this post, I am describing some basic geometric terminology used in 3D graphics to give you an idea of how to picture a 3D world in your mind or using craft models. To learn more about computer graphics, I suggest an excellent read: Computer Graphics, 2/E (1999) by Donald Hearn and Pauline Baker (Amazon.in | Amazon.com), which is considered the Bible of computer graphics. Written before the turn of the millenium, the facts and formulae written in this book stand true even today.

I start defining the elements used in 3D graphics from the most complex component to the simplest. In the order of what you can see on the screen to what those things are made of.

Object: An object is a complete entity, a three-dimensional shape with a texture, that you see in the 3D space in front of you. An object in the 3D space is usually a representation of a real object in the real world, such as furniture, trees, people, etc. Each object can usually be manipulated and moved around the scene without affecting any other object.

There are two types of objects: mutable objects and immutable objects. Mutable objects are complex objects which are made of other objects. E.g. if your scene were to have a car, the car object is assembled from other objects such as a chassis, doors and wheels. The wheels themselves are complex objects having a base and a tyre. However let’s look at another object: a ball. It is just a sphere with no other objects inside it. Immutable objects cannot be broken down into further objects. Breaking such an object gives us the planes that make up the object. We will see planes in the next point.

A texture being wrapped over a car’s wireframe.

A 3D object has two components. First, the object has a wireframe or a skeleton. The wireframe gives shape to the object. Next comes the surface or texture. In the world of 3D, a JPEG, TIFF or PNG image is wrapped around a wireframe to finish the look of an object. Think of it like the craft class in your school. To make a lantern, you first make the basic shape of the lantern in the form of its skeleton, using wood or plastic. Next comes the process where you wrapp papers of different colours around the skeleton to finish the look of the lantern.

Plane: To make 3D shapes, you need 2D shapes that are joined end to end. For instance, a cube is actually 6 squares joined at right angles with each other. A cylinder is one rolled rectangle to make the curved surface and two circles to make the flat ends. These individual 2D shapes that make up a 3D shape are called planes.

A 3-dimensional cube is made of 6 2-dimensional squares all intersecting at right angles to each other.

Planes can be used in their flat 2D form or can be rolled or bent to give depth or curvature to a shape. E.g. to make a cylinder, a rectangle is rolled into a curved surface.

Edge: To make a 3D shape, you need a collection of 2D shapes and stick them to each other. What about 2D shapes themselves? Simple. you take a collection of lines and join them to form the shapes. A series of lines is arranged such that they form the borders of a 2D shape such as a rectangle or a triangle. These lines that make up the borders of a shape are called edges. Edges can be straight or curved. A circle is a special shape where a single line is looped such that the ending point meets the starting point. So a circle has only one edge. Imagine making a circle out of a string or a shoe lace. You’ll get the picture.

Vertex: A vertex is a point where two edges meet to form a corner of a 2D shape. A circle which is made of only one edge has no vertices. But shapes which have multiple edges have vertices. A triangle has 3 vertices, which are formed by three lines intersecting each other. A cube which is made of 6 squares has eight vertices. Take any cubical shape in your house, such as a Rubik’s cube toy or a carton. You can count eight pointed corners. These are the vertices, with three edges meeting at each vertex.

One diagram that explains planes, edges and vertices

Point of view: Point of view, abbreviated as POV, is a big differentiator between a 2D and a 3D space. POV is also called a camera angle or a witness, because it shows what a human standing outside or inside the system or a camera placed around the system sees.

In a 2D system, the point of view is always as if you are standing in front of or above the object and looking at it from a single angle. With the addition of the third dimension, this assumption goes away. You can put yourself anywhere inside the 3D space and work out what the world would look like to you.

As an example, let’s imagine that you are standing on a floor that is patterned like a chess board. A floor is a 2D plane with just a length and width. Wherever you walk on the floor, you will see the a chequered pattern just below you. There is nothing else to see. There is nothing to your left or right, to the front or back, or above you.

Viewing a bed from the front, left and top

Now image yourself in a studio with a floor, walls and a ceiling. The floor is chequered, the walls have graffiti and the ceiling has stripes. If you stand on the floor in the centre of the room, you will be see the chequered floor right below you. The striped ceiling will be high up as you bend your neck to look above. The walls will be to your sides, all of them equidistant to you. Now imagine that you are looking towards the room from a bridge, which is attached to the top of one of the walls and is right below the ceiling. Now the chequered floor will appear at a depth far below you. The ceiling is right above you. One of the walls is right behind you. The other walls appear far away. As you can imagine, the two points of view are quite different from each other. You can also add movement and see how objects near you and those away from you seem to move. E.g. on a moving train, the trees and lamp posts whiz by in the opposite direction, whereas the moon and the mountains appear to move along with the train.

Conclusion

If you work on computer graphics or are considering a career or a project in that field, it takes a huge mental shift to move from seeing the world of computer graphics in 2D to seeing it in 3D. The experience can be disorienting at first. But because 3D represents our world more accurately, you will find it more natural and start wondering why the inadequate world of 2D ever existed.

[subscribe_form]

Leave a Reply

Your email address will not be published.