Stage 1

Load geometry from Wavefront .obj file and display wireframe model in orthogonal projection



1. Create your basic application

Implement an executable application that has the following properties:

  • Contains a 600x400 pixel rendering viewport (canvas). The rest of the application window can have arbitrary size.
  • Viewport background is white.
  • An external .obj file can be opened in the application and the application loads geometry from it (see below)


2. Set up rendering

The 3D scene will be rendered in your viewport with the following properties:

  • 3D scene is centered to the viewport, i.e. 3D point [0,0,0] will be displayed on position [300,200] in the viewport
  • The 3D scene is zoomed to the viewport by a factor of 100, i.e. values from interval <-3,3> x <-2,2> in the geometry space are scaled to values <0,600> x <0,400> in screen space. The y-axis is oriented upwards.
  • The projection used is orthogonal and the camera lies in the z axis, i.e. no special projection matrix is necessary. Just ignore the z-value of the transformed points


3. Load obj file

The  Wavefront .Obj  file format is a simple text file format for representing 3D models. We will be only using vertex and face geometry stored in it: line starting with  or  . Here's how an obj file looks on the inside:

    # OBJ file defining a single quadrilateral face:
v 0 0 -0.5
v 1 0 -0.5
v 1 1 0.5
v 0 1 0.5
f 2 3 4 1

And here's a complete sample file for you:  square.obj . You can even make your own obj files, e.g. in Blender.

Other samles:

Your application will:

  • Load the geometry from the obj file (you can ignore lines that don't start with  or  )
  • Display the loaded data as a wireframe: For every face in the model connect by lines all the face vertices in the order as defined in the file.
  • Render the lines in black. You can use line drawing function provided by the programming language or canvas or graphics API you use.


4. Upload your application

Pack your application (source codes + executable file) in a ZIP and upload it.







Powered by nAIS  |  Public beta test  |  Please, report errors to: Matej Novotný  |  nAIS version 0.9.42 - 2013/01/10 17:27:58