Download de presentatie
De presentatie wordt gedownload. Even geduld aub
GepubliceerdGerrit Verhoeven Laatst gewijzigd meer dan 9 jaar geleden
1
2IV10 Computergrafiek set 1-inleiding Jack van Wijk TU/e
2
Computergrafiek Doel: Kennis over en ervaring met basisconcepten 2D en 3D computergrafiek Vorm: colleges, instructies Beoordeling: tentamen, opdracht
3
Colleges 15 stuks (max.) Overzicht van stof Details (m.n. algoritmes en wiskunde) Uitleg instructie-opgaven Vragen! Demo’s
4
Instructies Andrei Jalba en Stef van den Elzen Oefeningen en opdracht Vragen!
5
Tussentoets Halverwege (wordt nog bekend gemaakt) Tijdens instructie Toetsing & feedback beheersing stof 1 bonuspunt tentamen
6
Studiemateriaal Boek: Donald Hearn, M. Pauline Baker, Computer Graphics with OpenGL, 3rd edition, Pearson Prentice Hall, ISBN 0-13-0120238-3 (paperback). Studeerwijzer Sheets Oefeningen instructies www.win.tue.nl/~vanwijk/2IV10
7
College 1 Waarom computergrafiek?
8
Daarom! Leuk! Alomtegenwoordig Visueel systeem biedt: –Parallel input –Parallel processing Computergrafiek: ideaal voor mens- machine communicatie
9
Toepassingen Graphs and charts Computer-Aided Design Virtual Reality Data Visualization Education and training Computer Art Movies Games Graphical User Interfaces H&B 1:2-33
10
Business graphics H&B 1:2-33
11
Computer-Aided Design AutoDesk IAME 2-stroke race kart engine
12
Visualisatie H&B 1:2-33 Wetenschappelijke visualisatie Clip: Golden Age of Scientific Computing http://www.sci.utah.edu/
13
Gaming H&B 1:2-33
14
Serious gaming VSTEP Rotterdam www.vstep.nl
15
Animatie H&B 1:2-33 haar water onscherpte breuk expressie spiegeling beweging
16
Hardware Snelle ontwikkeling Historie: zie boek Nu: grafische kaart, LCD-scherm
17
Hardware 24 scherm configuratie, Virginia Tech Gigapixel display 50 LCD touchscreens
18
Toekomst? Head mounted displays? Parachute trainer US Navy
19
Toekomst? Oprolbaar scherm, Philips
20
Toekomst? Microsoft Surface
21
Schematisch Model Beeld af Beeld Gebruiker interactie
22
Model Computer Graphics Beeld Pattern Recognition Image Processing Ook…
23
Onderwerpen 1.Inleiding 2.2D basisalgoritmes 3.Transformaties 4.Viewing 5.Geometrisch modelleren 6.Zichtbare oppervlakken 7.Belichting 8.Interactie
24
Model Van model naar beeld H&B 2-8:69-71 WorldViewNDCDisplay Coördinaten en transformaties
25
Model Van model naar beeld H&B 2-8:69-71 WorldViewNDCDisplay Cylinder: Local or modeling coordinates Geometrisch modelleren
26
Model Van model naar beeld H&B 2-8:69-71 World ViewNDCDisplay Positioneer cylinders in scene: World coordinates
27
Model Van model naar beeld H&B 2-8:69-71 World View NDCDisplay Kijk naar cylinders: Viewing coordinates Zichtbare oppervlakken, belichting
28
Model Van model naar beeld H&B 2-8:69-71 WorldView NDC Display Beeld af: Normalized Device Coordinates 01 1
29
Model Van model naar beeld H&B 2-8:69-71 WorldViewNDC Display Beeld af op display: Device Coordinates 768 1024 0 Interactie
30
Twee smaken computergrafiek Vector graphics Beeld = verzameling lijnen, polygonen, cirkels,… Geometrisch model Exact, schaalbaar Raster graphics Beeld = rooster van beeldpunten (pixels) Display Realistische beelden,
31
Graphics software Special-purpose packages –Photoshop, Powerpoint, AutoCAD, StudioMax, Maya,… Computer-Graphics Application Programming Interfaces (CG API) –Windows API, OpenGL, VRML, Java3D, Direct3D,… H&B 2-8:69-73
32
CG API Set van graphics functies, te gebruiken vanuit programmeertaal Toegang en afschermen hardware Standaardisatie Display Drivers CG API Input dev. C, C++, Java, Delphi,… DisplayInput dev. Fortran, Pascal, … 1975 2000
33
Functies Graphics Output Primitives –Lijn, polygoon, bol, … Attributes –Kleur, lijndikte, textuur,… Geometric transformations –Modelling, Viewing Belichting Input functions H&B 2-8:69-73
34
Software standards GKS, PHIGS, PHIGS+ (1980-) GL (Graphics Library, SGI) OpenGL (early 1990s) Direct3D (MS), Java3D, VRML,… Excel, Mathematica, MatLab, … H&B 2-8:69-73
35
OpenGL 3D (en 2D) Snel Hardware, language, OS, company independent OpenGL architecture review board Breed ondersteund Low-level (right level!) Standaard graphics terminologie H&B 2-8:69-73
36
Performance… OpenGL is snel genoeg Afhankelijk van complexiteit scene Afhankelijk van gebruik van API Afhankelijk van hoeveelheid communicatie met kaart (bus is soms bottleneck) CPU Graphics card bus
37
Intro OpenGL Paar basisprincipes Geen tentamenstof Wel: opdracht
38
GLU en GLUT OpenGL: basisfuncties GLU(T): OpenGL Utility (Toolkit) libraries: –Koppeling met windowing system –Inputfuncties –Handige hulpfuncties voor viewing en geometrie –glutFunctie(); H&B 2-9:73-80
39
OpenGL syntax Functies: glFunctie: glBegin, glClear, glVertex Constanten: GL_CONSTANT: GL_2D, GL_LINE Datatypes: GLtype: GLbyte, GLint, GLfloat H&B 2-9:73-80
40
Voorbeeld glClearColor(1.0,1.0,1.0,0.0);// Achtergrondkleur glMatrixMode(GL_Projection); // Zet transformatie glLoadIdentity; gluOrtho2D(0, 200, 0, 150); glClear(GL_COLOR_BUFFER_BIT); // Wis achtergrond glColor3f(1.0, 0.0, 0.0); // Zet kleur glBegin(GL_LINES); // Teken lijn glVertex2i(180, 15); // - eerste punt glVertex2i(10, 145); // - tweede punt glEnd; // Klaar met lijn glFlush; // Verstuur H&B 2-9:80
41
OpenGL output functies glBegin(GL_iets); glVertex*(); … glEnd; glVertex[234][isfd] [234]: 2D, 3D, 4D [isfd]: integer, short, float, double Bijv: glVertex2i(100, 25); H&B 3-3:89
42
Output primitives 1 GL_POINTS: reeks punten GL_LINES: reeks lijnsegmenten GL_LINE_STRIP: polyline GL_RECT: rechthoek GL_POLYGON: polygoon H&B 3
43
Output primitives 2 GL_TRIANGLES: reeks driehoeken GL_TRIANGLE_STRIP: GL_TRIANGLE_FAN: H&B 3
44
Output primitives 3 GL_QUADS: reeks vierhoeken GL_QUAD_STRIP: H&B 3
45
Basis wiskunde voor CG Coördinaten Punten en vectoren H&B A-1
46
Coördinaten 2D Cartesische coördinaten: x y (x,y) y x Standaard Scherm (output, input) H&B A-1
47
Poolcoördinaten x y (x,y) H&B A-1 r
48
3D coördinaten 1 3D Cartesische coördinaten: x y (x,y,z) Rechtshandig Linkshandig H&B A-1 z x y (x,y,z) z
49
3D coördinaten 2 Cylindercoördinaten: x y (x,y,z) H&B A-1 z
50
3D coördinaten 3 Bolcoördinaten: x y (x,y,z) H&B A-1 z r
51
Punten en vectoren 1 Punt: positie in 2D of 3D ruimte Notatie: P (H&B), ook P, p, p en p (x,y,z) (H&B), ook (x 1, x 2, x 3 ), (P x, P y, P z ) Vector: Gericht lijnsegment, verschil tussen twee punten Notatie: V (H&B), ook V, v, v en v H&B A-2
52
Punten en vectoren 2 x y P2P2 P1P1 x1x1 x2x2 y2y2 y1y1 H&B A-2
53
Lengte van een vector: Punten en vectoren 3 H&B A-2
54
Richting van een vector: richtingshoeken. Ook: genormaliseerde vector, of eenheidsvector V Punten en vectoren 4 H&B A-2 x y z
55
Kop-staart methode, componentsgewijs optellen Vectoren optellen H&B A-2 x y x y V V W WV+W
56
Schalen, componentsgewijs vermenigvuldigen Scalar-vector vermenigvuldiging H&B A-2 x y x y V 2V2V
57
Inwendig product, scalair product ofwel dot product Product van parallelle componenten Vector vermenigvuldiging 1 H&B A-2 V W |W| cos |V|
58
Inwendig product: Vector vermenigvuldiging 2 H&B A-2
59
Uitwendig product, vector product ofwel cross product. n loodrecht op V en W Vector vermenigvuldiging 3 H&B A-2 V W n VWVW
60
Uitwendig product (makkelijker te onthouden): Vector vermenigvuldiging 4 H&B A-2
61
Uitwendig product: Vector vermenigvuldiging 5 H&B A-2
62
Inproduct: scalar vectoren loodrecht? cos projecteren,… Vector vermenigvuldiging 6 H&B A-2 Uitproduct: vector vector loodrecht op… sin oppervlak,…
63
Oefening 1 Gegeven een lijn L: L(t) = P + Vt. Gevraagd: Spiegel een punt Q ten opzichte van deze lijn.
64
Stappen bij dit soort opgaven Schrijf op wat je weet Reken het uit Controleer het resultaat
65
Oefening 2 Gegeven een driehoek in 3D met hoekpunten P, Q en R, waarbij de hoek PQR recht is. Gevraagd: Roteer de driehoek om de lijn PQ over een hoek Wat is de nieuwe positie R’ van R?
66
Gebruik: Niet: arccos, arcsin y=f(x) Wel: inproduct, uitproduct coördinaat onafhankelijke definities matrix vector algebra
Verwante presentaties
© 2024 SlidePlayer.nl Inc.
All rights reserved.