My Graphics Assignment

I did this as an assignment for a graphics course I was taking in college a couple of years back. I had to take a picture of something real and then create the same picture using Povray which is a language that lets you ‘program’ a picture. It then creates it for you (sort of like compiling the source code). So you would end up describing things like the light source and the shape and texture of the objects, etc. Even a this simple picture took a few minutes to be ‘compiled’ into an image from the source code while running on 3 Linux machines in parallel.

**The original picture:

http://www.gupistan.com/gallery/1/restaurant-original.jpg

The computer generated one:**

http://www.gupistan.com/gallery/1/restaurant.jpg

wooooooooooaaaaaaaaawwwwwwwwwoooooooooo…

http://www3.pak.org/gupshup/smilies/eek.gif

..


I don’t think, yet I still eXist…

I wish i could do this

Very nice..

isnt the corner of the wall on the right of the window a bit tilted to the right?

wow
now thats called cool! converting normal pictures into 3d.
Man im definatly gona have to take that cource next summer. I was planning to move but MUST DO IT.

Post more!


[This thread is being closed for unspecified reasons. (edited November 19, 1982).]

acha hai.. i wish main bhee yahee kar sakta ...


mairay dill mairay mussafir

Cool Work

http://www3.pak.org/gupshup/smilies/ok.gif

So what are the aplications of this work is real life?

(the only thing I can think of is recreating the crime scene for Jury)

Does it have any application in computer games?


Zamane kay Andaz Badle Gay
Naya Raag hai, Saaz Badle Gaye

Remember such animated movies such as Toy Story and Ants and A Bug’s Life? They were all based on the same techniques as the picture above. Difference is that they had a lot more still pictures so as to make up 20 or 30 per second to make up a motion picture. Also since that application was so much more complicated they also used much more sophisticated tools.

Another major application of computer graphics is in modelling such as in simulations (fligt simulator or a simulator for a bridge that has not been constructed yet). In such applications the programmer has to add other elements to the overall design as well such as the weight and strength of the objects in the picture. Then he can simulate what would happen if a wind of certain speed hits a bridge of a certain kind. If it breaks, with a few key strokes he can change the specifications of the bridge and then re run the simulation, with out ever destroying a real bridge or losing a single life.

Just for the sake of any curious soul out there, following is the source sode for the picture:




#include "colors.inc"
#include "textures.inc"

#declare wall_color = rgb<0.9, 0.8, 0.8>  // light grey but very slightly red
#declare wood_thickness = 0.5
#declare wall_thickness = 2
#declare right_wall_at = 10     // ( x  - value )
#declare left_wall_at = -16     // ( x  - value , wall not drawn since its not visible)
#declare front_wall_at = -1     // ( z  - value )
#declare floor_at = -16         // ( y  - value )
#declare roof_at = 7            // ( y  - value )
#declare half_table_leg_thickness = 0.4 // half of thickness for tables legs
#declare window_width = 9       // width of the window on front wall
#declare window_height = 13     // height of the window on front wall
#declare half_window_frame_thickness = 0.25 // half of thickness of center cross in window

#declare right_seat =
difference {
  union {
    // top of seat
    box { <4.90, -5, front_wall_at + 0.5>, <right_wall_at, -5 - wood_thickness, -11> }
    // back of seat
    box {
      <wood_thickness/2, 3.5, front_wall_at + 0.5>, < -wood_thickness/2, -3.5, -11>
      rotate <0, 0, -5>
      translate <5.35 - wood_thickness/2, -8.5, 0>
    }
    // seat of seat
    box { <5, -12, front_wall_at + 0.5>, <-1.25, -12 - wood_thickness, -11> }
    // box under the seat
    box { <right_wall_at, -12 - wood_thickness, front_wall_at>, <-0.5, floor_at, -10.5> }
    // box behind seat
    box { <5.25, -5 - wood_thickness, front_wall_at>, <right_wall_at, floor_at, -10.5> }
  }
  // minus the space for small shelves on the side (visible on ly in seat on left)
  box { <6.25, -5 - wood_thickness - 1, front_wall_at + 1>, <right_wall_at - 1, floor_at + 1, front_w
all_at - 3>}
  texture {
    pigment { color rgb <1, 1, 1> }
  }
}

// left seat will be just the right seat but translated, rotated, translated
#declare left_seat =
object {
  right_seat
  translate <-right_wall_at, 0, -front_wall_at>
  rotate < 0, 180, 0>
  translate <left_wall_at-4, 0, -10.5>
}

