Video Game Programming
Lab 4 : Loading External 3D Models

Abstract:
Lets face it - we dont want to spend all our time manually inputting vertices. There comes a time when wed like to load our scenes produced by our hard working artists and start making our game look realistic instead of a bunch of blocks - and that time is now. So we need to understand how data is arranged in a Graphics file, so that we can load the data into our code -> and display it to screen. Now it wouldnt make much sense to write code that could read from every type of model (*.3ds, *.max, *.maya), etc. Fortunately, there are a number of tools that convert all these files into a format easily understood by DirectX - the *.X file. In order to convert these files into the *.X format we use an exporter, such as conv3DS.exe for 3D Studio Max models. Once youve got everything in this format, youll need to come up with a mesh class to read in these files -> the book has a pretty decent description how to use a mesh, but you need to come up with a class that encapsulates all the functionality, such as loading a mesh from file and rendering the mesh.

Topics Covered :
  • File I/O
  • Meshes
  • Loading models from an X file

Assignment:
Your assignment is to come up with a program that reads from an *.X file and displays a mesh onto screen. You are required to come up with a class of your own, that can read the mesh in and store it until it needs to be displayed. You are required to load in materials and the mesh from the file, but textures are not required.
Extra credit : Load textures from the mesh into your class

Prequisites:
  • Completion of Lab3
  • Knowledge of basic DirectX

Readings:
Chapter 10 : Real Time Rendering in DirectX

Grading:
Explanation:
  • Mesh class structure
  • Mesh loaded into class
  • Mesh rendered appropriately to screen
  • Textures (extra credit)
  Percentage:
  • 30%
  • 40%
  • 30%
  • 10%

Example:

Lab 4
Lab 4 with materials and textures (extra credit)

This lab is being distributed as a zip file. You must unzip all files to the same directory.


Requirements:
This lab requires DirectX 9.0a End-User Runtime

Questions:
Address questions regarding this lab to Prasan Samtani at psamtani@usc.edu