Meshes Dr. Scott Schaefer. 3D Surfaces Vertex Table.

Slides:



Advertisements
Similar presentations
Programming with OpenGL - Getting started - Hanyang University Han Jae-Hyek.
Advertisements

Chapter 11. Faster Geometry Throughput Presented by Garrett Yeh.
1Introduction A display list is a group of OpenGL commands that have been stored for later execution. Most OpenGL commands can be either stored in a display.
1Computer Graphics Building Models John Shearer Culture Lab – space 2
Vertex Buffer Objects, Vertex Array Objects, Pixel Buffer Objects.
©Zachary Wartell, UNCC9/28/ :30 AM 1 Overview of OpenGL Revision: 1.2 Copyright Professor Zachary Wartell, University of North Carolina All Rights.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Building Models modified by Ray Wisman Ed Angel Professor of Computer Science,
1 Building Models. 2 Objectives Introduce simple data structures for building polygonal models ­Vertex lists ­Edge lists OpenGL vertex arrays.
Status – Week 257 Victor Moya. Summary GPU interface. GPU interface. GPU state. GPU state. API/Driver State. API/Driver State. Driver/CPU Proxy. Driver/CPU.
OPENGL Return of the Survival Guide. Buffers (0,0) OpenGL holds the buffers in a coordinate system such that the origin is the lower left corner.
Computer Graphics Visible Surface Determination. Goal of Visible Surface Determination To draw only the surfaces (triangles) that are visible, given a.
 The success of GL lead to OpenGL (1992), a platform-independent API that was  Easy to use  Close enough to the hardware to get excellent performance.
