Class 17 front and back lighting convex sets, convex hull

Slides:



Advertisements
Similar presentations
O a polygon is a plane figure specified by a set of three or more coordinate positions, called vertices, that are connected in sequence by straight-Line.
Advertisements

CS 450: COMPUTER GRAPHICS FILLING POLYGONS SPRING 2015 DR. MICHAEL J. REALE.
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Definitions A circle is the set of all points in a plane that are equidistant from a given point called the center of the circle. Radius – the distance.
Advanced Light and Shadow Culling Methods Eric Lengyel.
CS 4363/6353 BASIC RENDERING. THE GRAPHICS PIPELINE OVERVIEW Vertex Processing Coordinate transformations Compute color for each vertex Clipping and Primitive.
Intersection Testing Chapter 13 Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology.
7.3 Rotations Advanced Geometry.
Circles.
POLYGONS! gone! Polly.
Informationsteknologi Wednesday, November 7, 2007Computer Graphics - Class 51 Today’s class Geometric objects and transformations.
Informationsteknologi Monday, October 29, 2007Computer Graphics - Class 21 Today’s class Graphics programming Color.
Informationsteknologi Thursday, November 22, 2007Computer Graphics - Class 111 Today’s class Clipping Parametric and point-normal form of lines Intersecting.
Shading in OpenGL CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Drawing Geometric Objects
Shading in OpenGL Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
1 CSCE 441 Computer Graphics: Clipping Lines Jinxiang Chai.
09/18/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Bump Mapping Multi-pass algorithms.
GEOMETRY.
Polygon Shading. Assigning color to a shape to make graphical scenes look realistic, or artistic, or whatever effect we’re attempting to achieve But first.
CGMB 314 Intro to Computer Graphics Fill Area Primitives.
Properties of Polygons The students will be able to describe the characteristics of a figure and to identify polygons.
Shading in OpenGL.
Triangulation Introduction to Computer Graphics and Animation (Principle of Computer Graphics) Rattapoom Waranusast.
Week 11 - Thursday.  What did we talk about last time?  Image processing  Blurring  Edge detection  Color correction  Tone mapping  Lens flare.
Computer Graphics I, Fall 2010 Shading in OpenGL.
Geometry 10-1 Solids Face: the flat side of a figure
Computer Graphics Through OpenGL: From Theory to Experiments, Second Edition Chapter 2.
P RACTICING O PEN GL- P RIMITIVES. O PEN GL O UTPUT P RIMITIVES  Each geometric object is described by a set of vertices and the type of primitive to.
CAP4730: Computational Structures in Computer Graphics
1 Visiblity: Culling and Clipping Computer Graphics COMP 770 (236) Spring 2009 January 21 & 26: 2009.
Intro to OpenGL: Vertices and Drawing
UniS CS297 Graphics with Java and OpenGL State Management and Drawing Primative Geometric Objects.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
12.1 Exploring Solids.
Chapter III Rasterization
CLASSIFYING POLYGONS UNIT 1 LESSON 6. Classifying Polygons In geometry, a figure that lies in a plane is called a plane figure. A polygon is a closed.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 15 Creating 3D Models.
Section 12-1 Exploring Solids. Polyhedron Three dimensional closed figure formed by joining three or more polygons at their side. Plural: polyhedra.
2002 by Jim X. Chen: Drawing Geometric Models.1. Objectives –OpenGL drawing primitives and attributes –OpenGL polygon face.
Some Notes on 3-D Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, October 24, 2003.
Introduction to 3D Solids and Solids of Revolution Some 3D shapes can be formed by revolving a 2D shape around a line (called the axis of revolution).
OpenGL Programming Guide Chapter 2 Korea Univ. Graphics Labs. Ji Jun Yong Korea Univ. Graphics Labs. Ji Jun Yong.
3D Rendering 2016, Fall.
CSC Graphics Programming
Rendering Pipeline Fall, 2015.
Week 12 - Thursday CS361.
Inside-Outside & Culling
1.4 Polygons.
Objectives OpenGL drawing primitives and attributes
Class 18 Curves and Surfaces
Vectors, Normals, & Shading
Shading in OpenGL Ed Angel
Lighting Phong's Lighting Model normals
Lecture 13 Clipping & Scan Conversion
Computer Graphics Through OpenGL: From Theory to Experiments, Second Edition Chapter 9.
Primitive Objects Lecture 6 Wed, Sep 5, 2007.
Chapter VII Rasterizer
CSCE 441 Computer Graphics: Clipping Polygons Jinxiang Chai
Introduction to Meshes
Lesson 4-3 Rotations or Turns.
2- and 3-Dimensional Figures
Reflections. Reflections What is a reflection?
Geometry Chapter : Exploring Solids.
Clipping University of British Columbia CPSC 314 Computer Graphics
Class 18 front and back lighting convex sets, convex hull
Polygons.
Lecture 5: Triangulations & simplicial complexes (and cell complexes).
Class 20 Curves and Surfaces
Presentation transcript:

