Christine Nguyen - cs184-aw


HW3: Animated Scene : The Elephant in the Room


For this project, my partner and I implemented a complete scene--an animated version of a simple apple store--using programmable shaders and a combination of objects that were both hand coded and loaded in from .obj and .raw files.

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

> > >

README Description of the scene details


Requirements
=============
- Scene must be complete
+ iPhones, iPads, iMacs
+ Genius Bar with Appointment screens on the back
+ Posters on the walls
+ Tables, chairs
+ Extras: purples spheres, elephants
- One object must be created by hand
+ We created the table, the walls, the floor, the genius bar, and the ipad by hand. The vertices are specified in the Table.cpp, Walls.cpp, etc. files, and then passed to the VertexNode, which calls the OpenGL rendering functions.
- One object must be loaded from a suitable geometric format
+ The elephant was loaded from an obj file. The parser is in obj_parser.h/cpp file, and is passed into the VertexNode.
+ The imac was loaded from an obj file. The imac was modeled in Blender by Christine and then exported as an .obj file.
+ The stool was loaded from an obj file. Credit for modeling the stool in Maya goes to Juan De Joya.
- One object must be created from a raw triangle file
+ The purple sphere is our raw object (loaded from raw_parser.h)
- You must do all placement and scaling by hand.
+ [Extra Credit] We created a scene graph to handle the relationships and matrix transforms between objects.
+ The Scene object has a rootnode which is a single instance of a SceneNode, which is the parent class of all nodes in the scene graph. It encapsulates the current transformation of the node, and automatically pushes its transformation onto the matrix stack before drawing itself and drawing its children. In this way, child SceneNodes will have all the transformation of its ancestors applied.
+ To render objects, create subclasses of SceneNode and add it as a child of the Scene's root_node.
+ The SceneNode has several convenience methods (rotate, translate, scale) to make it easy to apply transformations to a node
- One object must be textured with tga files
+ We read in .tga files via tga_util.h, which is then used to texture objects.
+ Our infrastructure supports RGB and RGBA textures
- Must texture at least two objects with two different textures
+ The iPad and the floor are textured
+ The table is textured and the genius bar is also textured.
+ we created a Texture2D object for displaying posters and screens.
- At least one object must be shiny, and one dull in appearance
+ The elephant and the stools in the genius bar are shiny. (There are 9 specular highlights on it)
+ The 2 purple spheres are of varying dullness (The larger sphere is the dullest)
- Your scene must have at least one directional light
+ There are 2 directional lights defined in demo.txt
- Your scene must have at least one point light source
+ There are 7 point lights defined in demo.txt
- One object must be instantiated more than once.
+ We pulled out the the object representation into subclasses of VertexObject, which contains things like the vertices, indices, normals, and textures.
+ VertexNode takes a reference to a VertexObject, and then draws the object with its own transformation.
+ Multiple instancing is handled by having multiple VertexNodes in the scene graph point to the VertexObject, each drawing the object with its own transformation.
+ Another way to handle multiple instancing (including all of a nodes children) is the PVertexNode, which points to another node in the scene graph, while also allowing for it to have its own transformations applied before the node that it is pointing to.
- You must be able to switch between fill and wireframe rendering for exactly one object
+ Press "f" to switch between fill and wireframe rendering for the elephant
- At least half of the objects in the scene must have correct normals
+ Obj/raw objects have normals
+ Table has normals defined by hand
+ genius bar has normals defined by had
- Use double buffering, hidden surface elimination, and a perspective projections
+ Implemented
- Must have some mechanism to toggle on and off all lights
+ Press "l" to toggle lights.
+ Press "x" to toggle textures.
- Use programmable fragment shaders
+ Implemented shadow mapping.
+ Implemented alpha texture maps. If the texture alpha channel is close to 0, then the fragment will be discarded. This offers an speed enhancement over blending, at the expense of being binary (either is fully there or not).
- Non-trivial vertex shader
+ implemented vertex flattening, which sets one of the coordinates to 0, to create an effect like that of mr. game & watch, or paper mario.
+ Also implemented a variation of flattening, which sets the coordinates to be a sine function of the y axis.
+ An elephant shaded with this vertex shader is on the table with the .raw objects.
- Mouse and keyboard
+ Implemented a FPS interface, where the user can use WASD to translate, and the mouse to look around
- Animation
+ The elephant is constantly moving in a circle.
+ Implemented via an update method for each SceneNode.
+ Press "m" to toggle movement for the elephant
+ There are different display modes for the Elephant Animation to maintain interactive rendering rates.

Extra Credit
============
- Fragment shader features: alpha texture maps, and shadow mapping. We would like to get extra credit for shadow mapping, as it was done with Framebuffer Objects for optimum speed, and the shadows are applied in the shader. In addition, to smooth some of the shadows, we averaged the shadows from the neighborhood of the shadow map (Percentage Closer Filtering)
- Full scene graph
- PVertexNodes: points to other nodes for multiple instancing (the entire subtree of the node being pointed to will be drawn)
- VertexObjects: objects that are passed to nodes to be drawn (only the object pointed to will be drawn)
- OBJ parsing
- We load in vertices, normals, and texture coordinates from the obj file
- These are rendered automatically via a VertexNode/VertexObject combination

Credits
======
- Juan Miguel de Joya modelled the stool for us.
+ See stool.obj
- tga_util.h/cpp was based off of the code from this site: http://steinsoft.net/index.php?site=Programming/Code%20Snippets/Cpp/no8
- The iphone .obj objects were available for free at turbosquid.com and wer not created by us
- The Imac, Iphone, Ipad, Genius Bar, and all other Apple related objects in our scene are the intellectual property of Apple.