Difference between revisions of "Homework1W13"

From Immersive Visualization Lab Wiki
Jump to: navigation, search
(Kitchen with Pots (100 Points))
(Kitchen with Pots (100 Points))
Line 30: Line 30:
  
 
* Run your program to show the kitchen. You will get points for:
 
* Run your program to show the kitchen. You will get points for:
** Properly built Coin3D ('''10 points''').
+
** Properly built OSG ('''20 points''') with OpenVRML ('''10 points''').
** Properly built OSG ('''10 points''') with Coin3D ('''10 points''').
+
 
** Have a basic application which opens an OSG rendering window ('''10 points''').
 
** Have a basic application which opens an OSG rendering window ('''10 points''').
 
** Loaded the kitchen ('''5 points''') and scaled and rotated it so the user can see it ('''5 points''').
 
** Loaded the kitchen ('''5 points''') and scaled and rotated it so the user can see it ('''5 points''').

Revision as of 14:58, 16 January 2013

Homework Assignment 1: OpenSceneGraph

For this assignment you can obtain 100 points, plus 10 for extra credit.

Kitchen with Pots (100 Points)

Install OpenSceneGraph with VRML support, using these instructions.

OSG is a graphics library which sits on top of OpenGL and will be the graphics programming interface in this course.

Next you will need to make yourself familiar with OSG. A good way to do this is by working through some of the tutorials. You should at the very least work through Tutorials 1 and 2 from section "Yet Another Set of Beginner Tutorials" on this web page. While doing these tutorials, it may be helpful to study other OSG documentation, for instance the Reference Guide.

Armed with this knowledge, you will need to load a 3D model of a kitchen (provided in VRML and OBJ formats) with of OSG's 3D model loading routine. The command to load a model file into an OSG node is:

osgDB::readNodeFile()

To load the VRML kitchen you would call osgDB::readNodeFile("Kitchen__Doors_Open_.wrl").

In one of the tutorials is more detailed documentation on how to load 3D files.

Note that the a couple of the kitchen's cabinets are open and do not have doors. We will worry about that in a later homework assignment.

Next you will need to load a pot and a pan into the same application. They are also included in the above referenced ZIP files as Pot and Pan. Place them on the kitchen counter when you initially load them in.

Finally, you will need to make pot and pan selectable separately by using the number keys '1' and '2', and make the selected item movable by means of the cursor keys (to move it up/down, left/right) and the 's' and 'z' keys to move it into/out of the screen.

The selected pot needs to be rapidly blink. You can accomplish this by alternating between making it visible and invisible, with every frame you render. Use the Node::setNodeMask() command with parameters of 0 or ~0 to hide and show it.

In class, you will have to demonstrate the following things:

  • Run your program to show the kitchen. You will get points for:
    • Properly built OSG (20 points) with OpenVRML (10 points).
    • Have a basic application which opens an OSG rendering window (10 points).
    • Loaded the kitchen (5 points) and scaled and rotated it so the user can see it (5 points).
  • Load pot and pan and show them sitting somewhere on the counter top without intersecting parts of the kitchen or the other item (20 points).
  • Select pot or pan with its number key, it should blink now (10 points).
  • Use the cursor and s/z keys to move it into the upper cabinet (10 points).
  • Select the other pot/pan (5 points).
  • Move it into the fridge (5 points).

Extra Credit (10 Points)

Add code to rotate the selected pot in all three dimensions (5 points), and to uniformly scale it (5 points). You should do this by adding four osg::MatrixTransform nodes before each pot node: one for each rotational dimension, and one for setting the scale. Use the keys 'q', 'w', 'e', and 'r' for each of the four functions, respectively, and their upper case versions for negative rotation/scale. Example: 'q' rotates clockwise about the x axis, 'Q' rotates counter-clockwise about it.