Class 17 front and back lighting convex sets, convex hull triangulation why triangulation matters orientation drawing curves

Lighting: front, back, or both litTriangle.cpp glLightModel*(GL_LIGHT_MODEL_TWO_SIDED, GL_TRUE); a) use the GL_BACK (or GL_FRONT_AND_BACK) parameter values to color back-facing polygons b) reverse the specified vertex normal for back-facing polygons.

litTriangle.cpp try setting glColor3f( 1, 1, 0); //yellow try disabling lighting

Chapter 7 Convex set S If P and Q are points of S, then the segment connecting P and Q is also in S Does a triangle have to be convex? Does a quadrilateral have to be convex? got to here

Convex set S

Convex Hull The smallest convex set containing a set S in the convex hull of S.

The Intersection of convex sets is convex The Intersection of convex sets is convex. The Union of convex sets is NOT necessarily convex

If S={P1,P2, ... , Pk}, then the convex hull of S is the set of all convex combinations of S.

Chapter 8 Triangulation Suppose T is a collection of triangles and an object X is the union of these triangles. Let s and t be any two triangles from this collection. Good: s & t don't intersect s & t intersect at a vertex of each s & t intersect at a whole edge of each got to here

Examples: ✓ ✓ X ✓ X

What's wrong with a bad "triangulation"?

Answer: The rendering depends on the order you render the triangles.

If an object is made from a good triangulation then the image is independent of the order in which the triangles are rendered.

More good triangles gives better lighting

Trouble with non-convex polygons instead of triangles. Makes a fan around the first vertex. Which is first vertex?

Make sure polygons are convex (and coplanar)! GL_QUAD GL_POLYGON GL_QUAD_STRIP

Chapter 9 Orientation Front VS Back

THU triangle on transparency What do you see from each side? T H U

What does the viewer see? For each primitive, does the viewer see the vertices : CCW - counter clockwise: FRONT facing CW - clockwise: BACK facing (CCW is default FRONT, can be changed with glFrontFace(GL_CW) )

Should the triangle be drawn red or green?

Orientation of P,Q,R as viewed from the origin D = det PX QX RX PY QY RY PZ QZ RZ If D>0 then PQR looks Clockwise If D<0 then PQR looks Counter Clockwise

Consistent Orientation of a Triangulation: Any two triangles that share an edge order the edge oppositely. consistent inconsistent

squareOfWalls.cpp consistent

Run threeQuarterSphere.cpp one hemisphere, solid outside one overlapping hemisphere, lines outside

Culling Inside a closed sphere see one side of triangles only Outside, see the other side, only. culling - don't draw those we can't see Need to tell OpenGL

glCullFace(face) face GL_FRONT, GL_BACK, GL_FRONT_AND_BACK face says which are NOT to be rendered. Also need glEnable(GL_CULL_FACE);

sphereInBox1.cpp Note what happens when box is opened. Show where the culling code is. cull some other faces – have them try – with ball, box, lid, front or back do experiment

Discuss behavior under transformation Discuss behavior under transformation. Order preserving, order reversing, glFrontFace(GL_CW)

curves in 2-space plane curve: x = f(t) y = g(t) t∈[a,b] or (-∞, b], [a, ∞), (-∞, ∞) got to here

curveDrawerMJB.cpp run endpoints number of intervals and interval size y = x*x

curveDrawerMJB.cpp modifications y=sin(x) x=t y=sin(t) pick good a and b pick good MAX and MIN

curveDrawerMJB.cpp modifications circle x=cos(t) y=sin(t) pick good a and b pick good MAX and MIN