CGT 581 G Geometric Modeling Surfaces (part I) Bedrich Benes, Ph.D. Purdue University Department of Computer Graphics Technology Polygonal Representation The common representation is a mesh of triangles product of a conversion from different representation (e.g., CSG, NURBS) or from external data sources (Time of Flight cameras, image reconstruction, etc.) Polygonal Representation Tessellation is a process of converting a complex object into simpler primitives such as triangles or quadrilaterals Polygonal Representation Triangles are preferred, they are simplexes (always flat & convex) (a quadrilateral may be concave or non planar) Polygonal meshes are large so techniques for their simplification are necessary can be lossless or lossy Adaptive tessellation Can cause problems when rendered 1
Triangles Triangle Strips Triangles Triangle strip Triangle fan 4 2 1 3 4 2 1 3 2 3 5 5 4 6 6 less than three vertices per! a sequential triangle strip is defined by an ordered vertex list 0, 1,, the i th triangle 1 1 the vertex list includes 2triangles average # of vertices per triangle 1 5 Triangle Strips Triangle Strips vs. Triangle Fans average # of vertices per triangle 3 1 / 1 2/ where is the length of the list lim 1 e.g., 100, 1.02 (wow!) we save 2/3 of space the same stands for triangle fans some providers (NVIDA) suggest using strips they are better optimized 2
Generalized Triangle Strips the sequence of is not strictly sequential to use them, we need a vertex cache or the swap operation 0,1,2,3, 4,5,6 The vertex must be resend 0,1,2,3,2,4,5,6 Triangle Fans a general convex polygon can be converted into a single fan or a simple strip is the same as for strips (the same startup) any fan can be converted into generalized strip (repeat the center or many swaps), but not vice versa Tessellation Tessellation is a process of converting a complex object into simpler primitives such as triangles or quadrilaterals Tessellation is the most frequently wrongly spelled word in Computer Graphics Sphere Tessellation (Approach 1) Stacks and Slices: not a good approach: generates different Δ generates long Δ involves cos and sin that are usually slow 3
Sphere Tessellation (Approach 1) Parametric equation of sphere Sphere Tessellation (Approach 1) Leads to a tessellation:,,,,,, =,,, sin,,, mδ Δ, Δ 2Δ, Δ Δ, Δ, Δ Δ, Δ 2Δ, Δ Δ, Δ, Δ, 2Δ, Δ, Sphere Tessellation (Approach 1) Results: Sphere Tessellation (Approach 1) Summary: Easy to implement Easy to control (Δ, Δ Not very efficient large and ugly triangles Uses trigonometric functions (can be slow) 4
Circle Tessellation (Approach 2) Recursive Subdivision (let s start with a circle) Two vertices on the unit circle Find the midpoint Move it on the unit circle Do it for all line segments Circle Tessellation (Approach 2) All vertices have unit distance from the origin Algorithm: Subdivide(Vert3d, Vert3d, GLuint ) Input: Vertices,, number of steps Output: 2vertices on the circle 1) if (n==0) return and 2) find 3) Normalize( ); //this will put it on the unit circle 4) Subdivide(a, mid, n-1); 5) Subdivide(mid, b, n-1); Circle Tessellation (Approach 2) Circle Tessellation (Approach 2) Considerations: The input vertices must already be on the unit circle It needs to be rendered as line segments as the algorithm does not provide a continuous polyline 5
Sphere Tessellation (Approach 2) Now this generalizes to the sphere Sphere Tessellation (Approach 2) 2 Each sub triangle has vertices as given here left top mid right Sphere Tessellation (Approach 2) Initial position of the triangles: two tetrahedra Sphere Tessellation (Approach 2) Top view: 120 120 6
Cone Tessellation Circle to point ruled surface make tessallation of a circle and connect each line with the apex can be rendered as a triangle fan Cone Tessellation General Ruled Surface Tessellation Cylinder is a special case of a ruled surface Defined by two curves and Assuming both are parameterized 0 1 The resulting surface is, 1 Note, the connecting curves are line segments General Ruled Surface Tessellation Example (sin to line):, 0,0, t, sin 2π,1 Gives, 1, 0,0 1, 1 2, 1, 1 sin 2, 1 7
General Ruled Surface Tessellation Example (sin to line) General Ruled Surface Tessellation and can be anything Two lines quadrilateral Circle and circle cylinder Circle and point cone Quad and quad cube etc. General Ruled Surface Tessellation Surface of Revolution Surface of revolution is given by a curve rotated around an axis Can we generalize the connecting curve? 8
Surface of Revolution Surface of Revolution Assuming the axis of rotation is The defined curve is The surface, is a set of co centric circles around the axis, sin 2,, cos 2 ( modifies the radius of a circle at level ) Surface of Revolution can be anything Line parallel to axis of rotation cylinder Line from the origin cone Half circle sphere Surface of Revolution Sphere as a surface of revolution We need radius of the sphere as the function of a single parameter We need to reparametrize to be 1,1 1 2 9
Readings Real Time Rendering 2nd edition, Moller, T.A., Haines, E., 481 555 Geometric Modeling, 2nd edition, M. E. Mortenson Edward Engel Interactive Computer Graphics: A Top Down Approach with Shader Based OpenGL (6th Edition) 10