Due: Thursday, April 28 th by the stroke of midnight! TA: Jeff Booth.

Slides:



Advertisements
Similar presentations
Today Composing transformations 3D Transformations
Advertisements

Working with Profiles in IX1D v 3 – A Tutorial © 2006 Interpex Limited All rights reserved Version 1.0.
Computer Graphics 2D & 3D Transformation.
CSE 457 Modeler Help Session Lovingly brought to you by: TA Steve.
Using GLU/GLUT Objects GLU/GLUT provides very simple object primitives glutWireCube glutWireCone gluCylinder glutWireTeapot.
SE 313 – Computer Graphics Lecture 13: Lighting and Materials Practice Lecturer: Gazihan Alankuş 1.
Lab 1: OpenGL Tutorial CS 282. What’s the plan for today? Go over our framework code. Learn some basic OpenGL! Reveal Lab 1 Answer questions.
, Fall 2006IAT 800 Lab 2: Polygons, Transformations, and Arrays.
Modeler Help Session CSE 457, Spring 2006 Modeler Due: Thursday, October 26th Modeler Artifact Due: Monday, Oct. 30th Project TA: Sierra
Modeler Help Session CSE 457, Fall 2005 Modeler Due: Oct 28, Friday Modeler Artifact Due: Oct 31, Monday Project TA: Jeremy
OpenGL (II). How to Draw a 3-D object on Screen?
Computer Graphics (Fall 2004) COMS 4160, Lecture 3: Transformations 1
3D Rendering with JOGL Introduction to Java OpenGL Graphic Library By Ricardo Veguilla
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology 3D Engines and Scene Graphs Spring 2012.
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
Modeling and Animation with 3DS MAX R 3.1 Graphics Lab. Korea Univ. Reference URL :
COMP 175: Computer Graphics March 10, 2015
Mouse-Based Viewing & Navigation Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, November 3, 2003.
EEC-693/793 Applied Computer Vision with Depth Cameras Lecture 13 Wenbing Zhao
Week 2 - Wednesday CS361.
Image Synthesis Rabie A. Ramadan, PhD 2. 2 Java OpenGL Using JOGL: Using JOGL: Wiki: You can download JOGL from.
Hank Childs, University of Oregon
COMP 175 | COMPUTER GRAPHICS Remco Chang1/ Introduction Lecture 01: Introduction COMP 175: Computer Graphics January 15, 2015.
Homogeneous Form, Introduction to 3-D Graphics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 20,
Shadows via Projection Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Wednesday, November 5, 2003.
Modeler Help Session CSEP 557, Spring Help Session Overview The Modeler Application Modeler Code Overview Constructing Your Model Hierarchical Modeling.
 Checking out, building, and using the sample solution  Part 1: Surface of Revolution  Part 2: Hierarchical Modeling  Part 3: Blinn-Phong Shader 
Learning Unity. Getting Unity
Modeling with OpenGL Practice with OpenGL transformations.
OpenGL: Introduction Yanci Zhang Game Programming Practice.
Computer Science Term 1, 2006 Tutorial 2 Assignment 3 – The Virtual World.
Design Studies 20 ‘Show Off’ Project How to make a computer monitor In Google Sketchup By: Liam Jack.
Image Synthesis Rabie A. Ramadan, PhD 4. 2 Review Questions Q1: What are the two principal tasks required to create an image of a three-dimensional scene?
Animator Help Session. Surface of Revolution You will write OpenGL code to draw a surface by rotating a curve. Each vertex must have an appropriate: 
Advanced Viewing Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, October 31, 2003.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
1 Graphics CSCI 343, Fall 2015 Lecture 3 Introduction to WebGL.
Learning PowerPoint Presenting your ideas as a slide show… …on the computer!
Computer Graphics Matrices
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
 Advancing from moving premade primitives to making our own models  Two different approaches: ◦ Direct mesh editing: A more traditional approach commonly.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 15 Creating 3D Models.
Honors Geometry.  We learned how to set up a polygon / vertex matrix  We learned how to add matrices  We learned how to multiply matrices.
Computation as an Expressive Medium Lab 2: Polygons, Transformations, and Arrays (Oh My) Micah.
OpenGL and You I Cast, Therefore I Am. Ray Casting Idea is simple, implementation takes some work –Cast rays as if you were the camera –Determine intersection.
1 Geometric Transformations-II Modelling Transforms By Dr.Ureerat Suksawatchon.
Some Notes on 3-D Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, October 24, 2003.
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
GLSL Review Monday, Nov OpenGL pipeline Command Stream Vertex Processing Geometry processing Rasterization Fragment processing Fragment Ops/Blending.
Introduction to 3-D Viewing Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 27, 2003.
EEC-693/793 Applied Computer Vision with Depth Cameras
Hank Childs, University of Oregon
EEC-693/793 Applied Computer Vision with Depth Cameras
Polygons, Transformations, and Arrays
Introducing Blender.
Introducing Blender.
EEC-693/793 Applied Computer Vision with Depth Cameras
Introducing Blender.
Chapter 4/5 glMatrixMode Modeling Transformations glTranslate glScale
Modeler Help Session CSE 457, Autumn 2008
Projection in 3-D Glenn G. Chappell
Modeler Help Session CSE 457, Spring 2006
Modeler Help Session CSE 457, Spring 2005
More on Widgets, Misc. Topics
Modeler Help Session CSE 457, Autumn 2007
Modeler Help Session CSE 457, Spring 2008
Modeler Code Basics CSE P 557, Autumn 2006
EEC-693/793 Applied Computer Vision with Depth Cameras
Modeler Help Session CSE 457, Spring 2007
Prepared by your friendly, phantom TA Jennifer
Presentation transcript:

Due: Thursday, April 28 th by the stroke of midnight! TA: Jeff Booth

 Checking out, building, and using the sample solution  Part 1: Rendering a Sphere  Part 2: Hierarchical Modeling  Part 3: gluLookAt()  Part 4: Blinn-Phong Shader  Part 5: Custom Shader

 Go to the Modeler course page for detailed check-out directions.  Repository path:  svn+ssh://Your CSE p/cse457/modeler/Your Group ID/source

 Go to your project folder  Double-click the.vcxproj file  Configuration menu next to green arrow  Debug – lets you set breakpoints  Release – for turn-in  Pick Debug, then click the green arrow next to it to build and run your project  Let us know if it doesn’t build!

List of Controls Control Groups View of your model Move the camera by dragging the mouse while holding down: Left button: rotate the view like a huge trackball. Right button (or left button + CTRL): zoom in/out Middle button (or left button + SHIFT): pan

 Partner A: Modeling  Part 1: Hierarchical Modeling  Part 2: Custom Primitive  Either Partner:  Part 3: gluLookAt()  Partner B: Shading  Part 4: Blinn-Phong Shader  Part 5: Custom Shader  NOTE: this division of labor is just a suggestion!

 You will write OpenGL code to draw a sphere.  Each vertex must have an appropriate:  Texture coordinate pair  Vertex normal  Position  Replace code for drawSphere() in modelerdraw.cpp  The divisions variable determines number of slices

 Determine (x,y,z) coordinates of each point using sphere radius, latitude θ and longitude ɸ  For trig:  Give degrees to all GL functions  Give radians to C++ math functions (sin(), cos(), etc.)

 Divide sphere into “rings” (purple lines) by latitude  # of rings = divisions variable  Fill in the area between each ring (dark blue region) with a strip of polygons

 Divide slices into quadrilaterals by longitude  # of slices = divisions variable!  Connect the dots with OpenGL quadrilaterals or triangles.

