An introduction to 3D

CC-BY: At Mind - B3d101
Resource: Game Development with Blender by Dalai Felinto and Mike Pan

If you are new to 3D it might be handy to learn some basics of computer graphics. Below is a brief introduction.

Coordinate system

In real life we live in a 3-dimensional world, width, height and depth. To represent these dimensions inside a computer we use the Cartesian coordinate system, where the 3 dimensions are respresented by X, Y and Z, laid out as intersecting planes. Where the 3 axis meet is called the origin. A single point in this space is represented by it’s distance from the origin; point (2, 4, 8) is a point that is 2 units away from origin along the x-axis, 4 units away from the origin along the y-axis and 8 units away from the origin along the z-axis. So when using 3D you’ll have to think and work using these 3 dimensions.

../../_images/axis.png

Points, edges, triangles and meshes

We can define a single point or vertex (vertex is commonly used in computer graphics) using the Cartesian coordinate system XYZ. A point is not very useful, as you probably won’t be able to see it. It’s very small. But when joining vertices you can form a line or edge. By joining lines you can create a triangle or face. By joining multiple faces you create a shape or model, also called a mesh.

Why is a triangle so important? That’s because computers especially computer graphics use the triangle as the basic shape. A rectangle is simply two triangles arranged side by side. A ball or sphere is made of tiny triangles or facelets arranged into a bal shape.

Modelling

Modelling is the process of creating and rearranging vertices, edges and faces, thus creating a mesh. It’s worth noting that models in general have no volume, so they are hollow from inside.

Animation

Animation in this context is the process of creating the illusion of motion and change by rapidly displaying a sequence of static images that minimally differ from each other. It’s like a flip book (on YouTube you can find examples of flip book animations, search for “Flip Book animation”). Basically it’s making things change over time like moving an object, deforming it, changing its color. To setup an animation you create keyframes. Keyframes are snapshots that store specific values pertaining to the animation. A tool like Blender automatically interpolates in between those values to create a smooth transition.

Camera

When you start an animation or a game, you watch or play the animation or game through a predetermined camera. The camera is not fixed but moves along the scene or in case of a game can react to a player’s input.

Game

A game basically takes the existing 3D assets and attaches logic to them so that these 3D objects know how to respond to events. The logic can be in the form of logic bricks (which can perform different actions depending on the user input), scripts (which can extend the functionality of logic bricks) or with physical properties of an object (for example rigid body settings that makes an object tumble and fall realistically). A game engine consists of many distinct components, below are some main components:

  • A rendering engine: renders the 3D scene that you have created including models, lights and cameras into an image to be displayed.

  • Physics: for calculating collisions and physical simulations of objects.

  • Logic or scripting: makes decisions based upon user input, keep track of what is going on in the game.

  • Sound: for sound events.

Basic transform

In computer graphics there are 3 basic transform:

  • Translations. Moving an object from one position to another, in any direction (x, y, z).

  • Scaling. Resizing an object.

  • Rotation. Rotating an object around one or more axis (x, y, z).

Normals

A surface normal, or normal, to a surface at a certain point, is the vector that is perpendicular to the tangent plane to that surface at that certain point. Normals are often used for shading computations of a surface. Ideally all the normals for a mesh should be pointing outwards. Wrongly oriented normals can cause the mesh to show up as black or invisible.

Materials & Textures

To modify the color and appearance of a shape, you’ll need to apply materials to the shape. With materials you can control the color, shininess, bumpiness and transparency of the object. Sometimes changing the color or shininess is not enough, you want to add more detail to the object to make it even more realistic. That’s where texturing comes in. Texturing is a technique to add color and detail to a mesh by wrapping the mesh with an image, like a decal. The projection of a 2D image, a texure map, onto a 3D mesh is called texture mapping. Texture mapping can be performed automatically using one of the predefined projections, or manually which uses a UV layout to map the 2D image onto the 3D mesh.

A texture not only changes the color of a surface but can alter other properties as well like transparency, reflectivity and bumpiness to create the illusion of a much more detailed surface. Besides texture map there is also diffuse map, normal map and specular map. With a diffuse map you can control the color of a surface. With a normal map you can control the normal of an object or surface, creating a bumpy effect by changing the way the light is reflected off the object. With a specular map you can control the specular reflection of an object making it look shiny at some places and dull in others.

Lights

With light we can see things otherwise it would be very dark. With light comes shadow as well. In most 3D tools there are several different types of light; a spot, a sun lamp, a hemi lamp and an area lamp. With good lightning you can highlight certain details or areas of your scene while hiding irrelevant areas. By placing your light properly you can also add drama and realism to a scene, making a boring scene look visually exciting. In Blender a light source is seen as a regular object that you put and position in your scene.