New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here


by: Haylie Satterfield

ComputerGraphics CISC440

Haylie Satterfield
GPA 3.84


Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Class Notes
25 ?




Popular in Course

Popular in Computer Information Technology

This 86 page Class Notes was uploaded by Haylie Satterfield on Saturday September 19, 2015. The Class Notes belongs to CISC440 at University of Delaware taught by Staff in Fall. Since its upload, it has received 37 views. For similar materials see /class/207180/cisc440-university-of-delaware in Computer Information Technology at University of Delaware.

Similar to CISC440 at UD

Popular in Computer Information Technology


Reviews for ComputerGraphics


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 09/19/15
Ray Tracing Mani Thomas CISC 440640 Computer Graphics Photo Realism D o o 09 su Created by Daer Derman 7 050 440 Created by Jan Oberaenderr 030 540 Created by 1amp3 Oberaender 7 030 540 leafed by Donald Hyatt 5 C MtpsAIVMMIUhsstedudhyattsuperappovrayhtml Bunny A computer animated short lm Blue Sky stumos me A mm by onus Wedge wnn mum by Tom Warts and produced by Anna Pappapon a Introduction Light 0 Three Ideas about light 0 Light rays travel in straight lines 0 Light rays do not interfere with each other if they cross 0 Light rays travel from light source to the eye but the physics is invariant under path reversal Helmholtz reciprocity pP Sen et al Dual Photographyquot SIGGRAPH 2005 quot0 Novel photographic technique to interchange the lights and cameras in a scene p Introduction Ray tracing o What is Ray Tracing 0 Ray Tracing is a global History illumination based rendering method for generating realistic Palygnns Appnl 63 Guadrics csc Goldslein and Nagel 1l I To Ruth 82 Images on the computer lies Whined39ao Kuiiyn 3982 o Originators quotd 3quotquot 3933 Hunruhun 39 o Appel 1968 wept surlncas aiiya 3933 van wiik 3984 53 o Goldstein and Nagel o Whited 1979 Kc ya Coquilluri and Gungnei 84 Burr 3986 Daformalions GounesyofPaIHamaian ComputerGrapHcs Image amnesia Tecnnlques a Introduction Ray tracing el APP o Ray Casting Goldstein and Nagel I Scene Illumination Whited I Recursive ray tracing re ection o Forward and Backward Ray tracIn Gounesy ofPat Hanranan Computer Graphics Image Synthesis Tecnmques and refraction 39 g Introduction Ray tracing 0 Forward Ray tracing 0 Rays from light source bounce of objects before reaching the camera 0 Computational wastage o Backward Ray tracing 0 Track only those rays that finally made it to the camera counesy Angel Ray Casting 0 Ray Casting o visible surfaces of objects are found by throwing or casting rays of light from the viewer into the scene 0 Ray Tracing 0 Extension to Ray castin o Recursively cast rays from the points of intersection Courtesy Ange Ray casting o In ray casting a ray of light is traced in a backwards direction 0 We start from the eye or camera and trace the ray through a pixel in the image plane into the scene and determine what it intersects oIhe pixel is then set to the color values returned by the ray 0 lfthe ray misses all objects then that pixel is I shaded the background color Algorithm Ray casting mm m r quotp m r u m Ix 11 rm rd All inn Ii 39m Ir I N39 vu flmum mm c m WWIulnmNH 1 m mu m Hint wlu39rr ms v him my 1 39mm ul 39v a mud n v L I vL mm 1 m armmmm 5 Had h391137 I L39rm niwgrrFluydnlngrlu my nmIlu39pl m39 39 cwum n Pm km 391 4 Gounesy F 5 HM quotCommas Grapmcs usmg OpenGL Ray tracing overview 0 Ray casting finds the visible surfaces of objects 0 Ray tracing determines what each visible surface looks like 0 This extra curiosity is quite heavy on your processor 0 But it allows you to create effects that are very difficult or even impossible to do using other methods 0 Reflection o Transparency o Shadows o oounesy mzp MNWW geocllles comamlsoucmawacmg mm 14 Ray tracing overview 0 Ray tracing algorithm is a finitely recursive image rendering 0 First stage Like ray casting 0 Shoot a ray from the eye Primary ray 0 Determine all the objects that intersect the ray 0 Find the nearest of intersections 0 Second stage 0 ecurses by shooting more rays from the point of intersection Secondary rays jn Find the objects that are re ected at that point 9 Find other objects that may be seen through the object at that point I Find out light sources that are directly visible from that point Repeat the second stage until required 9 Ray Tracing example 0 Sometimes a ray misses all objects 1991 Ray Tracing example 0 Sometimes a ray hits an object 1991 Ray Tracing example o Is the intersected point in shadow 0 Shadow Rays to light source y NollM 11 m rJ L y w gt EZEEE i3 1991 Ray Tracing example 0 Shadow rays intersect another object 0 First intersection point in shadow of the second object 1991 Ray Tracing example 0 Shadow rays intersect another object 0 First intersection point in shadow of the second object 1991 2 Ray Tracing example 0 Reflected ray generated at point of intersection 0 Tested with all the objects in the scene 1991 21 Ray Tracing example 0 Local illumination model applied at the point of intersection 1991 22 Ray Tracing example 0 Transparent object o Spawn a transmitted ray and test against all objects in the scene 1991 23 Requirements for Ray tracing Compute 3D ray into the scene for each 2D image pixel Compute 3D intersection point of ray with nearest object in scene 0 Test each primitive in the scene for intersection 0 Find nearest intersection Recursively spawn rays from the point of intersection 0 Shadow Ra s o quotReflected rays 0 Transmitted rays ACchmulate the color from each of the spawned rays at the point of39intersection r Ray object intersection 0 Equation of a ray 0 S is the starting point and c is the direction of the ray 0 Given a surface in implicit form FXyz plane FILLILv139cdnxd o sphere 7 7 0 cylinder 39 o Allpoints on the surface satisfy FXyz0 o Thusquotfor ray rt to intersect the surface 0 The hittime can be got by solving FSctm 3D omen mersecnon mzp mww reammerendenng Commt Ray plane intersection 0 Equation ofa ray Equation of a pane JayLv139czdnxd o n is the normal to the plane and d is the distance of the plane from the origin 0 Substituting and solving fort FlJ qul39w nxdllw 0 nlScI0 nSl1ctd0 t im39sJ lncl 27 Ray triangle intersection o Tomas Mo ller and Ben Trumbore Fast minimum storage ray triangle intersectionquot Journal ofgraphics tools 212128 1997 o Barycentric coordinates l 1llquotPDllP 39P2 11390u391 o p is a point in a triangle with vertices P0 P1 P2 0 If rt belongs to both the line and triangle I 39SCI 1IIquotR3UP 39P o Solve for t u v o f L y complies with the restriction then ray rt intersects the triangle 0 Using t the intersection point can be easily computed p Ray triangle intersection R J Segura F R Feito AIgorithms to test Raytriangle Intersection Comparative Study WSCG 2001 Ray Sphere intersection o Implicit form of sphere given center abc and radiusr Ipipllrl pawlipam o Intersection with rt gives Sctq o By the identity ab3a2lbll1 ab o the intersection equation is a quadratic in t Scfiprll 7r t3c2 lit18 H lsiprl2 713 o Solying for t isip i i871 ICIJUS DJ H o Realsolutions indicate one or two intersections 0 Negative solutions are behind the eye 0 If discriminant is negative the ray missed the sphere Adding shadows P is hot in shadow with respect to L 1 P is in the shadow of the cube with respect to L2 Selfshadowing of P with respect to L3 Shadow Feelers o Spawn a ray from P to the light sources I If there is an intersection of the shadow ray with any object then P isin shadow NOTE Intersection should be between the point and light source and not behind light GounesyFS Hm quotComputerGrapnrcs using OpenGL source 31 Adding shadows 0 SelfShadowing 0 Always an intersection of shadow feeler with object itself 0 Move start point of the shadow ray towards the eye by a small amount 0 No intersection with itself Courtesy F 5 HM quotComputer Grapmcs using OpenGL 32 Re ection 0 Given surface normal n and incident ray a find the reflected ray r m re17mtaiml imla72m ailia i adapted from F s Hm quotComputersrapmcs using OpenGL 33 Re ection 51 34 Created by Dam Derman 7 050 440 Re ection Ek Created by Dam Derman 7 050 440 Re ection Created by Dam Derman 7 050 440 Re ection 37 Created by Dam Derman 7 050 440 Refraction 0 Bending of light rays as it crosses interface between media having different refractive indices 0 Snell s Law c1 sin 61 2 c2 sin 6 c1 c2 239 Refractive counesy F S Hm quotComputer Graphics uslng OpenGL Ind ex Refraction 0 Estimation the refracted ray T given u and N unit vectors If we assume that ni and nr are the refractive indices of the medium having the incoming ray and refracted ray respectivel Let and be the corresponding angle of incidence and refraction Let k bea unit vector Adaptedfrom Heam and Baker quotcomputersrapmcs wnn openGL perpendicular to N o By Snell s Law we have 113 51nd msind Refraction o Decomposing the incident ray u HFthIkNikD 1n IInquot 7 lakacasah o Decomposing the refracted ray T T nNnH1TkNkt Refraction 0 Substituting in Adapted from Heam and Baker quotComputer crapms wnn openGL Tree of Light 0 Contributions of light grows at each contact point 0 l is the sum of reflected component R1 transmitted component T1 and the local component 0 Local component is the ambient diffuse and specular reflections at P h o R is the sum of R3 T3 and local L3and so on ad in initum rai mm Fig ure out reflected ction and recurse Adapted from F S Hm and 050 540440 PM 2005 References 0 Textbooks o F S Hill Computer Graphics Using OpenGLquot o Commonly used ray tracing program completely free and available for most platforms 0 httpvvwwpovrayorg 0 Interesting Links 0 Interactive Ray Tracer Alyosha Efros 0 Ray Tracing explained ovh llwww eocitiescoml amisbucklra racin html 0 htt Iwwwsi ra hor IeducationlmaterialsH erGr a ra race raoe rn 9 In troduction to OpenGL TA Mani Thomas CISC 440640 maniudeledu Acknowledgements Most of the material for the slides were adapted from E Angel Interactive Computer Graphics 4 edition Some of the slides were taken from CSC 440640 Computer Graphics Spring 2005 Some of the images were taken from F S Hill Computer Graphics using OpenGL Other resources httpwwwiqhthouse3dcomopenqlqlut Jackie Neider Tom Davis and Mason Woo The OpenGL Programming Guide The Red Book The Programmer s Interface Programmer sees the graphics system through a software interface the Application Programmer Interface API Application program lt gt Hardware API Contents Functions that specify what we need to form an image Objects Viewer Light Sources Materials 7 Other information Input from devices such as mouse and keyboard Capabilities of system History of OpenGL Silicon Graphics SGI revolutionized the graphics workstation by implementing the pipeline in hardware 1982 To access the system application programmers used a library called GL With GL it was relatively simple to program three dimensional interactive applications OpenGL What is It The success of GL lead to OpenGL 1992 a platformindependent API that was Easy to use Close enough to the hardware to get excellent performance Focus on rendering Omitted windowing and input to avoid window system dependencies OpenGL Evolution Controlled by an Architectural Review Board ARB Members include SGI Microsoft Nvidia HP 3DLabs BM Relatively stable present version 20 39 Evolution reflects new hardware capabilities 3D texture mapping and texture objects Vertex programs Allows for platform specific features through extensions OpenGL Libraries GL Graphics Library Library of 2D 3D drawing primitives and operations API for 3D hardware acceleration GLU GL Utilities Miscellaneous functions dealing with camera setup and higherlevel shape descriptions GLUT GL Utility Toolkit Windowsystem independent toolkit with numerous utility functions mostly dealing with user interface Software Organization application program l l l l l OpenGL Motif widget or similar GLUT GLX AGL or WGL X Win32 Mac OS GLU GL l l I software andor hardware Lack of Object Orientation OpenGL is not object oriented so that there are multiple functions for a given logical function glVertexBf glVertex2i glVertedev Underlying storage mode is the same Easy to create overloaded functions in C but issue is efficiency OpenGL function format func ion name dlmen510ns glVertex3f x y z X z are oats belongs to GL library y glVertex3fv p p is a pointer to an array simplec include ltGLgluthgt void mydisplay g1 Cl ear GLCOLORBUFFERBIT ngeginGLPOLYGON glVertex2f O5 O5 glVertex2f O5 05 glVertex2fO5 05 glVertex2fO5 O5 glEnd glFlush int mainint argc char argv glutCreateWindowquotsimplequot glutDisplayFuncmydisplay glutMainLoop Event Loop Note that the program defines a display callback function named mydisplay Every glut program must have a display caHback The display callback is executed whenever OpenGL decides the display must be refreshed for example when the window is opened The main function ends with the program entering an event loop Default parameters simple c is too simple Makes heavy use of state variable default values for Viewing Colors Window parameters OpenGL Camera Righthanded system From point of view of camera looking out into scene OpenGL places a camera at the origin in object space pointing in the negative 2 direction Positive rotations are counterclockwise around axis of rotation light tap far left bottom nnar Coordinate Systems The units in g1Vertex are determined by the application and P are called object or problem coordinates The viewing specifications are also in object coordinates and it is the size of the viewing volume that determines what will appear in the image Internally OpenGL will convert to camera eye coordinates and later to screen coordinates ll quot look Transformations in OpenGl Modeling transformation Refer to the transformation of models ie the scenes or objects Viewing transformation Refer to the transformation on the camera Projection transformation Refer to the transformation from scene to image ModelNiew Transformations Modelview transformations are usually visualized as a single entity Before applying modeling or viewing transformations need to set glMatrixModeGLMODELVlEVV Modeling transforms the object Translation ngranslatexyz Scale ngcalesxsysz Rotation glRotatetheta Xyz Viewing transfers the object into camera coordinates gluLookAt eyeX eer eyeZ centerX centerY centerZ upX qu upZ ModelNiew transformation Courtesy Neider Davis and Woo The OpenGL Programming Guide Projection Transformation Transformation of the 3D scene into the 2D rendered image plane Before applying projection transformations need to set gMatrixModeGLPROJECTION Orthographic projection 39 glOrthoIeft right bottom top near far Perspective projection 39 glFrustum left right bottom top near far Projection Transformation icwplanc g lm Orthographic projection image produced far plane near plane Perspective projection F SHi Computer Graphics using OpenGL Program Structure Most OpenGL programs have the following structure main 2 defines the callback functions opens one or more windows with the required properties enters event loop last executable statement init 2 sets the state variables Viewing Attributes caHbacks Display function Input and window functions simplec revisited include ltGLgluthgt includes glh int mainint argc char argv glutInitampargcargv glutInitDisplayModeGLUTSINGLEGLUTRGB glutInitWindowSize500500 glutInitWindowPosition00 glutCreateWindow quotsimplequot de ne Wlndow propertles glutDisplayFuncmydisplay init display callback glutMainLoop set OpenGL state enter event 100p GLUT functions glutInit allows application to get command line arguments and initializes system gluInitDisplayMode requests properties for the window the rendering context RGB color Single buffering Properties logically ORed together glutWindowSize in pixels glutWindowPosition from topleft corner of display glutCreateWindow Create window With title simple glutDisplayFunc display callback glutMainLoop enter infinite event loop Window Initialization black clear color Yoid init k OpaqueN KkNN glClearColor 00 00 00 10 910 1 r3f10r 10r 1 C lt lldrawwithwhite glMatrixMode GLPROJECTION glLoadIdentity 2 glOrtho 10 10 10 10 10 10 Viewing volume Display callback function void mydisplay glClearGLCOLORBUFFERBIT ngeginGLPOLYGON glVertex2f O5 O5 glVertex2f O5 05 glVertex2fO5 05 glVertex2fO5 O5 glEnd glFlush Input and Interaction Multiple input devices each of which can send a trigger to the operating system at an arbitrary time by a user Button on mouse Pressing or releasing a key Each trigger generates an event whose measure is put in an event queue which can be examined by the user program Trigger process gt Trigger Measure process gt Measure Event queue Await Program Event f Ca backs Programming interface for eventdriven input Define a callback function for each type of event the graphics system recognizes This usersupplied function is executed when the event occurs GLUT example glutMouseFunc mymouse mouse callback function GLUT event loop Last line in main 0 for a program using GLUT is the in nite event loop glutMainLoop In each pass through the event loop GLUT looks at the events in the queue for each event in the queue GLUT executes the appropriate callback function if one is defined if no callback is defined for the event the event is ignored In main c glutDisplayFunc mydisplay identifies the function to be executed Every GLUT program must have a display callback Posting redisplays Many events may invoke the display callback function Can lead to multiple executions of the display callback on a single pass through the event loop We can avoid this problem by instead using glutPostRedisplay which sets a flag GLUT checks to see if the flag is set at the end of the event loop If set then the display callback function is executed Double Buffering Instead of one color buffer we use two Front Buffer one that is displayed but not written to Back Buffer one that is written to but not displayed Program then requests a double buffer in mainc glutInitDisplayMode GLRGB GLDOUBLE At the end of the display callback buffers are swapped void mydisplay glClear GLCOLORBUFFERBIT draw graphics here glutSwapBuffers Using the idle callback The idle callback is executed whenever there are no events in the event queue glutIdleFunc myidle Useful for animations void myidle change something t dt glutPostRedisplay Void mydisplay glClear draw something that depends on t glutSwapBuffers Using globals The form of all GLUT callbacks is fixed void mydisplay void mymouseGLint button GLint state GLint x GLint y Must use globals to pass information to callbacks float t global void mydisplay draw something that depends on t Other important functions glPushMatrix glPopMatrix Pushespops the transformation matrix onto the matrix stack glLoadIdentity glLoadMatrix glMuItMatrix Pushes the matrix onto the matrix stack Chapter 3 of the Red Book gives a detailed explanation of transformations Jackie Neider Tom Davis and Mason Woo The OpenGL Programming Guide The Red Book Assignment policy How to submit What to submit On late submission How to submit Submit as a tarzip file Unix gt tar Cf usernameprojectNum440640tar projeotDir gt gzip usernameprojectNum440640tar V ndows Use a zip utility Naming convention usernameprojectNum440640targzzip Submit the tarzip file through the course web More details will be announced later What to submit Must contain Readme Makefile Source codes Output figures if any Must NOT contain obj intermediate files obj data files What to submit Readme My name My email myemailudeledu Project Num Part 1 description of this project This project is to apply xxx algorithm to plot xxx Part 2 what I did and what I didn39t do I completed allmostsome functionalities required in this project The system is robust and the rendering is fairly efficient ldidn39t do The reason is Part 3 What files contained Part 4 How to compile and how to run The project is developed in windows system and tested in stimpy strauss unix system On late submission N 10 percent of the points you got will be deducted if there are N lt5 late days not counting weekends No acceptance for the submission more than 5day late Each student has three free ie without any penalty late days for entire semester You should notify the TA the use of free late days ahead OpenGL Setup in Unix Steps to compile the code on Strauss run following command setenV LDLIBRARYPATH homebaseusrbchandrak640OpenGLMe sa 26libusropenwinlibopUgcclib This is present as a comment in the Make le download Makefile and helloc compile and run helloc straussgt gmake f Makefilecomposor run your code Use hello if path not set properly straussgt hello Steps to compile the code on stimpy run following command setenV LDLIBRARYPATH usrlocalmesalibusropenwinlib download Makefilestimpy and helloc compile and run helloc stimpygt gmake f Makefilestimpy run your code Use hello if path not set properly stimpygt hello OpenGL Setup in Windows Go to the GLUT webpage httpwwwopenqlorqresourceslibrariesqluthtml From the bottom of the page download the following Precompiled Win32 for Intel GLUT 37 DLLs for Windows 95 amp NT Follow the instructions in httpwvwviqhthouse3dcomopenqlqlut 7 When creating the Visual CC project use the console based setup Office Hours Tuesday 530 730 pm Pearson Hall 1158 Webpage vimscisudeledumaniTA VoZOCoursesFallo 5qraphicsindexhtml Email maniudeledu


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Allison Fischer University of Alabama

"I signed up to be an Elite Notetaker with 2 of my sorority sisters this semester. We just posted our notes weekly and were each making over $600 per month. I LOVE StudySoup!"

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

Parker Thompson 500 Startups

"It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.