glBegin(DRAW_TYPE); … glNormal3f(0, 1, 0); glTexCoord2f(0,0); glVertex3f(1, 2, 3); … glEnd();  Tell OpenGL what primitive you’re drawing with glBegin()  GL_TRIANGLES  GL_TRIANGLE_STRIP  GL_TRIANGLE_FAN  GL_QUADS  GL_QUAD_STRIP

 Use strip primitives like GL_QUAD_STRIP for connected polygons  If you send 12 points to graphics card:  GL_QUADS draws 3 quads  GL_QUAD_STRIP draws 5 quads by reusing points for more than one quad.  Order matters – see diagram! Diagram comparing quads drawn by GL_QUADS and GL_QUAD_STRIP, given the same points (from html) html

 See lecture slides for spherical texture mapping  Basic idea: use latitude and longitude as texture coordinates

 Surfaces of Rotation  Smooth Surfaces  Swept Surfaces  Rail Surfaces  Non-Linear Transformations  Heightfields  Most are easy once you implement the sphere! Smooth fishy surface (Michael Kidd and Igor Tolkov, Spring 2010)

 You must make a character with:  2 levels of branching  Something drawn at each level  Meaningful controls ▪ Otherwise, you will be overwhelmed when you animate it!  You will need to:  Extend the Model class  Override the draw() method  Add properties that Modeler users can control  Give an instance of your class to ModelerUserInterface in the main() function

 In sample.cpp, the Scene class extends Model  draw() method draws the green floor, sphere, and cylinder  Add and replace drawing commands of your own  Where are the drawing commands?  Modelerdraw.cpp ▪ drawBox ▪ drawCylinder ▪ drawSphere

 Kinds of properties (in properties.h):  BooleanProperty = checkbox  RangeProperty = slider  RGBProperty = color  ChoiceProperty = radio buttons  Need to add it to: 1. Class definition 2. Constructor 3. Property list  See sample.cpp for example

 glEnable()/glDisable() changes state  Once you change something, it stays that way until you change it to something new  OpenGL’s state includes:  Current color  Transformation matrices  Drawing modes  Light sources

 Just two of them: projection and modelview. We’ll modify modelview.  Matrix applied to all vertices and normals  These functions multiply transformations: glRotated(), glTranslated(), glScaled()  Applies transformations in REVERSE order from the order in which they are called.  Transformations are cumulative. Since they’re all “squashed” into one matrix, you can’t “undo” a transformation.

 How do we get back to an earlier transformation matrix?  We can “remember” it  OpenGL maintains a stack of matrices.  To store the current matrix, call glPushMatrix().  To restore the last matrix you stored, call glPopMatrix().

 Draw the body  Use glPushMatrix() to remember the current matrix.  Imagine that a matrix corresponds to a set of coordinate axes:  By changing your matrix, you can move, rotate, and scale the axes OpenGL uses.

 Apply a transform:  glRotated()  glTranslated()  glScaled()  Here, we apply glTranslated(1.5,2,0)  All points translated 1.5 units left and 2 units up  It’s as if we moved our coordinate axes!

 Draw an ear.  This ear thinks it was drawn at the origin.  Transformations let us transform objects without changing their geometry!  We didn’t have to edit that ear’s drawing commands to transform it

 Call glPopMatrix() to return to the body’s coordinate axes.  To draw the other ear, call glPushMatrix() again…

 Apply another transform…  Where will the ear be drawn now?

 Draw the other ear

 Then, call glPopMatrix() to return to the body’s “axes”  Technically, you don’t need to if that second ear is the last thing you draw.  But what if you wanted to add something else to the body?

 Make sure there’s a glPopMatrix() for every glPushMatrix()!  You can divide your draw() function into a series of nested methods, each with a push at the beginning and a pop at the end.

 Your scene must have two levels of branching like in this diagram.  Circles are objects  Arrows are transformations  Call glPushMatrix() for green, so you can draw orange after drawing red  Do the same for orange  You must draw something at each level.

 Needs to control multiple aspects of your model.  Example: Rotate multiple joints at once  Don’t get too complicated!  Wait for Animator in four weeks!

 OpenGL’s Camera/Eye  Position: The origin  Direction: Looking down the –z axis  Up Vector: Y-axis corresponds to “up”  Since we can’t move the camera, we move the world instead – it has the same effect.  A function called gluLookAt() does this.  You will replace the call to gluLookAt() in camera.cpp with code that does the same thing.

 You are given the camera’s:  Position  Up-vector  Look-at point  Everything is in world space.  Here’s a side view (looking down –x axis) +y Up Vector (ux,uy,uz) Look-At Point (lx,ly,lz) Position (x,y,z) +z -z -y Object

 Use the position and look-at point to get direction  Ending point – starting point = vector from start to end  Normalize it +y Up Vector (ux,uy,uz) Direction (dx,dy,dz) Position (x,y,z) +z -z -y Object

 Apply a translation to all vertices, so that the camera’s center lines up with the origin. +y Up Vector (ux,uy,uz) Direction (dx,dy,dz) Position (x,y,z) +z -z -y Object

 Up vector  +y  Direction  -z  How?  glRotatef() – do the rotations manually  glMultMatrixf() – create a custom rotation matrix (preferred) +y Up Vector (ux,uy,uz) Direction (dx,dy,dz) Position (x,y,z) +z -z -y Object

 See lecture slides for gluLookAt()  Make sure you understand how works  Lots of “magic code” on the Internet  You might be asked about it during grading  Mat.h has a useful matrix class, but you shouldn’t need it.

 We provide a directional light shader in OpenGL Shading Language (GLSL)  You must extend it to support point lights.  Files to edit:  shader.frag – your fragment shader  shader.vert – your vertex shader

 modeler_solution.exe in your project folder  Loads your shader.frag and shader.vert.  Also contains our sample shaders.  Use radio buttons to compare with sample solution Choose shader here

 gl_LightSource[i].position.xyz – the position of light source i.  gl_FrontLightProduct[i] – object that stores the product of a light’s properties with the current surface’s material properties:  Example: gl_FrontLightProduct[i].diffuse == gl_FrontMaterial.diffuse * gl_LightSource[i].diffuse

 Anything you want!  Can earn extra credit!  Ask TA’s for estimated extra credit value of an option.  See the OpenGL orange book in the lab for details + code.  Can still use sample solution to test (depending on complexity)

 Make sure that your repository works by:  Checking it out  Building it  Tweaking something  Committing  Do this on each work environment you plan to use, even if you aren’t going to start work yet:  Lab machines  Your home computer  The sooner we know of a problem, the sooner we can fix it.

 In general, never put anything besides source code into source control:  Debug and Release folders  Modeler.suo  Modeler.ncb  *.user files  DO put source files (*.cpp, *.h, *.vcproj, image files, etc.) in the repository  Make sure you both add AND commit the files.  TortoiseSVN: when you commit, make sure all the files you added have a checkmark.

THINGS TO DO  Partner A: Modeling  Part 1: Rendering a Sphere  Part 2: Hierarchical Modeling  Either Partner:  Part 3: gluLookAt()  Partner B: Shading  Part 4: Blinn-Phong Shader  Part 5: Custom Shader  You don’t have to divide work up this way! WARNINGS  Don’t modify any files except your model file and the required modifications  Or, your model might not work in Animator  Make sure you can check out, commit, and build!

 Try adjusting the sample model  Let us know if you have problems  COMMIT BEFORE LOGOFF!  Your files in C:\User\... will go away when you log out, due to Deep Freeze!