Optimization of Mesh Locality for Transparent Vertex Caching Hugues Hoppe Microsoft Research SIGGRAPH 99 Hugues Hoppe Microsoft Research SIGGRAPH 99.
OBJ File Format 2005/10/03. CAIG Lab,NCTU2 OBJ File Format A text file format First character of each line specifies the type of command #: just some.
Drawing Geometric Objects
Computer Graphics Ben-Gurion University of the Negev Fall 2012.
Introduction to OpenGL Joseph Kider University of Pennsylvania CIS 565 – Fall 2011 (Source: Patrick Cozzi)
OpenGL Display Lists A way to improve performance.
CS CS 175 – Week 4 Triangle Mesh Smoothing Discrete Differential Geometry.
COMP Advanced Graphics Advanced Graphics: Performance.
04/09/02(c) University of Wisconsin, CS559 Last Time Texturing in OpenGL Texturing Options Project 2 is now available. Start as soon as you can. Homework.
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
INTRO TO COMPUTER GRAPHICS TEXT EDWARD ANGEL: EDITION 5 CS770/870
CSE 381 – Advanced Game Programming Basic 3D Graphics
4.7. I NSTANCING Introduction to geometry instancing.
Triangulation Introduction to Computer Graphics and Animation (Principle of Computer Graphics) Rattapoom Waranusast.
Texturing A picture is worth a thousand words. Texturing Texturing is the art of doing this with any picture to any model.  (This is Opus the Penguin.
Chris Kerkhoff Matthew Sullivan 10/16/2009.  Shaders are simple programs that describe the traits of either a vertex or a pixel.  Shaders replace a.
Speeding Up Rendering After Deciding What to Draw.
CS 450: COMPUTER GRAPHICS REVIEW: INTRODUCTION TO COMPUTER GRAPHICS – PART 2 SPRING 2015 DR. MICHAEL J. REALE.
Interactive Computer Graphics CS 418 – Spring 2015 Mesh Rendering, Transformation, Camera Viewing and Projection in OpenGL TA: Zhicheng Yan Sushma S Kini.
State Management and Drawing Geometry Objects
Object Representation Rama C Hoetzlein, 2010 Univ. of California Santa Barbara Lecture Notes.
1 Graphics CSCI 343, Fall 2015 Lecture 4 More on WebGL.
CG1 Labs Wei Li. Back Face Culling // enable back-face culling glEnable( GL_CULL_FACE ); // orientation of front-facing polygons glFrontFace( GL_CCW );
Representation. Objectives Introduce concepts such as dimension and basis Introduce coordinate systems for representing vectors spaces and frames for.
Homework Helpers. Content OFF files STL: vector, algorithm Model loaders: OBJ, 3DS.
Computer Graphics Bing-Yu Chen National Taiwan University.
MAE152 Computer Graphics for Scientists and Engineers Fall 03 Display Lists.
1 3D API OPENGL ES v1.0 Owned by Silicon Graphics (SGL) Control was then transferred to Khronos Group Introduction.
OpenGL Architecture Display List Polynomial Evaluator Per Vertex Operations & Primitive Assembly Rasterization Per Fragment Operations Frame Buffer Texture.
CS418 Computer Graphics John C. Hart
Maths & Technologies for Games Graphics Optimisation - Batching CO3303 Week 5.
Mesh Skinning Sébastien Dominé. Agenda Introduction to Mesh Skinning 2 matrix skinning 4 matrix skinning with lighting Complex skinning for character.
OpenGL Vertex Arrays OpenGL vertex arrays store vertex properties such as coordinates, normal vectors, color values and texture coordinates. These properties.
VAR/Fence: Using NV_vertex_array_range and NV_fence Cass Everitt.
Modeling So far in class: –We’ve looked at images and image manipulation –We’ve looked at rendering from polygons Next major section: –Modeling You may.
Computer Graphics I, Fall 2010 Building Models.
11/16/04© University of Wisconsin, CS559 Fall 2004 Last Time Texture Anti-Aliasing Texture boundaries Modeling introduction.
A study of efficiency INDEX BUFFERS JEFF CHASTINE 1.
11/12/02(c) University of Wisconsin, CS559 Last Time Texturing Details Homework 5.
OpenGL Objects Finalised. Debugging Tip For Debugging your applications remember: glGetError(); gluErrorString(); Don’t use these in release code (the.
OpenGL CS418 Computer Graphics John C. Hart. OpenGL Based on GL (graphics library) by Silicon Graphics Inc. (SGI) Advantages: Runs on everything, including.
COMP 175 | COMPUTER GRAPHICS Remco Chang1/XX13 – GLSL Lecture 13: OpenGL Shading Language (GLSL) COMP 175: Computer Graphics April 12, 2016.
UMBC GDC Programming Tutorial
Pushin’ Geo to the GPU As well as colors, normals, and other vertex data Made by Jeff Chastine, Modified by Chao Mei Jeff Chastine.
Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009
Scan Conversion of Polygons
Real-Time Rendering Buffers in OpenGL 3.3
Computer Graphics Index Buffers
Lecture 33: Shape Modeling Li Zhang Spring 2008
Building Models Ed Angel
Suggestive Contours with Geometry Shader
Chapter VI OpenGL ES and Shader
Isaac Gang University of Mary Hardin-Baylor
Chapter III Modeling.
Introduction to geometry instancing
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009
Computer Graphics Practical Lesson 8
Computer Graphics Vertex Array Object
Presentation transcript:

Meshes Dr. Scott Schaefer

3D Surfaces

Vertex Table

3D Surfaces Vertex Table Polygon Table

3D Surfaces Vertex Table Polygon Table

3D File Formats Way too many! OBJ STL MA PLY MAX, 3DS BLEND DAW LWO X ….

OBJ File Format (Simplified) Text Format – Easy to read! Line based file consisting of Vertices (starts with “v”) Faces (starts with “f”) Comments (starts with “#”)

OBJ File Format (Simplified) Vertex Definition “v x y z”: vertex with coordinates (x,y,z) “vt u v”: texture coordinates (u,v) “vn nx ny nz”: normal (nx,ny,nz)

OBJ File Format (Simplified) Face Definition “f g1/t1/n1 g2/t2/n2 …” Faces may be variable length! Indexing starts at 1… not 0! First index is guarantee to be geometry index ti, ni are optional

OBJ File Format – Example # This is a comment v v v v f f f f 2 3 4

OBJ File Format – Example # This is a comment v v v v vn vn vn vn f 1//2 2//1 3//3 f 1//2 3//3 4//4 f 1//2 4//4 2//1 f 2//1 3//3 4//4

OBJ File Format – Complications Vertices may appear after faces Faces may not be triangles (must triangulate) Faces may use negative indexing

3D File Formats Vertices may appear after faces Faces may not be triangles (must triangulate) Faces may use negative indexing Not all OBJ files conform to the OBJ standard

Drawing 3D Objects with OpenGL Immediate Mode Display Lists Vertex Arrays Vertex Buffer Objects

Immediate Mode glBegin ( GL_TRIANGLES ); glNormal3f ( nx1, ny1, nz1 ); glVertex3f ( x1, y1, z1 ); glNormal3f ( nx2, ny2, nz2 ); glVertex3f ( x2, y2, z2 ); … glEnd ( );

Immediate Mode Advantages Easy to send a few polygons to OpenGL Disadvantages Lots of data transferred on the stack Lots of function calls Vertices duplicated many times Really, really slow

Display Lists Initialize display list firstList = glGenLists ( numLists ); glNewList ( firstList, GL_COMPILE_AND_EXECUTE ); // draw model in immediate mode glEndList ( ); Draw the display list glCallList ( firstList );

Display Lists Relies on graphics driver for optimization Advantages Faster than immediate mode Disadvantages Still not great performance

Vertex Arrays glEnableClientState ( GL_(VERTEX/TEXTURE_COORD/NORMAL)_ARRAY ); glVertexPointer ( numComp, GL_FLOAT, bytes to next vertex, pointer to geometry) glTexCoordPointer ( numComp, GL_FLOAT, bytes to next texture coord, pointer to texture coords) glNormalPointer ( GL_FLOAT, bytes to next normal, pointer to normals ) glDrawElements ( GL_TRIANGLES, number of indices in array, GL_UNSIGNED_INT, pointer to index array) glDisableClientState ( GL_(VERTEX/TEXTURE_COORD/NORMAL)_ARRAY )

Vertex Arrays Advantages Only transfers vertices once and not an expected value of 6 times Much faster than even display lists Format similar to most mesh formats Disadvantages Still transfers vertices to GPU every frame Bandwidth to GPU very problematic

Vertex Buffer Objects New Functions glGenBuffersARB glBindBufferARB glBufferDataARB Use glVertexPointer… with NULL pointer as argument Use glDrawElements with NULL pointer as argument

Vertex Buffer Objects Advantages Can store data directly in video memory or AGP Greatly reduces bandwidth problem to GPU Disadvantages Not supported by MS OpenGL headers Must load function pointers out of DLL using WGLGetProcAddress Dynamic geometry does get as much benefit

Performance Nvidia 7300 GTNvidia 8800 GTX Immediate Mode15.5 Display Lists Vertex Arrays Vertex Buffer Objects Frames per second displaying a 413,236 triangle model. CPU was an Intel Core