#declare table =
union {
  box { <-4, 0.25, 4>, <4, 0.25 - wood_thickness, -4> }
  // front leg
  box { <-half_table_leg_thickness, 0.25 - wood_thickness, -5 + half_table_leg_thickness>, <half_tabl
e_leg_thickness, floor_at + 9.25, -5 - half_table_leg_thickness>}
  // back leg
  box { <-half_table_leg_thickness, 0.25 - wood_thickness, 3 + half_table_leg_thickness>, <half_table
_leg_thickness, floor_at + 9.25, 3 - half_table_leg_thickness>}
  cylinder { <0, 0.25, -4>, <0, 0.25 - wood_thickness, -4>, 4 }
  translate <-5.5, -8.75, -5>
  texture {
    pigment { color White }
  }
}

#declare front_wall =
difference {
  box { <left_wall_at-4, floor_at, front_wall_at>, <right_wall_at, roof_at, front_wall_at + wall_thic
kness> }
  box { <-10, -9, -2>, <-1, 4, 2> } // minus a window and frame
  texture {
    pigment { color wall_color }
  }
}

#declare window =
union {
  box {
    <-10, -9, front_wall_at + wall_thickness>, <-10 + window_width, -9 + window_height, front_wall_at
 + 0.5>
    texture {
      pigment { color White }
    }
    finish {
      ambient 0.5               // to give the daylight look
    }
  }
  // following union makes up the outer frame and the cross in the center of the window
  union {
    box {
      <-10 + window_width/2 - half_window_frame_thickness, -9, front_wall_at + wall_thickness>,
      <-10 + window_width/2 + half_window_frame_thickness, -9 + window_height, front_wall_at - 0.2>
    }
    box {
      <-10, -9 + window_height/2 - half_window_frame_thickness, front_wall_at + wall_thickness>,
      <-10 + window_width, -9 + window_height/2 + half_window_frame_thickness, front_wall_at - 0.2>
    }
    // the outer frame
   difference {
      box {
        <-10 - 4*half_window_frame_thickness, -9 - 4*half_window_frame_thickness, front_wall_at + wal
l_thickness>,
        <-10 + window_width + 4*half_window_frame_thickness, -9 + window_height + 4*half_window_frame
_thickness, front_wall_at - 0.2>
      }
      box {
        <-10, -9, front_wall_at + wall_thickness + 1>, <-10 + window_width, -9 + window_height, front
_wall_at - 2>
      }
    }
    texture {
        pigment { color rgb<0.8, 0.8, 0.8> } }
    }
}

// the camera position
camera {
  location <-12,-3,-25>
  look_at <-3,-6,0>
  scale 1.1
}

// light from window
light_source {
  <-5.5, -2.5, -1> color rgb<0.5, 0.5, 0.5>
  area_light <9, 0, 0>, <0, 13, 0>, 4, 6
}

// light from top to give the shadow of the table falling on seats
light_source {
  <-5.5, 7, -6.5> color White
  area_light <3, 0, 0>, <0, 0, 3>, 6, 6  // are light for soft shadows
}

// light from wall opposite the window.. this helps to evenly illuminate the
// whole scene without any shadows from this light source
light_source {
  <-3, -5, -20> color White
  area_light <right_wall_at - left_wall_at, 0, 0>, <0, roof_at - floor_at, 0>, 18, 15
}

// put front wall
object {front_wall}

// put window
object { window }

// put right wall
box {
  <right_wall_at, floor_at, front_wall_at>, <right_wall_at + 1, roof_at, -20>
  texture {
    pigment { color wall_color }
  }
}

// put roof
box {
  <-20, roof_at, front_wall_at>, <right_wall_at, roof_at + 1, -20>
  texture {
    pigment { color White }
  }
  finish {
    ambient 0.4  // to make roof visible without lights pointing at it
  }
}

// put table
object { table }

// put right seat
object { right_seat }

// put left seat
object { left_seat }



http://www3.pak.org/gupshup/smilies/pagal.gif

..

http://www3.pak.org/gupshup/smilies/ok.gif


I don’t think, yet I still eXist…

Pretty Kool Stuff …

http://www3.pak.org/gupshup/smilies/ok.gif

http://www3.pak.org/gupshup/smilies/ok.gif


~Facts do not cease to exist because they are ignored.~