Creating 3D Models
***** Not Yet Complete *****
As discussed earlier, 3D objects are built from vertices of triangles. Each point in a triangle is a vertex and 3 vertices make up one triangle. These vertices are what the graphics engine uses to display graphics on the screen. The process of displaying an object on the screen is called rendering. The triangle is a closed figure and hence is a polygon.
A 3D object that has been built with many triangles joined together is called a mesh. Once you have the basic mesh for the object, you then create a skin or texture and wrap it around the mesh. When you are talking about the number of polygons in a 3D object, you are really talking about how many triangles it contains.
An example of a 3D object is shown below. It is a tiger taken from the DirectX SDK sample files. You can view it using a program called meshview (part of the DirectX SDK and should be on your Start menu). It looks realistic enough.
Now have a look at the tiger when you take the "skin" off it. You should be able to see the triangles! This is called wireframe view.
The tiger above, which is a 3D object, was created using 3D modelling software such as 3D Studio Max or Blender. Within this software package, you can apply textures (or skins) as well.
A 3D object is also called a 3D model. You can either buy or download royalty free 3D models.
Note: learning to use a 3D modelling package is a
large learning curve in itself! I found it easier to do a short
course in a 3D modelling package (I did 3D Studio Max and Zbrush), but
there are also excellent tutorials on the Internet.
3D Modelling Software
This software is used to create 3D objects from boxes, cars to even rooms and buildings. In fact, whole worlds can be created using 3D modelling software. This is how many 3D games are built. It is easy to build static (non moving) worlds as they do not change. Moving objects such as 3D human characters are harder to create as they are required to be animated in 3D.
Here is a list of some popular 3D modelling software. Some packages are free, you can get a trial demo version of the package or you can buy the software.
- Blender (Free 3D modeller - runs on Linux too)
- 3D Studio Max (3D modeller by Autodesk)
- Maya (3D modeller by Autodesk)
- Gmax (Free 3D modeller - not supported by Autodesk anymore - "cut down" version of 3D studio max)
- Milkshape (3D modeller)
- Lightwave (3D modeller)
- ZBrush - fantastic for modelling characters
- Google Sketchpad - an easy to learn 3D modeller
- Anim8tor software
File formats of 3D modelling Software
When we create 3D objects or models, they need to be saved in a
format that DirectX can use. This file format is the .x
Essentially this file is a text file which you can read with a text editor such as notepad though it can also be saved in binary format. When using the 3D modelling software, you need to save them using DirectX .x file format.
Not all 3D modelling software can save in this format, so you may need to download a file converter for it. For example, 3D Studio Max has a .x converter called Panda exporter.
Creating Simple 3D Objects using Blender
If you run Blender, it will display this window (see the
The pink box is a 3D cube. Blender starts off with thinking that you wish to have a cube. If you left-click on the centre of the cube, you will be able to move it with your mouse.
Looking at the toolbar below:
- the red triangle is translate (move cube left or right, up or down)
- the green circle is rotate (can rotate cube around x, y, or z axis)
- the blue square is scale (makes cube bigger or smaller)
To see the cube, you can render it. On the menu close to the top of the screen, click on Render -> Render Current Frame. You will then see a picture of a cube (see below).
To export the cube as a file, on the menu, click on File -> Export -> DirectX. Click on the Export All button and save it as cube.x
Note: Blender has its own file format (.blend)
You can view the cube using the DirectX Viewer under Start -> All Programs -> Microsoft DirectX SDK -> DirectX Utilities. Use the mouse to click on it and rotate it around.
If you open cube.x with Notepad (or other text editor), you will see the following code:
As you can see, the 3D model (the cube) is represented as some numbers which can be seen in the file. This represents the cube mathematically. The cube is defined as a mesh containing 24 vertices (or points) and 6 faces according to the cube.x file. The cube also contains materials (colours of the cube faces) and textures (you can attach bitmaps or jpegs to each face of the cube). Each cube face also contains normals (you can think of this as an arrow pointing out of the cube face means you can see the cube face).
Adding Textures to the Cube
A texture is a "skin" that is attached to a surface of a 3D mesh. A
texture is actually an image file such as a jpeg or bmp file.
To add a texture to the cube, click on the
Creating other objects in Blender
Try creating other meshes in Blender. On the menu, select Add -> Mesh. I have added some objects (see below).