Difference between revisions of "Homework1W13"

From Immersive Visualization Lab Wiki
Jump to: navigation, search
(New page: =Homework Assignment 1: OpenSceneGraph= [http://www.openscenegraph.org/projects/osg/wiki/Downloads Download], build and install OpenSceneGraph (OSG) under your Windows account. You will n...)
 
(Kitchen with Pots (100 Points))
 
(32 intermediate revisions by one user not shown)
Line 1: Line 1:
 
=Homework Assignment 1: OpenSceneGraph=
 
=Homework Assignment 1: OpenSceneGraph=
  
[http://www.openscenegraph.org/projects/osg/wiki/Downloads Download], build and install OpenSceneGraph (OSG) under your Windows account. You will need to have VRML support, which is why you will need  to install the the [https://bitbucket.org/Coin3D/coin/downloads Coin3D library] before OSG.
+
For this assignment you can obtain 100 points, plus up to 20 points for optional work. Note that an average of 100 points in this class will get you a grade of A.
 +
 
 +
==Kitchen with Pots ('''100 Points''')==
 +
 
 +
Install [http://www.openscenegraph.org/projects/osg/wiki/Downloads OpenSceneGraph] with VRML support, using [[OSGInstallKC | these instructions to install a binary version]].
  
 
OSG is a graphics library which sits on top of OpenGL and will be the graphics programming interface in this course.
 
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 [http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials 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 [http://www.openscenegraph.org/projects/osg/wiki/Support documentation], for instance the [http://www.openscenegraph.org/projects/osg/wiki/Support/ReferenceGuides Reference Guide].
+
Next you will need to make yourself familiar with OSG. A good way to do this is by working through some of the [http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials tutorials]. A good starting point is this [http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/BasicGeometry tutorial on basic OSG geometry]. It would be good if you worked at least 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 [http://www.openscenegraph.org/projects/osg/wiki/Support documentation], for instance the [http://www.openscenegraph.org/projects/osg/wiki/Support/ReferenceGuides Reference Guide].
  
Armed with this knowledge, you will need to load this [[kitchen.vrml | 3D model of a kitchen]] by means of OSG's VRML loader. The command to load a VRML file into an OSG node is:
+
Armed with this knowledge, you will need to load a 3D model of a kitchen (provided in [[Media:kitchen-vrml.zip | VRML]] and [[Media:kitchen-obj.zip | OBJ]] formats) with of OSG's 3D model loading routine. You can quickly preview OBJ and VRML files by running the osgviewer application in the bin directory of your OSG installation like this:
 +
 
 +
<pre>osgviewer <modelfile>.wrl</pre>
 +
 
 +
The OpenSceneGraph API command to load a model file into an OSG node is:
  
 
<pre>osgDB::readNodeFile()</pre>
 
<pre>osgDB::readNodeFile()</pre>
 +
 +
To load the VRML kitchen you would call osgDB::readNodeFile("Kitchen.wrl").
 +
 +
In one of the tutorials is [http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/FileLoadingAndTransforms 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.
 
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 [[pots.zip | two VRML pots]] into the same application. Place them on the kitchen counter when you initially load them in.  
+
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 each pot selectable separately by using the number keys '1' and '2', and make the selected pot 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.  
+
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 on the keyboard (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.
 
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:
+
In Sequoiah lab 142, you will have to demonstrate the following things on the due date, starting at 1pm:
 +
 
 +
* Properly installed OSG with VRML support ('''20 points'''). You get these points if you can load the kitchen model (as OBJ or VRML) with osgviewer.
 +
* A basic application which opens an OSG rendering window ('''10 points'''). You need to be able to build the code with Visual Studio.
 +
* Your application loads the kitchen ('''10 points''') and scales and rotates it so the user can see it ('''10 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''').
 +
 
 +
'''Note:''' You are not required to provide mouse support for any parts of this homework project! All interactions should be done using the specified keyboard keys.
 +
 
 +
==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.
 +
 
 +
==Extra Bonus Credit ('''10 Points''')==
  
* Run your program to show the kitchen.
+
If you wrestled through building OpenSceneGraph from scratch, without using binaries somebody else compiled for you, you will get '''5 points''' if you built OpenSceneGraph successfully, and an additional '''5 points''' if you also built the VRML plugin to load .wrl files - whether you did it with OpenVRML or Coin3D.
* Load the two pots and show them sitting somewhere on the counter top. This can happen at the same time as the kitchen is loaded.
+
* Select one pot with its number key, it should blink now.
+
* Use the cursor and s/z keys to move it into the upper cabinet.
+
* Select the other pot.
+
* Move it into the fridge.
+

Latest revision as of 15:05, 24 January 2013

Contents

Homework Assignment 1: OpenSceneGraph

For this assignment you can obtain 100 points, plus up to 20 points for optional work. Note that an average of 100 points in this class will get you a grade of A.

Kitchen with Pots (100 Points)

Install OpenSceneGraph with VRML support, using these instructions to install a binary version.

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. A good starting point is this tutorial on basic OSG geometry. It would be good if you worked at least 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. You can quickly preview OBJ and VRML files by running the osgviewer application in the bin directory of your OSG installation like this:

osgviewer <modelfile>.wrl

The OpenSceneGraph API command to load a model file into an OSG node is:

osgDB::readNodeFile()

To load the VRML kitchen you would call osgDB::readNodeFile("Kitchen.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 on the keyboard (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 Sequoiah lab 142, you will have to demonstrate the following things on the due date, starting at 1pm:

  • Properly installed OSG with VRML support (20 points). You get these points if you can load the kitchen model (as OBJ or VRML) with osgviewer.
  • A basic application which opens an OSG rendering window (10 points). You need to be able to build the code with Visual Studio.
  • Your application loads the kitchen (10 points) and scales and rotates it so the user can see it (10 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).

Note: You are not required to provide mouse support for any parts of this homework project! All interactions should be done using the specified keyboard keys.

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.

Extra Bonus Credit (10 Points)

If you wrestled through building OpenSceneGraph from scratch, without using binaries somebody else compiled for you, you will get 5 points if you built OpenSceneGraph successfully, and an additional 5 points if you also built the VRML plugin to load .wrl files - whether you did it with OpenVRML or Coin3D.