3D Modeling. 3D Modeling 1

Similar documents
CS475/CS675 - Computer Graphics. OpenGL Drawing

Building Models. Prof. George Wolberg Dept. of Computer Science City College of New York

Building Models. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Computer Graphics CS 543 Lecture 4 (Part 2) Building 3D Models (Part 2)

3D Graphics and OpenGl. First Steps

Comp 410/510 Computer Graphics Spring Programming with OpenGL Part 2: First Program

Programming with OpenGL Shaders I. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico

Computer Graphics (CS 543) Lecture 4a: Linear Algebra for Graphics (Points, Scalars, Vectors)

Copyright Khronos Group 2012 Page 1. Teaching GL. Dave Shreiner Director, Graphics and GPU Computing, ARM 1 December 2012

CS 432 Interactive Computer Graphics

OpenGL pipeline Evolution and OpenGL Shading Language (GLSL) Part 2/3 Vertex and Fragment Shaders

CS 432 Interactive Computer Graphics

Programming with OpenGL Shaders I. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico

Rendering Objects. Need to transform all geometry then

Today s Agenda. Basic design of a graphics system. Introduction to OpenGL

Lecture 12: Mid-term test solution & project. CITS 3003 Graphics & Animation

ECE 104 Fundamentals of Computer Graphics Project 1

Announcement. Homework 1 has been posted in dropbox and course website. Due: 1:15 pm, Monday, September 12

2: Introducing image synthesis. Some orientation how did we get here? Graphics system architecture Overview of OpenGL / GLU / GLUT

Shader Series Primer: Fundamentals of the Programmable Pipeline in XNA Game Studio Express

CS451Real-time Rendering Pipeline

Graphics Programming. Computer Graphics, VT 2016 Lecture 2, Chapter 2. Fredrik Nysjö Centre for Image analysis Uppsala University

CS130 : Computer Graphics. Tamar Shinar Computer Science & Engineering UC Riverside

CS 543 Lecture 1 (Part 3) Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Simplified Mesh Generation from Renders. Thorvald Natvig

Content. Building Geometry Appearance Lights Model Loaders

Lecture 5 Vertex and Fragment Shaders-1. CITS3003 Graphics & Animation

Computer Graphics (CS 543) Lecture 1 (Part 2): Introduction to OpenGL/GLUT (Part 1)

CS230 : Computer Graphics Lecture 4. Tamar Shinar Computer Science & Engineering UC Riverside

Programming with OpenGL Part 3: Shaders. Ed Angel Professor of Emeritus of Computer Science University of New Mexico

Computer Graphics (CS 4731) OpenGL/GLUT (Part 2)

Computer Graphics (CS 543) Lecture 1 (Part 1): Introduction to Computer Graphics

Tutorial 04. Harshavardhan Kode. September 14, 2015

CSE 167: Introduction to Computer Graphics Lecture #7: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016

CS 432 Interactive Computer Graphics

OUTLINE. Learn the basic design of a graphics system Introduce pipeline architecture Examine software components for a graphics system

8 Three-Dimensional Object Representations. Chapter 8. Three-Dimensional Object Representations. Department of Computer Science and Engineering 8-1

Rasterization Overview

Teacher Assistant : Tamir Grossinger Reception hours: by - Building 37 / office -102 Assignments: 4 programing using

Introductory Seminar

API Background. Prof. George Wolberg Dept. of Computer Science City College of New York

Parametric description

CIS 581 Interactive Computer Graphics

Information Coding / Computer Graphics, ISY, LiTH. OpenGL! ! where it fits!! what it contains!! how you work with it 11(40)

Advanced Lighting Techniques Due: Monday November 2 at 10pm

GPU Programming EE Final Examination

Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation

CS452/552; EE465/505. Review & Examples

The Projection Matrix

CS452/552; EE465/505. Models & Viewing

ERKELEY DAVIS IRVINE LOS ANGELES RIVERSIDE SAN DIEGO SAN FRANCISCO EECS 104. Fundamentals of Computer Graphics. OpenGL

the gamedesigninitiative at cornell university Lecture 17 Color and Textures

CS452/552; EE465/505. Image Processing Frame Buffer Objects

CS 380 Introduction to Computer Graphics. LAB (1) : OpenGL Tutorial Reference : Foundations of 3D Computer Graphics, Steven J.

Spring 2011 Prof. Hyesoon Kim

Today s Agenda. Shaders fundamentals. Programming with shader-based OpenGL

CS130 : Computer Graphics Lecture 2: Graphics Pipeline. Tamar Shinar Computer Science & Engineering UC Riverside

Graphics Programming

Scalar Field Visualization I

To Do. Computer Graphics (Fall 2008) Course Outline. Course Outline. Methodology for Lecture. Demo: Surreal (HW 3)

CS452/552; EE465/505. Clipping & Scan Conversion

GPU Programming EE Final Examination

How shapes are represented in 3D Graphics. Aims and objectives By the end of the lecture you will be able to describe

OpenGL: Open Graphics Library. Introduction to OpenGL Part II. How do I render a geometric primitive? What is OpenGL

