3D Representation Pipeline.

Uploaded on:
Category: Travel / Places
3D Design Pipeline WORLD SCENE/OBJECT Demonstrating organizes: - world direction framework, - object coordinate framework 3D Displaying Seeing 3D Cutting Camera arranges PROJECTION Screen/Window facilitates RASTERIZATION Gadget organizes 2D PIXELMAP Show Object Displaying
Slide 1

3D Graphics Pipeline WORLD SCENE/OBJECT Modeling directions: - world direction framework, - item organize framework 3D Modeling VIEWING 3D CLIPPING Camera facilitates PROJECTION Screen/Window arranges RASTERIZATION Device facilitates 2D PIXELMAP DISPLAY

Slide 2

Object Modeling (N.B. not a comprehensive rundown) B-rep Parametric surface Implict surface Polygon Mesh CSG Tree Voxels Octree

Slide 3

Modeling Transformations Translation Rotation Scaling

Slide 4

3D Viewing A.K.A. Camera Transformation

Slide 5

Clipping 3D view frustrum outside perspective so must be cut

Slide 6

Projection Parallel Projections viewport 3d models Perspective Projections

Slide 7


Slide 8

OpenGL ® and GLUT

Slide 9

The OpenGL ® API http://www.opengl.org

Slide 10

OpenGL ® cross-stage standard for 3D rendering and 3D equipment increasing speed. programming runtime library ships with all Windows, MacOS, Linux and Unix frameworks most PCs nowadays will accompany some level of 3D speeding up – OpenGL proposed for utilization with PC equipment that is composed and improved for 3d illustrations and permits you to make utilization of these capacities “a programming interface to representation hardware” a library for 3d design and demonstrating versatile and quick

Slide 11

Overview OpenGL is a procedural representation API: software engineer depicts the strides included to accomplish a sure show “steps” include C style capacity calls to a profoundly convenient API genuinely direct control over crucial operations of two and three dimensional illustrations Intuitive naming tradition and default setup make it a generally simple API to learn OpenGL has been around for a couple of years (1992) … long time in illustrations equipment terms trailblazer: GL from Silicon Graphics IrisGL - a 3D API for top of the line IRIS design workstations

Slide 12

The OpenGL ® Standard an API not a dialect Some different design bundles include: GKS (ISO & ANSI affirmed standard), PHIGS (standard), PEX, GL/IrisGL, Renderman (API & Language), PostScript, BGI (Borland Graphics Interface), Renderware, DirectX! OpenGL endeavors to be more compact OpenGL Architecture Review Board (ARB) settles on all improvements

Slide 13

What would it be able to do ? Show primitives Coordinate changes (change lattice control) Texture and Lighting figurings Antialiasing Pixel Update Operations Display-Lists … and generally much quicker than you can!

Slide 14

OpenGL ® Pipeline Transform Geometry Clip to View Volume Project to Viewport Rasterise vertices pixels perform per-vertex pivots interpretations and scaling to accomplish last geometry, then change to the camera co-ordinate framework venture vertices onto the 2D plane speaking to the viewport/screen change over all polygons, line and point to pixel qualities dispose of vertices that won\'t be noticeable in the last picture OpenGL capacities like a state machine

Slide 15

v 4 v 4 v 4 v 4 v 3 v 3 v 3 v 3 v 5 v 5 v 5 v 5 v 2 v 2 v 2 v 2 v 6 v 6 v 6 v 6 v 1 v 1 v 1 v 1 v 7 v 7 v 7 v 7 v 8 v 8 v 8 v 8 Modeling in OpenGL ® All geometric articles in OpenGL are made from an arrangement of essential point based primitives. Certain primitives are given to permit enhancement of geometry for enhanced rendering pace. Line based primitives: GL_LINE_LOOP GL_LINE_STRIP GL_LINES GL_POINTS

Slide 16

v 3 v 3 v 3 v 5 v 5 v 5 v 2 v 2 v 2 v 6 v 6 v 6 v 1 v 1 v 1 v 7 v 7 v 7 v 8 v 8 v 8 OpenGL ® Primitives Polygon primitives v 4 v 4 v 4 GL_POLYGON GL_QUADS GL_TRIANGLES v 4 v 3 v 8 v 2 v 4 v 5 v 6 v 3 v 2 v 5 v 2 v 1 v 4 v 1 v 6 v 3 v 5 v 7 v 1 GL_QUAD_STRIP GL_TRIANGLE_STRIP GL_TRIANGLE_FAN

Slide 17

OpenGL ® Primitives are pronounced after the state machine theory. Case: glBegin(GL_QUADS); glVertex3d(1.0, 1.0, 0.0); glVertex3d(- 1.0, 1.0, 0.0); glVertex3d(- 1.0, - 1.0, 0.0); glVertex3f(1.0, - 1.0, 0.0); glEnd();

Slide 18

OpenGL ® Lighting and Texturing The lighting, shading and texturing of primitives additionally work by state alteration. Illustration: glColor3f(1.0, 0.0, 0.0); glBegin(GL_TRIANGLES); glVertex3d(1.0, 1.0, 0.0); glVertex3d(1.0, - 1.0, 0.0); glVertex3f(- 1.0, - 1.0, 0.0); glEnd(); glEnable ( GL_LIGHTING ); glEnable ( GL_LIGHT0 ); glBegin(GL_TRIANGLES); glVertex3d(1.0, 1.0, 0.0); glVertex3d(- 1.0, - 1.0, 0.0); glVertex3d(- 1.0, 1.0, 0.0); glEnd();

