Wednesday, December 5, 2012

CG2 Ray Tracer Part 1 - Setting the Scene

My Scene Set-up
Original Image
For the first part of the ray
tracer assignment, we had to set the scene and collect the coordinates/locations of each object in the scene. In my set-up, the blue wire-frame sphere is the Glass Ball. The green solid sphere is the mirrored ball. Finally, the solid teal floor is the red/yellow checkered floor in the original image.


The coordinates are as follows:


// Blue Ball ( Glass )
glTranslatef( 80, .7, 155 );
glutWireSphere( 8, 32, 32 );


// Green Ball ( Mirror )
glTranslatef( 68, -5, 140 );
glutSolidSphere( 8, 32, 32 );


// Floor
glBegin( GL_QUADS );
glVertex3d( 100, -20, -100 );
glVertex3d( 10, -20, -100 );
glVertex3d( 10, -20, 200 );
glVertex3d( 100, -20, 200 );
glEnd();

// Camera 
gluLookAt(80, 0, 210, 80, -20, -200, 0, 5, 0 ); 

// Light Source
GLfloat light_pos[] = { .3, 1.0, 1.0, 0.0 };
GLfloat spec[]  = { 1.0, 1.0, 1.0, 1.0 };
GLfloat shiny[] = { 100.0 };
GLfloat ambient[] = { 1.0, 0.2, 0.2, 1.0 };







No comments:

Post a Comment