Computer Graphics CS 543 Lecture 1 (Part I) Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Comp 410/510 Computer Graphics Spring Programming with OpenGL Part 4: Three Dimensions

Applying Textures. Lecture 27. Robb T. Koether. Hampden-Sydney College. Fri, Nov 3, 2017

EDAF80 Introduction to Computer Graphics. Seminar 3. Shaders. Michael Doggett. Slides by Carl Johan Gribel,

Objectives Shading in OpenGL. Front and Back Faces. OpenGL shading. Introduce the OpenGL shading methods. Discuss polygonal shading

Building Models. Objectives Introduce simple data structures for building polygonal models. Vertex lists Edge lists

The Graphics Pipeline

CS 130 Exam I. Fall 2015

Spring 2009 Prof. Hyesoon Kim

Pipeline Operations. CS 4620 Lecture 14

6.837 Introduction to Computer Graphics Final Exam Tuesday, December 20, :05-12pm Two hand-written sheet of notes (4 pages) allowed 1 SSD [ /17]

CS452/552; EE465/505. Image Formation

Three Main Themes of Computer Graphics

GPU Programming EE Final Examination

Procedural modeling and shadow mapping. Computer Graphics CSE 167 Lecture 15

INTRODUCTION TO OPENGL PIPELINE

object (say a cube) will be made up of triangles, each with three vertices, each with known object coordinates.

We will use WebGL 1.0. WebGL 2.0 is now being supported by most browsers but requires a better GPU so may not run on older computers or on most cell

CPSC 436D Video Game Programming

The Graphics Pipeline

Geometry Primitives. Computer Science Department University of Malta. Sandro Spina Computer Graphics and Simulation Group. CGSG Geometry Primitives

DEFERRED RENDERING STEFAN MÜLLER ARISONA, ETH ZURICH SMA/

Computer graphic -- Programming with OpenGL I

Ciril Bohak. - INTRODUCTION TO WEBGL

Hands-On Workshop: 3D Automotive Graphics on Connected Radios Using Rayleigh and OpenGL ES 2.0

CSE 167. Discussion 03 ft. Glynn 10/16/2017

to OpenGL Introduction Pipeline Graphics pipeline OpenGL pipeline OpenGL syntax Modeling Arrays Conclusion 1 Introduction Introduction to OpenGL

CSE 167: Introduction to Computer Graphics Lecture #19: Wrapping Up. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017

Advanced Graphics

OpenGL with Qt 5. Qt Developer Days, Berlin Presented by Sean Harmer. Produced by Klarälvdalens Datakonsult AB

Mali Developer Resources. Kevin Ho ARM Taiwan FAE

GLSL Overview: Creating a Program

Computer Graphics. Bing-Yu Chen National Taiwan University

Texture Mapping. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Models and Architectures. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

Transcription:

3D Modeling 3D Modeling 1 Virtual enviroments can be populated with "models" as well as regular geometries (glut shapes, glu quadrics, gl primitives). Models are: collections of primitives often in a display list or file have colors, materials, or textures can have transforms ("bones") Hand (artist) generated models made with 3D software (Maya, 3D Studio, Lightwave, Blender, AC3D, Goggle sketchup,...) + wysiswug? easy to use, but opengl needs a loader utility - time intensive, needs artistic skill Procedurally generated (TerraGen,...) + parameterized, extendable - know grammars, programming

Using 3D Modelers 3D Modeling 2 When using a "hand" 3D modeler you need to know how the OpenGL model loader works before drawing your model. AC3D 6.1 installed in JD 1618 and GMC Lab Model surfaces not vertices : flat shading surface color material Set surface triangulation 3 orthographic views 1 3D view Use colors not textures for the assignment model.

AC3D 3D Modeler Placing your mouse over items presents a tooltip help. 1 3 3D Modeling 3 [1] shows the selection modes: group (many objects), object, surface, pixel. You probably want to [2] deselect select through. [3] shows where the mouse position and 2 selected objects dimension are shown There is a good tutorial off the AC3D site: http://www.inivis.com/ac3d/tutorials/

Spaceship should be facing towards -Z Surface 3D Modeling 4 Before exporting triangulate your surfaces (Menu Surface triangulate). Select all objects and optimize (Menu Object Optimize vertices and Optimize surfaces). Models for 465 project should have the origin at their center and fit within the boundaries of geometrical spaceship ( ± 100 on X, Y, Z)