Slide 19

Transformations and OpenGL ® Vertex Geometry Pipeline MODELVIEW network PROJECTION grid viewpoint division viewport change unique vertex last window directions standardized gadget directions (foreshortened) 2d projection of vertex onto survey plane vertex in the eye direction space

Slide 20

Transformations and OpenGL ® OpenGL characterizes 3 lattices for control of 3D scenes: GL_MODELVIEW : controls the perspective and models all the while GL_PROJECTION : performs 3D to 2D projection for presentation GL_TEXTURE : for controlling compositions preceding mapping on articles Each goes about as a state parameter; once set it stays until adjusted. Having characterized a GL_MODELVIEW grid, all consequent vertices are made with the predetermined change. Network change operations apply to the right now chose framework grid: use glMatrixMode(GL_MODELVIEW) to choose displaying lattice The Matrices are composed in stacks, for every stack, the framework discribing the present change is the one at the top glPopMatrix() and glPushMatrix() control the present stack

Slide 21

Transformations and OpenGL glRotatef(angle, vx, vy, vz) turns about hub (vx, vy, vz) by point (indicated in degrees) glTranslatef(dx, dy, dz) interprets by dislodging vector (dx, dy, dz) glScalef(sx, sy, sz) apply scaling of sx in x course, sy in y heading and sz in z bearing (note that these qualities determine the inclining of an obliged network) glLoadIdentity() makes a character grid (utilized for clearing all changes) glLoadMatrixf(matrixptr) loads a client determined change grid where matrixptr is characterized as GLfloat matrixptr[16]; glMultMatrixf(matrixptr) duplicate current grid with client determined lattice

Slide 22

Transformations and OpenGL ® Each time an OpenGL change M is known as the lattice C at the highest point of the present stack is modified: M glTranslatef(1.5, 0.0, 0.0); glRotatef(45.0, 0.0, 0.0, 1.0);

Slide 23

Transformations and OpenGL ® The MODELVIEW lattice is a 4x4 relative change lattice and consequently has 12 degrees of opportunity : The MODELVIEW lattice is utilized for both the model and the camera change pivoting the model is proportionate to turning the camera the other way  OpenGL utilizes the same change grid this occasionally causes disarray!

Slide 24

Scale all vectors are scaled from the cause: Original scale all tomahawks scale Y hub balance from starting point separation from root additionally scales

Slide 25

Rotation Rotations are hostile to clockwise about the birthplace: revolution of 45 o about the Z pivot balance from inception turn

Slide 26

Translation interpretation along y

Slide 27

Transformations and OpenGL ® Transformations are connected in the request determined (as for the vertex) which seems, by all accounts, to be backward: glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(1.5, 0.0, 0.0); glRotatef(45.0, 0.0, 0.0, 1.0); glVertex3f(1.0, 0.0, 0.0); unique turn decipher

Slide 28

Relevant Libraries OpenGL has no windowing elements its could call its own We have to utilize something like the GLUT libraries for windowing operations and so on. OpenGL Window System C/C++ Code Graphics Hardware GLU OpenGL Application GLUT C/C++ Libraries

Slide 29

Relevant Libraries The GL library center elements of OpenGL e.g. displaying, review, section, lighting The GL Utility (GLU) library: making of normal articles (e.g. circles, quadrics) particular of standard perspectives (e.g. point of view, orthographic) The GL Utility Toolkit (GLUT) furnishes the interface with the windowing framework. window administration, menus, mouse association

Slide 30

The OpenGL Utility Toolkit OpenGL has no window framework interface its could call its own GLUT is a programming interface for composing windows framework free OpenGL programs Implementations of the GLUT API exist for most mainstream stages Alternatives are local window frameworks APIs e.g. Xlib, Motif, Win32, tk, aux GLUT is much less difficult, yet less capable GLUT is not a standard\'s piece OpenGL dispersion

Slide 31

GLUT support - Multiple windows for OpenGL rendering - Callback driven occasion handling - Sophisticated info gadgets - An "unmoving" routine and clocks - A straightforward, falling pop-up menu office - Utility schedules to create different strong and wire edge objects - Support for bitmap and stroke text styles - Miscellaneous window administration capacities

Slide 32

OpenGL ® GLUT Event Loop User Expose Mouse Key Windows System Resize Event List Operating System Application while (TRUE) e = get_next_event(); switch (e) case MOUSE: call register MouseFunc case Resize call enlisted ResizeFunc ... glutMainLoop() =

Slide 33

Simple GLUT Program int principle() { glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutCreateWindow(“First GLUT program”); init(); glutDisplayFunc(myDisplay); glutMainLoop(); return 0; } Set up GLUT with RGB mode and single cushion Create a GLUT window – this obliges that you determine a showcase callback with glutDisplayFunc glutMainLoop begins the GLUT occasion handler exchanges control of the project to GLUT

Slide 34

Simple GLUT Program: the presentation callback void presentation() { glClear (GL_COLOR_BUFFER_BIT); glColor3f(1.0, 1.0, 1.0); glBegin(GL_QUADS); glVertex3d(1.0, 1.0, 0.0); glVertex3d(- 1.0, 1.0, 0.0); glVertex3d(- 1.0,

View more...