Introduction To Computer Graphics COMPSCI 464

2y ago
76 Views
3 Downloads
1.81 MB
50 Pages
Last View : 2d ago
Last Download : 5m ago
Upload by : Jayda Dunning
Transcription

Introduction to Computer GraphicsCOMPSCI 464Image credits: Pixar, Dreamworks, Ravi Ramamoorthi,

This class This class is not about– Using multiple graphicsAPI’s– Using modelingsoftware such as Mayaetc– Animation and creatingmovies– Game design anddevelopment It is about– Learning thefundamentals ofcomputer graphics– Implementingalgorithms that are atthe core of computergraphics– Familiarizing yourselfwith OpenGL andshaders

What is Computer Graphics? Making pictures with computers? Making pictures with math? Making pictures with physics?

Where did this image come from? What hardware/software did we need toproduce it?Angel and Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012

Preliminary Answer Application: The object is an artist’s renditionof the sun for an animation to be shown in adomed environment (planetarium) Software: Maya for modeling and renderingbut Maya is built on top of OpenGL Hardware: PC with graphics card formodeling and renderingAngel and Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012

Computer Graphics: 1950-1960 Computer graphics goes back to theearliest days of computing– Strip charts– Pen plotters– Simple displays using A/D converters to gofrom computer to calligraphic CRT Cost of refresh for CRT too high– Computers slow, expensive, unreliableAngel and Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012

Computer Graphics: 1960-1970 Wireframe graphics– Draw only lines Sketchpad Display Processors Storage tubewireframe representationof sun objectAngel and Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012

Computer Graphics: 1970-1980 Raster Graphics Beginning of graphics standards Workstations and PCsAngel and Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012

Raster Graphics Image produced as an array (the raster) ofpicture elements (pixels) in the frame bufferAngel and Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012

Raster Graphics Allows us to go from lines and wireframe images to filled polygonsAngel and Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012

Computer Graphics: 1980-1990Realism comes to computer graphicssmooth shadingenvironmentmappingAngel and Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012bump mapping

Computer Graphics: 1980-1990 Special purpose hardware– Silicon Graphics geometry engine VLSI implementation of graphics pipeline Industry-based standards– PHIGS– RenderMan Networked graphics: X Window System Human-Computer Interface (HCI)Angel and Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012

Computer Graphics: 1990-2000 OpenGL API Completely computer-generatedfeature-length movies (Toy Story) aresuccessful New hardware capabilities– Texture mapping– Blending– Accumulation, stencil buffersAngel and Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012

Computer Graphics: 2000 Photorealism Graphics cards for PCs dominate market– Nvidia, ATI/AMD, Intel Game boxes and game players determinedirection of market Computer graphics routine in movieindustry: Maya, Lightwave, etc Programmable pipelinesAngel and Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012

Real-time vs. Offline Real-time/interactive– 10–60 frames persecond– Games, interfaces,visual simulation. Offline/production– Seconds to hours perframe– Movies, architecturallighting simulation, .

Realistic Rendering Realistic/Photorealistic– Look like real life– Simulate physics– Reasonable appearing approximationNorbert Kern – POV-Ray Hall of Fame Gallery

Artistic/Non-PhotoRealistic Look like what an artist might produce Model artist’s process, physics Do what looks right (an art in itself)

Artistic

SIGGRAPH 2011 Technical Papers:http://www.youtube.com/watch?v JK9EEE3RsKM

Course Information Course Webpage:http://cs.boisestate.edu/ alark/cs464/ Place: MEC 309 Time: Mon Wed 6:00-7:15pm Prerequisites– COMPSCI 342 (Data Structures)

People Instructor: Alark JoshiEmail: alark@cs.boisestate.eduOffice hours: Tu, Th 3-5pm or byappointment Office: MEC 302A Piazza instead of a mailing list– http://www.piazza.com/boisestate/compsci464

Textbooks Fundamentals of ComputerGraphics.Peter Shirley and othersThird Edition, AK Peters, 2009.Required. OpenGL Programming GuideMason Woo and othersAddison Wesley, 2009.Required.– Older versions online

Course Objectives Understand the foundations ofcomputer graphics: hardware systems,math basis, light and color.

Course Objectives Implement key components of the renderingpipeline, especially visibility, rasterization,viewing, and shading.

Course Objectives Become acquainted with topics in computergraphics such as:– Texturing– Animation– Physically-based modeling– Procedural modeling– Curves and surfaces– Game development issues– Visualization– Virtual realityImage credits: Kitware, Ravi Ramamoorthi et al.

Grading Policy and AssignmentsProgramming Assignments50%Midterm Exam15%Quizzes10%Final Project25%AssignmentWeightDescriptionDue DateAssn 110%Introduction to OpenGLAug 31Assn 210%ModelingSep 12Assn 310%Transformations & ViewingSep 26Assn 410%ShadersOct 17Assn 510%Lighting, Shading and TextureMappingNov 7

Grading Policy One free late ofthree days– Request at least 24hours beforedeadline