trimodel465.hpp 3D Modeling 5 Export ac3d model as triangle file. *.tri (cube.tri) 9 vertices and hex color value (no texture) loadtrimodel(...) method will read a *.tri file and create vertex[], color[], and normal[] arrays. See the example project TriModelVierwer for an example on how to load a *.tri model and display it in OpenGL. Uses cube-1-1-1.tri You need to know the number of lines in the *.tri file (use text editor) If some of the surfaces appear black (and shouldn't be black) you have a normal going in the wrong direction. Return to AC3D (the *.ac) file, select the surface and correct the normal's direction (Menu Surface Flip normal). Export to *.tri and re-examine.

load many *.tri models w/ trimodel465.hpp 3D Modeling 6 cube.tri model has 12 lines, each has 3 vertices and a color (hex coded) 0.5 0.5-0.5-0.5-0.5-0.5-0.5 0.5-0.5 0xFFFFFF Each line is a triangular surface. There are 36 vertices in this model. The utility trimodel465.hpp has 2 methods float loadtrimodel(char * filename, int nvertices, glm::vec4 vertex[], glm::vec4 color[], glm::vec3 normal[]) float loadmodelbuffer(char modelfile[25], GLuint nvertices, GLuint vao, GLuint vbo, GLuint shaderprogram, GLuint vposition, GLuint vcolor, GLuint vnormal, char * shadervertex, char * shadercolor, char * shadernormal)

loadmodelbuffer(...) 3D Modeling 7 ManyModelsStatic.cpp uses loadmodelbuffer (...) method and scales its models based on the returned bounding sphere. for (int i = 0; i < nmodels; i++) { modelbr[i] = loadmodelbuffer(modelfile[i], nvertices[i], VAO[i], buffer[i], shaderprogram, vposition[i], vcolor[i], vnormal[i], "vposition", "vcolor", "vnormal"); // set scale for models given bounding radius scale[i] = glm::vec3( modelsize[i] * 1.0f/modelBR[i]); } Declared un-initialized arrays (VAO, buffer, vposition, vcolor, vnormal) are passed in and set by the utility. For each model a VerterArrayObject is created and bound to the buffers holding its vertices (vposition[i]), colors, and normal. These buffers are set to the shader programs in variables ("vposition"). loadtrimodel(...) is called first to read the vertices and colors and to compute normal for the surfaces (modelfile[i]).

Using other modelers 3D Modeling 8 You can use other 3D modelers I do not have experience with many... To use the trimodel465.hpp loader you should: model only with color materials. Do not use textures! export as *.3ds (3D Studio Max format). Use AC3D (in lab) to import your *.3ds model and export it as a triangle model (*.tri). You can use other 3D modelers w/o using trimodel465.hpp loader. You will have to write the equivalent functionality of trimodel 465.hpp Some OpenGL model loaders you might find on the internet are not "core" OpenGL compatible. Your models can't be drawn in C code, they must be stored on the GPU as vertices, normals, and colors. This way you can use the simplevertex.glsl and simplefragment.glsl shaders for the first 2 assignments.

3D Modeling 9 Free 3D modeler Blender high learning curve Free educational version for students, create an account, can install on 2 personal systems. 3D Studio Max a simpler 3D modeler, like AC3D Maya high learning cure Assimp-3.2 an open source asset importer can be used within C/C++ programs to load many model formats. Use is non-trivial.

pyramid example 3D Modeling 10 glm::vec4 const vertex_positions[5] = { glm::vec4( -5.0f, -8.0f, 5.0f, 1.0f ), // 0 front left bottom glm::vec4( 5.0f, -8.0f, 5.0f, 1.0f ), // 1 front right bottom glm::vec4( 5.0f, -8.0f, -5.0f, 1.0f ), // 2 back right bottom glm::vec4( -5.0f, -8.0f, -5.0f, 1.0f ), // 3 back left bottom glm::vec4( 0.0f, 8.0f, 0.0f, 1.0f ), // 4 apex }; // RGBA colors for each vertex glm::vec4 const vertex_color[5] = { glm::vec4( 1.0f, 0.0f, 0.0f, 1.0f ), // 0, red glm::vec4( 0.0f, 1.0f, 0.0f, 1.0f ), // 1, green glm::vec4( 0.0f, 0.0f, 1.0f, 1.0f ), // 2, blue glm::vec4( 0.8f, 0.8f, 0.8f, 1.0f ), // 3, light gray glm::vec4( 0.8f, 0.8f, 0.8f, 1.0f ) // 4, light gray views: front right top 3 2 4 0 1

Model in code 3D Modeling 11 The pyramid.cpp example demonstrates how to create a "model" in code not loaded from a model file. Similar to Angel & Shreiner's example. Each model consists of vertices that have a vec4 position and color. These vertices will be stored in the currently bound GL_ARRAY_BUFFER (buffer) on the GPU. The points are stored first followed by the colors. This pyramid has 18 vertices (point[numvertices]): 2 triangular surfaces on the bottom (6) and 4 triangular sides (12). Since vertices are shared by surfaces we define 5 vertices (4 at bottom, 1 at top) in vertex_position[]. (see previous page, colors also) The init() method calls pyramid() that calls triangle(a, b, c) 6 times to set the point[] of vertices. Method triangle's 3 arguments are "indexes" into vertex_position[]. The indexes references vertices define edges in a counter-clockwise direction from looking at the outside of the pyramid at the surface.

3D Point Cloud A point cloud is a set of vertices that represent an object's surface. Point clouds are most often created by 3D scanners. Often converted to 3D surface geometry. 3D Modeling 12 Point_cloud_torus.gif "laser image", LA SIGGRAPH 2012 image captured by 3D3 solutions, http://www.3d3solutions.com/ display program: CloudCompare V2 http://www.danielgm.net/cc License: GNU GPL (General Public Licence) Version: 2.4.Qt/MSVC - 09/22/2012