1 / 82

Welcome! Today: Administrative stuff. Introductory remarks. Voting on course arrangements.

Welcome! Today: Administrative stuff. Introductory remarks. Voting on course arrangements. Basic graphics + OpenGL revision or curves & surfaces. Administrivia. Web page: http://www.cse.unsw.edu.au/~cs9018 Includes a notice board + message board.

iona
Download Presentation

Welcome! Today: Administrative stuff. Introductory remarks. Voting on course arrangements.

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Welcome! • Today: • Administrative stuff. • Introductory remarks. • Voting on course arrangements. • Basic graphics + OpenGL revision or curves & surfaces. COMP9018 - Advanced Graphics

  2. Administrivia • Web page: • http://www.cse.unsw.edu.au/~cs9018 • Includes a notice board + message board. • Tim & I will read/contribute regularly. • Also lots of links and stuff. COMP9018 - Advanced Graphics

  3. Administrivia • People • Waleed (that's me) (waleed@cse.unsw.edu.au) • Tim (the smart guy) (lambert@cse.unsw.edu.au) • Who to e-mail: • Enrolments: waleed • Software problems: waleed • Web issues: waleed • Lecture material: whoever presented it • Tricky questions: lambert • Lecturer-in-charge/complex admin: lambert COMP9018 - Advanced Graphics

  4. Attitude to the course • Graphics is HUGE! • No one person can grasp all of it • Tim & I know stuff but we don't know it all: guides rather than experts COMP9018 - Advanced Graphics

  5. Fourth year • This is a fourth year subject/graduate subject • So rules are a little different. • Smaller numbers = • more flexibility • higher standard (we hope) • more interactivity COMP9018 - Advanced Graphics

  6. Things we’d like you to do • Common sense: • Doing the best you can in the subject • Respecting fellow students • Shutting up when you're not supposed to talk • Participating • Doing the preparation/homework we ask you to • Not cheating (we'll come down HARD on cheats) • Actually showing up to appointments/not expecting us to be available all the time COMP9018 - Advanced Graphics

  7. Some basic rules • Questions allowed at any time ... but raise your hands and wait for us to ask • Open to suggestions • Academic etiquette: You’re allowed to borrow or copy, but when you do, ACKNOWLEDGE it. COMP9018 - Advanced Graphics

  8. Anybody scared? • Can discontinue without failure until end of week 4 (I think) COMP9018 - Advanced Graphics

  9. Run through handout • See handouts COMP9018 - Advanced Graphics

  10. Voting issues • Vote on lots of critical things • ... but you can't vote people out of the course • Course isn't going to get smaller and smaller as time goes on, 'til last person gets an HD COMP9018 - Advanced Graphics

  11. Issue 1 • Language preference • C/C++ vs Java • Any other bizarre languages? Fortran, Perl, Python, Haskell? • Examples in both? • Assignments: both allowed COMP9018 - Advanced Graphics

  12. Issue 2 • Last time had a local games company give a seminar/demo • Couldn’t organise film person; but will try again this year … if you are interested • Vote? COMP9018 - Advanced Graphics

  13. Issue 3 • Syllabus material • Rough outline of what was covered last time • Any topics from the list people feel strongly about? • What to drop to include? COMP9018 - Advanced Graphics

  14. Week 13 demo night • Put it in your calendars • No lectures week 13 • From 5pm to 10pm • Can bring in own equipment if you like • Do you guys want me to ask outsiders (e.g. industry people) to attend? COMP9018 - Advanced Graphics

  15. Text • Graphics has 2 properties: • Diverse • Fast-moving • Generally means textbooks get out of date quickly • The Net is a very good resource. • See links on Web page for online info. COMP9018 - Advanced Graphics

  16. … but if you really want … • Textbooks • Computer Graphics: Principles & Practice Brown et al. Known as “Old Testament” • Advanced Animation & Rendering Techniques by Watt & Watt. Known as “New Testament” • OpenGL Programming Guide by OpenGL ARB. Known as the “Red Book” or “Lego book”. Available online. COMP9018 - Advanced Graphics

  17. Labs • Have hardware acceleration (TNT2 cards -- not great, but better than nothing) • Linux is official platform (not by choice, really) • For compatibility: Only use standard Java libraries + gl4java; for C/C++: standard libraries + OpenGL + GLU + GLUT + MUI ... must compile with gcc • If you want something else, let us know. COMP9018 - Advanced Graphics

  18. Project possibilities • Write your own game • Write your own modeller • Extend an open source program with some feature • Make a short CG movie • But be careful with your time budget! Don’t want you to fail other subjects (almost happened last time) COMP9018 - Advanced Graphics

  19. Examples from last time • Some examples • Movie scenes: • Lord of the Rings + modelling tools (4 ppl). • Story of a fly. • Games: • 3D pool (2 ppl). • 3D tetris • 3D multiplayer networked robot/shooter/transfomer game (2ppl). • Halflife level modelled on Ground & Basement of CSE. • Global thermonuclear war with Ronald Raygun, COMP9018 - Advanced Graphics

  20. More examples • Interactive applications • Origami tutor • CT-Scan lung visualiser • Photo-etching animation. • Artificial creatures lab • Lego modeller • Screen savers: • Rollercoaster generator. • Rubik’s snake. COMP9018 - Advanced Graphics

  21. Special resources • Generally • Increased disk quota (+ 20Mb) • Increased IP quota (+ 200Mb) • Trying to arrange special access to bongo lab. COMP9018 - Advanced Graphics

  22. Project-specific • With access to bongo: • 6 Maya floating licenses. • VirTools. • May be able to arrange other tools, but may be difficult. COMP9018 - Advanced Graphics

  23. Special resources • Available on request • Good for the project • Two clusters: • vina: 18 machines, 1x866MHz, 256MB RAM, Linux • tines: 17 machines, 2x450MHz, 512MB RAM, Linux COMP9018 - Advanced Graphics

  24. Software available • GLUT 3.7 • OpenInventor • POVRay • Blue Moon Rendering Tools (RenderMan compatible, radiosity support) • Java3D • Blender COMP9018 - Advanced Graphics

  25. Break time • After break, revision of basic graphics + OpenGL or • Get straight into curves and surfaces. • Vote!! COMP9018 - Advanced Graphics

  26. Graphics Revision • What is graphics? • About anything computer generated that you see: • In print • On a monitor • On television • At the movies • At art exhibitions COMP9018 - Advanced Graphics

  27. Usual representation • Most common representation of an image is a bitmap: A 2D array of pixels • Each pixel holds a description of the colour of that point • The bitmap that holds the current image on display is called the frame buffer COMP9018 - Advanced Graphics

  28. Representing colour • Usual way is as a combination of red green and blue; but monochrome is also possible • Different approaches: • Fixed set of colours (e.g. CGA, EGA). Colour represented by a bit value • Each pixel stores an index into an array of customisable colours (e.g. VGA) aka colour index mode • Each pixel directly represents its colour directly (e.g. HighColor, TrueColor) aka RGB mode. COMP9018 - Advanced Graphics

  29. Objects • Primitive objects in graphics: • Points: A single coordinate. • Lines: usually a parametric representation (a + tb; 0 < t < 1) or a pair of coordinates. • Polygons: A sequence of points. Usually talk of closed polygons (end is same as beginning) COMP9018 - Advanced Graphics

  30. But first ... what is a polygon? • Sequence of points enclosing a plane. • In 3D, we use polygons that only have one face ... there is no "back" of a polygon. • How do you decide which way a polygon is facing? Convex polygon Concave polygon COMP9018 - Advanced Graphics

  31. Using the normal • If not specified, use the right hand rule. D B C C A A B D Out of the page Into the page COMP9018 - Advanced Graphics

  32. Types of polygon • Nasty polygons: • Non-planar: Not all vertices are in the same plane. • Self-intersecting: Polygons that intersect themselves are problematic. • Concave: Have internal angles greater than 180 degrees. Complicate lots of things. • We'll assume we don't have any of these. COMP9018 - Advanced Graphics

  33. Transformations • Frequently want to represent "doing" things to objects. Doing things = "transformations". • Many useful transformations can be represented as matrices applied to vectors • Homogeneous matrices are used so that translations can be represented as matrices. • Homogenous means 1 more dimension than underlying space: 3x3 for 2D, 4x4 for 3D COMP9018 - Advanced Graphics

  34. Why homogenous? • Allows us to represent translations as a matrix multiply -- making almost all interesting modelling transforms COMP9018 - Advanced Graphics

  35. Example transforms • Rotate about origin in 2D • Scale • Translate • Rotation about y axis in 3D? • Perspective • etc etc etc COMP9018 - Advanced Graphics

  36. Window to Viewport mapping • Maps part of the 2D plane of interest onto the monitor • Usually includes an inversion because monitors are upside down • Except with OpenGL, which maintains a Cartesian representation COMP9018 - Advanced Graphics

  37. Clipping • Finding bits outside the screen • Why? • Speed ... don't render what we don't need to render • Avoid overwriting random bits of memory COMP9018 - Advanced Graphics

  38. Graphics pipelines - 2D • Start with description of 2D objects (lines, points, polygon) • Apply transformations to position them • Apply window-to-viewport mapping • Clip • Rasterise COMP9018 - Advanced Graphics

  39. OpenGL • Provides a general platform independent graphics API that's a rich but thin and efficient layer over the hardware. • About 150 commands • For real-time 2D and 3D point, line and polygon based rendering • Also does 3D lighting and texturing COMP9018 - Advanced Graphics

  40. What OpenGL doesn't do • Doesn't deal with windows or I/O • Doesn't handle curves or curved surfaces • Doesn't have a file format or handle complicated objects - only points lines and polygons • Doesn't create image files COMP9018 - Advanced Graphics

  41. Companion libraries to OpenGL • GLU (GL utility): Does tesselation of curved surfaces, some more flexible projections, etc • GLUT (GL utility toolkit): A platform-independent window and I/O system (also now includes MUI - micro user interface for menus, dials etc) • WGL, GLX: Platform-specific window and I/O systems • OpenInventor: Provides high-level scene graph libraries COMP9018 - Advanced Graphics

  42. OpenGL and Java • Too slow to have an OpenGL implementation in Java. • So usual technique: use a Java native interface to OpenGL and provide a Java interface to it. • We’ll be using GL4Java COMP9018 - Advanced Graphics

  43. Why not use Java3D? • Java3D is a high-level scene graph library • More like OpenInventor than OpenGL • Java3D is implemented on top of OpenGL! • Have a look at Java3D later • Grrr ... COMP9018 - Advanced Graphics

  44. More about OpenGL • Funky thing about it: It's basically a state machine - i.e. another computer • Most commands don't produce visible output - they set up the state for what happens between glBegin and glEnd commands • Interesting stuff happens between the glBegin and the glEnd COMP9018 - Advanced Graphics

  45. Open GL + C/Java • Anatomy of a simple OpenGL program in C/GLUT - hello.c • ... from the OpenGL Programmer's Guide • Java’s pretty much the same. COMP9018 - Advanced Graphics

  46. The matrix stack • How OpenGL does transformations • A perfect fit for scene graph traversal • How matrix stacks work COMP9018 - Advanced Graphics

  47. Basic operations • glMatrixMode(Mode)sets the matrix stack we want to use. For now, only concerned with GL_MODELVIEW. • glPushMatrix()copies current top of matrix stack and pushes on top of stack. • glPopMatrix()pops off the top of the stack • glLoadIdentity()loads identity matrix onto top of stack COMP9018 - Advanced Graphics

  48. How matrix stack is used. • When you do glTranslatef(...)it actually postmultiplies by the matrix on top of stack and puts it back on top of the stack. • Means that last matrix op is done first. COMP9018 - Advanced Graphics

  49. Example - On blackboard • Initialise stack with glMatrixMode(GL_MODELVIEW);glLoadIdentity(); • Scale by 2glScaled(1.0, 2.0, 1.0); • Rotate around x by 90glRotated(90, 1, 0, 0); • Push on stackglPushMatrix(); I S(2) S(2).R(90) S(2).R(90) copy S(2).R(90) COMP9018 - Advanced Graphics

  50. Example - cont'd • Translate by a glTranslatef(a.x, a.y, a.z); • Draw a point on screen.glBegin(GL_POINTS);glVertex3f(1,1,1);glEnd();would actually draw at S(2).R(90).Tr(a).(1,1,1) • Pop off stackglPopMatrix(); S(2).R(90).Tr(a) S(2).R(90) S(2).R(90)Tr(a) S(2).R(90) S(2).R(90) COMP9018 - Advanced Graphics

More Related