Final Project (25%) Ray Tracing Processing WebGL / OpenGL onAndroid / OpenGL ES openFrameworks Cloth simulation /Deformation Volume rendering

Final Project (25%) Non-photorealistic rendering(painterly, artistic styles, etc.) Graphical application using CUDA(cloth simulation, mass springmodel, etc) Advanced shader projects (smoke,water, etc) Something exciting that you canconvince me about (look atSIGGRAPH papers) or come talk tome

Final Projects 2 Person project Requires– Project proposal (1 – page)– Project status (1 – page)– Project Report ( 8 – pages )– User manual ( 1-2 pages)– Source code– In-class presentation

Questions? Concerns?

Introducing OpenGL OpenGL – Open Graphics Library The rendering pipeline:–––––Transform geometry (object world eye)Calculate surface lightingApply perspective projection (eye screen)Clip to the view frustumPerform visible-surface processing Implementing all this is a lot of work OpenGL provides a standard implementation

OpenGL Design Goals SGI’s design goals for OpenGL– High-performance (hardware-accelerated) graphicsAPI– Some hardware independence– Natural, terse API with some built-in extensibility

OpenGL Design Goals OpenGL has become a standard because– It doesn’t try to do too much Only renders the image, doesn’t manage windows,etc. No high-level animation, modeling, sound (!), etc.– It does enough Useful rendering effects high performance– It was promoted by SGI (& Microsoft, half-heartedly),is now promoted/supported by NVIDIA, ATI/AMD,Apple etc. It doesn’t change every year (likeDirectX/Direct3D, it’s main competitor)

OpenGL: Conventions Functions in OpenGL start with gl– Most functions just gl (e.g., glColor())– Functions starting with glu are utility functions(e.g., gluLookAt()) Note that GLU functions can always be composedentirely from core GL functions– Functions starting with glut are from the GLUT(OpenGL Utility Toolkit) library, built on top ofOpenGL and WGL (Windows) or X (Linux) forwindow management, mouse and keyboard events, etc. Created and distributed as an entirely different library

OpenGL: ConventionsAngel and Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012

OpenGL: Conventions Function names indicate argument type andnumber–––––Functions ending with f take floatsFunctions ending with i take intsFunctions ending with b take bytesFunctions ending with ub take unsigned bytesFunctions that end with v take an array. Examples– glColor3f() takes 3 floats– glColor4fv() takes an array of 4 floats

Program Structure Most OpenGL programs have a similarstructure that consists of the followingfunctions– main(): defines the callback functions opens one or more windows with the required properties enters event loop (last executable statement)– init(): sets the state variables Viewing Attributes– callbacks Display function (called display() in many example programs) Input and window functionsAngel and Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012

OpenGL – Hello World/** hello.c* This is a simple, introductory OpenGL program.*/#include GL/glut.h void display(void){/* clear all pixels */glClear (GL COLOR BUFFER BIT);/* draw white polygon (rectangle) with corners at* (0.25, 0.25, 0.0) and (0.75, 0.75, 0.0)*/glColor3f (1.0, 1.0, 1.0);glBegin(GL POLYGON);glVertex3f (0.25, 0.25, 0.0);glVertex3f (0.75, 0.25, 0.0);glVertex3f (0.75, 0.75, 0.0);glVertex3f (0.25, 0.75, 0.0);glEnd();

OpenGL – Hello World/** start processing buffered OpenGL routines*/glFlush ();}void init (void){/* select clearing color */glClearColor (0.0, 0.0, 0.0, 0.0);/* initialize viewing values */glMatrixMode(GL PROJECTION);glLoadIdentity();glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);}

OpenGL – Hello World/** Declare initial window size, position, and display mode* (single buffer and RGBA). Open window with "hello"* in its title bar. Call initialization routines.* Register callback function to display graphics.* Enter main loop and process events.*/int main(int argc, char** argv){glutInit(&argc, argv);glutInitDisplayMode (GLUT SINGLE GLUT RGB);glutInitWindowSize (250, 250);glutInitWindowPosition (100, 100);glutCreateWindow ("hello");init ();glutDisplayFunc(display);glutMainLoop();return 0;/* ANSI C requires main to return int. */}

OpenGL Hello World

GLUT functions glutInit allows application to get command linearguments and initializes system gluInitDisplayMode requests properties for thewindow (the rendering context)– RGB color– Single buffering– Properties logically ORed together glutWindowSize in pixelsglutWindowPosition from top-left corner of displayglutCreateWindow create window with title “simple”glutDisplayFunc display callbackglutMainLoop enter infinite event loopAngel and Shreiner: Interactive Computer Graphics 6E Addison-Wesley 2012

OpenGL Rotating Square/** double.c* This is a simple double buffered program.* Pressing the left mouse button rotates the rectangle.* Pressing the middle mouse button stops the rotation.*/#include GL/glut.h #include stdlib.h static GLfloat spin 0.0;void display(void){glClear(GL COLOR BUFFER BIT);glPushMatrix();glRotatef(spin, 0.0, 0.0, 1.0);glColor3f(1.0, 1.0, 1.0);glRectf(-25.0, -25.0, 25.0, 25.0);glPopMatrix();glutSwapBuffers();}

OpenGL Rotating Squarevoid spinDisplay(void){spin spin 2.0;if (spin 360.0)spin spin - 360.0;glutPostRedisplay();}void init(void){glClearColor (0.0, 0.0, 0.0, 0.0);glShadeModel (GL FLAT);}void reshape(int w, int h){glViewport (0, 0, (GLsizei) w, (GLsizei) h);glMatrixMode(GL PROJECTION);glLoadIdentity();glOrtho(-50.0, 50.0, -50.0, 50.0, -1.0, 1.0);glMatrixMode(GL MODELVIEW);glLoadIdentity();}

OpenGL Rotating Squarevoid mouse(int button, int state, int x, int y){switch (button) {case GLUT LEFT BUTTON:if (state GLUT DOWN)glutIdleFunc(spinDisplay);break;case GLUT MIDDLE BUTTON:case GLUT RIGHT BUTTON:if (state GLUT DOWN)glutIdleFunc(NULL);break;default:break;}}

OpenGL Rotating Square/** Request double buffer display mode.* Register mouse input callback functions*/int main(int argc, char** argv){glutInit(&argc, argv);glutInitDisplayMode (GLUT DOUBLE GLUT RGB);glutInitWindowSize (250, 250);glutInitWindowPosition (100, 100);glutCreateWindow (argv[0]);init e);glutMouseFunc(mouse);glutMainLoop();return 0;/* ANSI C requires main to return int. */}

OpenGL Rotating Square Demo

Reading Reading assignments on class webpage– Reading must be done before class– Excellent supplement to in-class material Assignment 1: Introduction to OpenGLis due on August 31st at 11:59pm

Trivia Which was the first ever computergraphics video game?

Introduction to Computer Graphics COMPSCI 464 Image credits: Pixar, Dreamworks, Ravi Ramamoorthi, . –Game design and development It is about –Learning the fundamentals of computer graphics –Implementing algorithms that are at the core of computer graphics . Fundamentals of Computer Graphics

Related Documents:

2/25/2021 Compsci 101, Spring 2021 10 Compsci 101 Pancakes, While loops, Parallel Lists Part 2 of 3 2/25/2021 Compsci 101, Spring 2021 11 Susan Rodger Nikki Washington February 25, 2021 while BOOL_CONDITION: LOOP_BODY # modify variables, affect expression Collatz Code 2/25/2021 Compsci 101, Spring 2021 12

9/5/22 Compsci 201, Fall 2022, OOP 3. Recapping some Java Themes 9/5/22 Compsci 201, Fall 2022, OOP 4. Comments on Java Style Code blocks: Opening {ends first line of if, for, while, or method . Aside: Python uses objects too 9/5/22 Compsci 201, Fall 2022, OOP 15 Split is a methodwe are calling on this String object, not a

Computer Graphics & Image Processing 2003 Neil A. Dodgson 2 7 Course books Computer Graphics: Principles & Practice Foley, van Dam, Feiner & Hughes,Addison-Wesley, 1990 zOlder version: Fundamentals of Interactive Computer Graphics Foley & van Dam, Addison-Wesley, 1982 Computer Graphics &

D. Salomon: Computer Graphics Geometric Modeling, Springer, 1999 A. Watt: 3D Computer Graphics. Addison-Wesley Publishing Company, Inc., 2000 Journals Computer Graphics Forum IEEE CG & Applications ACM Transactions on Graphics ACM Transaction

Graphics Courses Key course Image processing and computer graphics (modeling, rendering, simulation) Specialization courses Advanced computer graphics (global illumination) Simulation in computer graphics (deformable and rigid solids, fluids) Master project, lab course, Master thesis Simulation track, rendering track

Graphics API and Graphics Pipeline Efficient Rendering and Data transfer Event Driven Programming Graphics Hardware: Goal Very fast frame rate on scenes with lots of interesting visual complexity Pioneered by Silicon Graphics, picked up by graphics chips companies (Nvidia, 3dfx, S3, ATI,.). OpenGL library was designed for this .

COMPSCI 105 SS - Principles of Computer Science 7 Assessment The course is assessed with nine tutorial sessions, a mid-term test, three assignments and an exam. It is officially classed as a practical course by the Science Faculty and in order to pass a student must pass both the practical component of the course (the tutorial sessions

AM I MY BROTHER’S KEEPER? Lanecia A. Rouse “In the Habit” session for use with devozine meditations for January 12–18, 2015. MAKING THE CONNECTION “The other day I was sitting in a local coffee shop writing a devotion. Needing a break, I looked up from my computer and out a big window in front of me to view the city scene. I noticed outside a woman wearing house shoes, and she seemed .