3D Graphics and Virtual Reality

Practical exercise 2

Exercise

GLView is installed on the IT service Windows NT system. It is located on the start menu under Academic -> Computer Science -> GLView.

Firstly, you should familiarise yourself with GLView and its movement modes. Load up GLView and then load one of the example worlds that come with it, for example "beethove.3dv" or "triceratops.wrl" which should be available from the File Open menu. One thing to note is that any file with extension ".3dv" is NOT a VRML file, it is a GLView specific file format. However either is suitable for playing with the movement controls.

1.) Try selecting each type of control and manoeuvring around the object with it.

2.) Look in the "Render" menu at the top of GLView. Try selecting some of the different render options, such as Wireframe, Gouraud, etc. and observe the effect on the 3D world.

3.) Now, familiarise yourself with creating a VRML file using a text editor, such as Notepad, saving it and then loading it into GLView to see the effect. As an example, try typing in the VRML code listed below and see what it looks like in GLView. Then, try altering some of the parameters such as the size of the cone and it's appearance. You will have to consult the VRML Specification document or the lecture notes to find out the fields for a Cone node, and for the Material node as well. Also, remember to reload the world in GLView each time you make a change to the VRML file.

#VRML V2.0 utf8
Shape
{
geometry Cone
{
}

appearance Appearance
{
material Material
{
diffuseColor 1.0 0.0 0.0
}
}
}

4.) Experiment using different shapes and different appearances, until you are comfortable with the format and syntax of the VRML code, and also with the results of it.

5.) Try and recreate the simple "Flying Saucer", shown in figure 1 below, by using appropriate shapes, materials and shape sizes. The model in the picture uses just 3 shapes, and no transformations.

Figure 1. UFO using 3 primitive shapes.

6.) After the next lecture we should know how to use transformations to position and orient objects as we need. In the next practical we will be creating a simple VRML model or scene of your choosing. So, for this practical you should spend any spare time planning out what you want to create. You can make it as ambitious or as simple as you like (not too simple though! I would say a simple model of a car would be a minimum, i.e. a couple of boxes with wheels). Donít worry so much at this stage how you will create this scene or model, just think about what you want to create, and how the model would be structured.

As an example, look at some of the work submitted from last year, in the "cool worlds" gallery. Try and think how each of these is constructed without actually looking at the VRML source code. What sort of objects are used?, where are they positioned?, what material should I use?, what sizes are needed?, etc.

Two examples of what you could build are below. Example 1 is not as simple as it looks if you try and get the angles on the cube and the cone to match up to the picture below.

Example 1

At the very least, you could try and recreate the original VRML 1.0 logo which consisted very simply of a red box, green sphere and blue cone all lined up together. Figure 2 shows an example of this.

Figure 2. Simple example of a VRML world.

Example 2

As a more complex example, you could try creating a model of some real-world object. For example the simple desk fan model shown in figure 3. Again, if you want to try and animate this model you could get the fan blades to spin round, though this subject is not covered until the last lecture so you would have to read ahead.

Figure 3. An example model - a simple desk fan.
The blades spin round in this example.

Evaluation

There is no deliverable for this practical. However, there is a deliverable for next week's practical which will be the completion of your chosen model/scene. You will probably be spending time next week actually writing the VRML code for your world, so it's important that you spend some time this week planning it. Also, it's important that you re-create the UFO shown in figure 1, just so you have an understanding of some of the parameters which can effect how you build a model.


Peter Young,
University of Durham

peter.young@durham.ac.uk