This article explains how three-dimensional models are created, used and stored by today's computers.
In 3D (three-dimensional) world, ordinary things have 3 dimensions: width, height and depth. Compare this to two-dimensional objects (like a picture), which only have width and height.
If there is a point of origin, a length unit, and 3 independent directions (think: south -> north, west -> east, down -> up), object position can be described by 3 numbers. These numbers are called coordinates.
Example: Stand in the center of the Stonehenge. To find a buried treasure, go 200 meters to the north, then 80 meters to the west, and finally dig a 2 meters deep hole. Stonehenge is the origin of our coordinate system and the coordinates of the treasure are (200, -80, -2).
Although we live in a 3D world, our eyes only provide us with 2D information. We cannot see inside things. We cannot see the volume of things. We can only see the surface of objects around us.
The brain has an amazing property. It takes these limited 2D images of our surroundings provided by the eyes and gives us the feeling that we know where we are in the 3D world and what are the 3D shapes of the objects around us. This is a very complex process, but it has its limitations.
Example: You got a present. Wrapped in a box. You are unable to learn what kind of present is in the box by just looking at it. You only see a box. It may as well be empty. Eyes are lousy box-openers.
There are two basic approaches how to represent 3D models:
Volume representation | Surface representation | ||||
Cutting a cube in half yield different results depending on the 3D representation method.
Volume representation is the intuitive way to describe a 3D world.
Look at the image above. A cube was cut in half and we can see its interior. The interior is red, which is surprising. Before the cube was cut, we only saw the orange surface. But the information about the interior must have been stored somewhere in the computer.
Volume-based 3D models are created by combining various basic 3D shapes like cubes, spheres, cones, etc. Combining in this context means making unions, differences, or subtracting one volume from another.
Now look at the right cube. You can see that it was actually hollow. A computer using surface representation does not even know it is a cube. For the computer, it is just 6 squares arranged in a special way. Processing in the human brain took care of the rest.
Surface 3D models are created by adding elementary (triangles) or more complex surface to a 3D scene. The illusion of volume exists only in human brain. The computer assumes nothing about the interior of objects. It does not care about it, because it does not need it.
It depends. Volume representation is closer to the real world, but surface representation is closer to what humans perceive with their eyes. Also, volume representation must be converted to surface representation before it can be shown on computer screen. The screen is after all a 2D device, equivalent to the human eyes.
The 3D subsystem in RealWorld Designer-based editors use surface representation and I will focus on surface representation in the rest of this introduction to 3D graphics.
Imagine the cube again. If you are outside the cube, you can never see any of the interior surfaces. What would a cube without interior surfaces look like if it were cut? Let's see:
Two-sided surfaces | One-sided surfaces | ||||
The one-sided version looks awkward. Your brain cannot does not recognize the pieces to be parts of a cut cube. Yet, if the cube was not cut, the image would be exactly the same in both cases.
For computers (which only do what they are told) and software authors (which are lazy), it makes sense to only draw what can be seen. If the computer knows, the user will never be able to view the interior of a cube, it makes sense to only draw the surfaces visible from one side.
Thing to remember: don't panic when a surface is only visible from one side. Surfaces in RealWorld editors are by default only visible from one side, but some of them can be switched to double-sided mode.
By now, you probably deduced, that you can build a 3D model by placing surfaces into 3D space. If they are placed and colored accordingly, an illusion of a 3D model appears.
The simplest surfaces are triangles, but building something non-trivial directly from triangles takes a lot of time, especially with the limited control a computer mouse and keyboard gives you.
To circumvent these limitations, 3d editors allow putting more complex objects into the scene at once. These may be either simple geometrical shapes like boxes or spheres, parametric surfaces like NURBS, or components made by the user. In most cases, it is possible to modify properties of these objects - for example, it is possible to set the radius of a sphere.
Note: when talking about a sphere, I actually mean a set of small triangles (visible from one side only) arranged in a way that they appear as a sphere to the observer.
In the very beginning of this article, I have talked about position in 3D space and coordinates.
Instead of the north->south, east->west, down->up directions, computers usually use directions called X, Y, and Z.
X direction means from left to right on the screen.
Y direction means from bottom to the top (in 2D cases, from top to bottom).
Z direction means from the plane of the screen toward the user.
When positioning a larger part of a 3D model, it would not be practical to move all the surfaces it is composed of at once.
Material on 3D surfaces controls how light reflects from the surface and if a surface is emitting light of its own.
Starting with 3D graphics is not easy. There are multiple steps that must be overcome until