An Homage to Matt Groening

In 2009 I took an intro course to openGL. For some time I had been wanting to get working with graphics using C/C++ but never had a library to work with. My former experience with graphics was using Java in high school (which reminds me, I MUST find some of those projects, they were awesome). [Update 3/3/2012. You can now download and see this project first-hand! See details at end of post As of 2013, these files have expired due to lack of interest]

Anyways, I digress. For my final project, I had to choose a subject to render in 3D. Some students choose to render little boxcars, others did some really cool things with lights and spheres. I chose to pay homage to the man who gave us The Simpson’s – Matt Groening – by rendering the iconic living room and couch we see every episode.

Some notes about the project:

Every object is rendered using openGL primitives minus the lampshade on the right. I built that by hand.

The project took nearly 40 hours to complete.

The user can change a couple settings about the scene:

1. The ‘r’ key makes the telephone start ringing. ‘r’ again makes it stop

2. You can change the ball material from red rubber to silver to emerald

3. You can change the painting between the iconic sailboat, a picture of Kramer from Seinfeld, or a cool picture of an asteroid impacting a planet.

4. You can modify the ball to bounce lower or higher than normal, causing a faster or slower movement.

5. You can freely rotate the scene in all axes, and using the wasd keys moves the entire scene left, right, towards the camera, and away from the camera.

——

Now, I realize there’s no bouncing ball in the actual Simpson’s living room. A requirement for the project was to do something with shadow rendering (may sound easy to you openGL vets, but this is tough for newbies).

Overall, I’m very proud with how this turned out. Of course, my artist friend later informed me he could draw something like this using his digital art tools in about 30 minutes or less. Easy for him to say. He gets instant feedback while he’s working on the scene. For me, it looked something like this:

Here’s a few more pics of the rendered scene:

Downloading and running the project:

  1. Download the files from here (Update: Link is dead — the file expired due to lack of interest).
  2. Unzip the folder, and there should be another folder named ‘debug’
  3. Inside of ‘debug’ is a file named ‘CPS 460 3D Project’, double-click this to run the file
  4. To Interact with the scene (case-insensitive):
    1. Right-Click to set properties like painting, ball material, and ball bounce height
    2. Left-Click and drag to rotate the scene
    3. Press ‘W’ to zoom in
    4. Press ‘S’ to zoom out
    5. Press ‘A’ to rotate clockwise about Z-axis
    6. Press ‘D’ to rotate counter-clockwise about Z-axis
    7. Press ‘R’ to start/stop the telephone ringing

Enjoy!

Advertisements

Tags:

8 Responses to “An Homage to Matt Groening”

  1. Think You’re Good At Connect 4? « Andy G's Blog Says:

    […] you’ve read any of my older posts, you may have stumbled across my rendition of the Simpson’s living room in 3D. Building this scene took at least as long as that one. […]

  2. sam Says:

    hey can you like help me figure out drawing the sofa…i am doing stuff in OpenGL, where i drew a castle and when I go inside the building , i want to add a sofa like shown in picture…thx

    • gieseanw Says:

      Hey Sam,
      The couch is made up of a few OpenGL primitives that are cleverly sized and placed:

      • The back of the couch is a large sphere that is squished in
      • The buttons on the couch are smaller spheres evenly spaced along the back
      • The armrests consist of a closed cylinder sitting on top of a transformed cube
      • The bottom is a transformed cube
      • The cushions are also just transformed cubes

      To get the “stencil” effect, I drew the couch cushions twice, but the second time I drew them I scaled them up slightly and drew them in wireframe (I did the same thing with the phone buttons).

      That said, here’s a snippet of the code used to draw the couch:

      void couchArmFront()
      {
      //Caps to the front arms
      glPushMatrix();
      glScalef(1.0,1.0,0.001);
      glutSolidSphere(0.077,15,15);
      glPopMatrix();

      }//end of couchArmFront function
      void couchArm()
      {
      //Base
      glPushMatrix();
      glScalef(.5,1.0,1.0);
      glutSolidCube(0.3);
      glPopMatrix();

      //Arm Rest
      glPushMatrix();
      glTranslatef(0.0,0.15,-0.15);
      gluCylinder(quadric,.077,.077,.3,15,15);
      glPopMatrix();

      //Cap of Arm Rest front
      glPushMatrix();
      glTranslatef(0.0,0.15,0.15);
      couchArmFront();
      glPopMatrix();

      //Cap of Arm rest back
      glPushMatrix();
      glTranslatef(0.0,0.15,-0.15);
      couchArmFront();
      glPopMatrix();
      }//end of couchArm function
      void couchCushion()
      {
      GLfloat couchCush_ambient [] = {0.0f, 0.0f, 0.0f, 1.0f};
      GLfloat couchCush_diffuse [] = {0.0f, 0.0f, 0.0f, 1.0f};
      GLfloat couchCush_specular [] = {0.0f, 0.0f, 0.0f, 1.0f};
      GLfloat couchCush_shininess [] = {50.0f};

      glPushAttrib(GL_ALL_ATTRIB_BITS);
      glPushMatrix();
      glScalef(1.399,0.3,1.4);
      glutSolidCube(.2);
      glMaterialfv(GL_FRONT, GL_AMBIENT, couchCush_ambient);
      glMaterialfv(GL_FRONT, GL_DIFFUSE, couchCush_diffuse);
      glMaterialfv(GL_FRONT, GL_SPECULAR, couchCush_specular);
      glMaterialfv(GL_FRONT, GL_SHININESS, couchCush_shininess);
      glutWireCube(.201);
      glPopAttrib();
      glPopMatrix();

      }//end of couchCushion function
      void couchButton(int num)
      {
      // The center button has to be rendered slightly less far back so that
      // it does not clip into the back of the couch
      double transZ = 0.0;
      if (num == 2)
      transZ = -0.115;
      else
      transZ = -0.125;
      glPushMatrix();
      glTranslatef(0.0,0.20,transZ);
      glScalef(1.0,1.0,0.35);
      glutSolidSphere(0.02,10,10);
      glPopMatrix();
      }//end of couchButton function
      void couch()
      {
      //couch arms
      glTranslatef(0.0,0.15,0.3);
      couchArm();
      glTranslatef(1.0,0.0,0.0);
      couchArm();
      glTranslatef(-0.5,0.0,0.0);
      glPushMatrix();
      //couch base
      glTranslatef(0.0,-0.04,0.0);
      glScalef(3.33,0.50,0.9);
      glutSolidCube(0.3);
      glPopMatrix();
      //couch back base
      glPushMatrix();
      glTranslatef(0.0,0.0,-0.2);
      glScalef(3.80,1.0,0.35);
      glutSolidCube(0.3);
      glPopMatrix();
      glPushMatrix();
      //couch back top
      glTranslatef(0.0,.175,-0.2);
      glScalef(1.9,0.9,0.3);
      glutSolidSphere(.3,30,30);
      glPopMatrix();

      //couch cushions
      glTranslatef(-0.28,.08,0.0);
      couchCushion();
      couchButton(1);
      glTranslatef(0.28,0.0,0.0);
      couchCushion();
      couchButton(2);
      glTranslatef(0.28,0.0,0.0);
      couchCushion();
      couchButton(3);
      }//end of couch function

  3. sam Says:

    thanks a ton.

  4. Lancia Valen Says:

    The link seems to be broken. Can you provide me the code please?

  5. Mr Radhite Says:

    hi, the link is broken, can you provide me the new link please ? thanks before 😀

  6. anvithank Says:

    Hi!
    Iam doing an opengl project and so it would be of great help if i could the this code.
    Pls provide the link??

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: