INF3320 Computer Graphics and Discrete Geometry

Similar documents
Subdivision Surfaces

CS354 Computer Graphics Surface Representation IV. Qixing Huang March 7th 2018

From curves to surfaces. Parametric surfaces and solid modeling. Extrusions. Surfaces of revolution. So far have discussed spline curves in 2D

Computer Graphics Curves and Surfaces. Matthias Teschner

Subdivision Surfaces

09 - Designing Surfaces. CSCI-GA Computer Graphics - Fall 16 - Daniele Panozzo

Physically-Based Modeling and Animation. University of Missouri at Columbia

Surfaces for CAGD. FSP Tutorial. FSP-Seminar, Graz, November

Example: Loop Scheme. Example: Loop Scheme. What makes a good scheme? recursive application leads to a smooth surface.

Subdivision Curves and Surfaces: An Introduction

Information Coding / Computer Graphics, ISY, LiTH. Splines

Curve Corner Cutting

Spline Surfaces, Subdivision Surfaces

u 0+u 2 new boundary vertex

Curves, Surfaces and Recursive Subdivision

UNIVERSITY OF CALGARY. Subdivision Surfaces. Advanced Geometric Modeling Faramarz Samavati

CS354 Computer Graphics Surface Representation III. Qixing Huang March 5th 2018

Subdivision surfaces. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell

Subdivision overview

Approximate Catmull-Clark Patches. Scott Schaefer Charles Loop

Ray-casting Algebraic Surfaces using the Frustum Form. Eurographics 2008 Crete, Thursday April 17.

Subdivision Curves and Surfaces

Curves and Surfaces 2

Computer Graphics CS 543 Lecture 13a Curves, Tesselation/Geometry Shaders & Level of Detail

Subdivision curves and surfaces. Brian Curless CSE 557 Fall 2015

Subdivision Surfaces. Homework 1: Last Time? Today. Bilinear Patch. Tensor Product. Spline Surfaces / Patches

Direct Rendering of Trimmed NURBS Surfaces

Review of Tuesday. ECS 175 Chapter 3: Object Representation

CSE 167: Introduction to Computer Graphics Lecture 12: Bézier Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

Advanced Modeling 2. Katja Bühler, Andrej Varchola, Eduard Gröller. March 24, x(t) z(t)

Advanced Graphics. Subdivision Surfaces. Alex Benton, University of Cambridge Supported in part by Google UK, Ltd

Subdivision. Outline. Key Questions. Subdivision Surfaces. Advanced Computer Graphics (Spring 2013) Video: Geri s Game (outside link)

ECE 600, Dr. Farag, Summer 09

3D Modeling Parametric Curves & Surfaces. Shandong University Spring 2013

Curves and Surfaces Computer Graphics I Lecture 9

Efficient GPU Rendering of Subdivision Surfaces. Tim Foley,

Subdivision Surfaces. Homework 1: Questions on Homework? Last Time? Today. Tensor Product. What s an illegal edge collapse?

Computergrafik. Matthias Zwicker Universität Bern Herbst 2016

Subdivision Surfaces

CS-184: Computer Graphics

Introduction to Geometry. Computer Graphics CMU /15-662

Rendering Curves and Surfaces. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Mathematical Tools in Computer Graphics with C# Implementations Table of Contents

Lecture IV Bézier Curves

Until now we have worked with flat entities such as lines and flat polygons. Fit well with graphics hardware Mathematically simple

Central issues in modelling

REAL-TIME SMOOTH SURFACE CONSTRUCTION ON THE GRAPHICS PROCESSING UNIT

Using Semi-Regular 4 8 Meshes for Subdivision Surfaces

Advanced Computer Graphics

CS123 INTRODUCTION TO COMPUTER GRAPHICS. Describing Shapes. Constructing Objects in Computer Graphics 1/15

Parametric Curves. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell

Motivation MGB Agenda. Compression. Scalability. Scalability. Motivation. Tessellation Basics. DX11 Tessellation Pipeline

Sung-Eui Yoon ( 윤성의 )

Subdivision Surfaces. Homework 1: Questions/Comments?

Curves and Surfaces. Shireen Elhabian and Aly A. Farag University of Louisville

and the crooked shall be made straight, and the rough ways shall be made smooth; Luke 3:5

Curves and Surfaces Computer Graphics I Lecture 10

Parameterization. Michael S. Floater. November 10, 2011

Objects 2: Curves & Splines Christian Miller CS Fall 2011

3D Modeling Parametric Curves & Surfaces

Modeling. Simulating the Everyday World

Subdivision on Arbitrary Meshes: Algorithms and Theory

Parametric Curves. University of Texas at Austin CS384G - Computer Graphics

COMPUTER AIDED GEOMETRIC DESIGN. Thomas W. Sederberg

Curves & Surfaces. Last Time? Progressive Meshes. Selective Refinement. Adjacency Data Structures. Mesh Simplification. Mesh Simplification

Curves. Computer Graphics CSE 167 Lecture 11

Computer Graphics I Lecture 11

Curves D.A. Forsyth, with slides from John Hart

Chapter 4-3D Modeling

Parameterization of triangular meshes

Real time Ray-Casting of Algebraic Surfaces

Computergrafik. Matthias Zwicker. Herbst 2010

CS337 INTRODUCTION TO COMPUTER GRAPHICS. Describing Shapes. Constructing Objects in Computer Graphics. Bin Sheng Representing Shape 9/20/16 1/15

Interpolatory 3-Subdivision

Design considerations

2D Spline Curves. CS 4620 Lecture 18

Bézier and B-spline volumes Project of Dissertation

2001, Denis Zorin. Subdivision Surfaces

3D Modeling techniques

Rasterization Overview

Technical Report. Removing polar rendering artifacts in subdivision surfaces. Ursula H. Augsdörfer, Neil A. Dodgson, Malcolm A. Sabin.

Recursive Subdivision Surfaces for Geometric Modeling

CS 4620 Final Exam. (a) Is a circle C 0 continuous?

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

CS130 : Computer Graphics Curves (cont.) Tamar Shinar Computer Science & Engineering UC Riverside

Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL

08 - Designing Approximating Curves

INF3320 Computer Graphics and Discrete Geometry

Know it. Control points. B Spline surfaces. Implicit surfaces

CHAPTER 1 Graphics Systems and Models 3

Intro to Modeling Modeling in 3D

CSE 167: Introduction to Computer Graphics Lecture #11: Bezier Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

The goal is the definition of points with numbers and primitives with equations or functions. The definition of points with numbers requires a

MA 323 Geometric Modelling Course Notes: Day 36 Subdivision Surfaces

Approximating Catmull-Clark Subdivision Surfaces with Bicubic Patches

MATHEMATICAL TOOLS IN COMPUTER GRAPHICS WITH C# IMPLEMENTATIONS

Ray Casting of Trimmed NURBS Surfaces on the GPU

Computer Graphics 1. Chapter 2 (May 19th, 2011, 2-4pm): 3D Modeling. LMU München Medieninformatik Andreas Butz Computergraphik 1 SS2011

The Essentials of CAGD

G 2 Interpolation for Polar Surfaces

Transcription:

INF3320 Computer Graphics and Discrete Geometry More smooth Curves and Surfaces Christopher Dyken, Michael Floater and Martin Reimers 10.11.2010 Page 1

More smooth Curves and Surfaces Akenine-Möller, Haines and Hoffman: Tessellation (Chapter 13.6) Implicit surfaces (Chapter 13.3) Subdivision curves (Chapter 13.4) Subdivision surfaces (Chapter 13.5) Page 2

Parametric patches Page 3

Previously in inf3320... Parametric curves and surfaces (patches) p(u 1,v 1 ) p(u 2,v 1 ) v 2 v p p(u,v) v 1 u1 u u2 p(u 1,v 2 ) p(u 2,v 2 ) Page 4

Composing patches Did not talk about: Complex models by composing patches: Challenge: make patches match with C 0, C 1,... continuity Page 5

Composing patches with continuity Constraints on control-points C 0 C 1 Page 6

Composing patches... Nice shading/reflections reveal continuity Page 7

Composing patches... Nice shading/reflections reveal continuity How to render spline patches? Convert to triangles... Page 8

Tessellation Page 9

Tessellation Recall: OpenGL can only handle points, lines, triangles,... Smooth geometry must be tessellated, i.e. approximated Standard approach: sample the smooth geometry, eg uniformly render linear geometry 0 1 Page 10

Tessellation Recall: OpenGL can only handle points, lines, triangles,... Smooth geometry must be tessellated, i.e. approximated Standard approach: sample the smooth geometry, eg uniformly render linear geometry 0 1 Page 11

Smooth surface tessellation More challenging to sample parametric surfaces Basic approach: tessellate parameter domain render corresponding surface mesh Page 12

Smooth surface tessellation More challenging to sample parametric surfaces Basic approach: tessellate parameter domain render corresponding surface mesh Simple algorithm, suitable for GPU Job for the Geometry shader? (one triangle in - multiple out)... not in practice (too few output triangles) Page 13

Adaptive tessellation of patches [Dyken,Reimers,Seland 2008] 1 Bezier-triangle per triangle (pre)tessellate each individually Adapt along common boundaries Render corresponding mesh GPGPU and Vertex shader programs, instancing,... Code sample on Nvidias webpages Page 14

Hardware Tessellation Shader model 5.0 HW (DirectX11) Comes with hardware tessellation: OpenGL: ARB_tessellation_shader Configurable step in the pipeline Patches tessellated on GPU Fractional tessellation, continuous LOD Solves many problems... Page 15

Implicit surfaces Page 16

Algebraic Surfaces Zero set of polynomial f : R 3 R f (x, y, z) = f ijk x i y j z k = 0 0 i+j+k d Sphere: x 2 + y 2 + z 2 1 = 0 Classic field of mathematics Very compact representation Renewed interest as geom. rep. Visualized by e.g. marching cubes (contouring) or ray-casting Page 17

Ray-casting Overview Given a view frustum and screen resolution (m + 1) (n + 1) Let each pixel correspond to a ray r pq : [0, 1] R 3 Find first intersection i.e. f (r pq (t)) = 0 Find final pixel color Little brother of ray-tracing Back plane m + 1 n + 1 Ray-casting is in some sense the opposite of rasterization Page 18

Digression: Real time raytracing on the GPU Raycasting is computationally demanding embarrassingly parallel (check Wikipedia!) A good candidate application for a GPU implementation [Reimers-Seland, Eurographics 2008] paper/video: http://folk.uio.no/martinre Page 19

Subdivision curves Page 20

Subdivision of Bézier Curves We have seen that the de Casteljau algorithm evaluates a Bézier curve from its control polygon. The intermediate points of the de Casteljau algorithm define the control points of two Bézier segments representing the original. = We can divide one Bézier segment into two Bézier segments! Page 21

On the left is the triangular structure of the intermediate points of the de Casteljau evaluation. On the right is a figure of the points. p 0 0 p 1 0 p 2 0 p 3 0 p 1 0 p 2 0 1 t t 1 t t 1 t p1 p1 p1 0 2 1 t t 1 t t t p 0 1 p 0 2 p 0 3 p 1 2 p 2 1 p 0 2 p 1 2 1 t t p3 0 p 0 0 p 3 0 The original segment on [0, 1] has control points p 0 0, p0 1, p0 2, p0 3. The segment on [0, t] has control points p 0 0, p1 0, p2 0, p3 0. The segment on [t, 1] has control points p 3 0, p2 1, p1 2, p0 3. Page 22

If we divide at t = 1 2, we get p 0 0 = p 0 0 p 3 0 = 1 8 (p0 0 + 3p 0 1 + 3p 0 2 + p 0 3), p 1 0 = 1 2 (p0 0 + p 0 1), p 2 1 = 1 4 (p0 1 + 2p 0 2 + p 0 3), p 2 0 = 1 4 (p0 0 + 2p 0 1 + p 0 2), p 1 2 = 1 2 (p0 2 + p 0 3), p 3 0 = 1 8 (p0 0 + 3p 0 1 + 3p 0 2 + p 0 3), p 0 3 = p 0 3, This is a refinement rule for cubic Bézier curves. Under repeated division, called subdivision, the control polygon converges to the curve. In practice: render the control polygon after a few subdivisions There are similar rules for (uniform) splines Subdivision curves are defined by such refinement rules. Page 23

Subdivision curves Curves generated by iterative refinement of a given control polygon (vertices=control points). The result after infinitely many steps is called the limit curve. Both Bézier curves and spline curves are subdivision curves. (I.e. there exists subdivision schemes to generate them) Many such schemes (subdivision zoo). Page 24

Chaikin s scheme From control points..., p i 1, p i, p i+1,..., 0 0 p i p i+1 we refine with the rule 1 p 2i+1 p k+1 2i = 1 4 pk i + 3 4 pk i 1 0 p i 1 1 p 2i p k+1 2i+1 = 3 4 pk i + 1 4 pk i 1 Important: The indices differs slightly from the book. Repeat the refinement ad infinitum.! Observation: the number of points doubles at each iteration. Converges to a quadratic C 1 spline curve. Page 25

Masks and stencils Collect coefficients into even stencil and odd stencils (rules) and get a e = { 1 4, 3 4 } and ao = { 3 4, 1 4 }, p k+1 2i = 1 4 pk i + 3 4 pk i 1 = j Z a e j p k i j p k+1 2i+1 = 3 4 pk i + 1 4 pk i 1 = aj o p k i j, j Z combined, the even and odd stencils form the mask of the scheme, a = { 1 4, 3 4, 3 4, 1 4 } which yields p k+1 i = j Z a i 2jp k j for i Z The mask express the influence of an old vertex on the new verts. Page 26

C 2 cubic spline subdivision Another example is a C 2 cubic spline curve. 0 0 p i p i+1 The subdivision rule is 0 p i 2 0 p i 1 1 p 2i 1 p 2i+1 p k+1 2i = 1 8 pk i + 6 8 pk i 1 + 1 8 pk i 2 p k+1 2i+1 = 1 2 pk i + 1 2 pk i 1 i.e. even (vertex) and odd (edge) stencils a e = { 1 8, 6 8, 1 8 } and ao = { 1 2, 1 2 }, and the mask a = { 1 8, 1 2, 6 8, 1 2, 1 8 }. Note: stencils are convex combinations of control points Page 27

General C d 1 uniform spline subdivision The mask for a C d 1 spline curve of degree d is given by a = {a 0, a 1,..., a d+1 } = 1 2 d {( d + 1 0 ), ( d + 1 1 ) ( )} d + 1,..., d + 1 Examples: a = { 1 2, 1, 1 2 } a = { 1 4, 3 4, 3 4, 1 4 } a = { 1 8, 1 2, 6 8, 1 2, 1 8 } Linear spline Quadratic spline (Chaikin) Cubic spline a = { 1 16, 5 16, 10 16, 10 16, 5 16, 1 16 } Quartic spline Note: level d mask can be obtained by averaging level d 1 masks Page 28

Interpolatory subdivision Quadratic spline scheme: convex comb. yields convex hull-property The four-point scheme interpolates control points Page 29

Subdivision surfaces Page 30

Subdivision surfaces Page 31

Subdivision surfaces Generated by iterative refinement of a polygonal mesh. Usually, the mesh has four-sided faces (quadrilateral meshes) or three sided faces (triangle meshes). Scheme given by refinement rule, typically generalize 1D rules Can repeat to infinity in theory, interested in limit surface Page 32

Subdivision surfaces Surfaces modeled in one piece - built-in continuity Page 33

For uniform ( structured ) meshes, the limit surface is a spline surface (e.g. piecewise polynomial). Rectangular grid Triangular grid uniform rectangular mesh = tensor-product spline surface. uniform triangular mesh = box-spline surface. Page 34

Tensor-product subdivision on rectangular grids Example 1: Chaikin s scheme. We can create subdivision rules for tensor product surfaces by taking tensor products of curve stencils. For example [ 1 ] [ 4 3 3 4 4 1 4 ] = [ 3 16 9 16 1 16 3 16 ] = 1 16 [ ] 3 1. 9 3 which is the tensor product of the even and odd stencil. There are four ways to combine the even and odd stencils: [ ] [ ] [ ] [ ] 1 3 1 1 1 3 1 9 3 1 3 9,,,. 16 9 3 16 3 9 16 3 1 16 1 3 Page 35

Tensor products of Chaikin stencils yields subdivision rule for C 1 biquadratic tensor product splines. Get 4 nodes inside each quad: n 1 v i 1,j n v 2i,2j+1 n 1 v i,j n v 2i+1,2j+1 v n 2i,2j n 1 vi 1,j 1 n v2i+1,2j n 1 v i,j 1 v n 2i,2j = 1 16 (9vn 1 i 1,j 1 + 3vn 1 i,j 1 + 3vn 1 i 1,j + vn 1 i,j ) v n 2i+1,2j = 1 16 (3vn 1 i 1,j 1 + 9vn 1 i,j 1 + vn 1 i 1,j + 3vn 1 i,j ) v n 2i,2j+1 = 1 16 (3vn 1 i 1,j 1 + vn 1 i,j 1 + 9vn 1 i 1,j + 3vn 1 i,j ) v n 2i+1,2j+1 = 1 16 (vn 1 i 1,j 1 + 3vn 1 i,j 1 + 3vn 1 i 1,j + 9vn 1 i,j ) Page 36

Example 2: C 2 bicubic. The mask for cubic curves is [ ] 1 [ ] a0 a 1 a 2 a 3 a 4 = 1 4 6 4 1. 8 i.e., the even and odd stencils are 1 [ ] 1 6 1 8 and 1 [ ] 1 1. 2 Tensor-products of these stencils yields four bicubic stencils: 1 6 1 1 6 36 6, 64 1 6 1 }{{} Stencil A 1 1 [ ] 1 6 6 1 1 6 1,, 16 16 1 6 1 1 1 }{{} Stencils B [ ] 1 1 1. 4 1 1 }{{} Stencil C Page 37

These are used to compute the four new control points [ v n 2i+1,2j v2i+1,2j+1 n ] n 1 v i,j v n 2i,2j v n 2i,2j+1 from the old control points v n 1 i 2,j v n 1 i 2,j 1 v n 1 i 2,j 2 v n 1 i 1,j v n 1 i 1,j 1 v n 1 i 1,j 2 1 6 1 1 6 36 6, 64 1 6 1 }{{} Stencil A v n 1 i,j v n 1 i,j 1 v n 1 i,j 2. n 1 v i 2,j n 1 v i 1,j n v 2i,2j+1 n 1 vi 2,j 1 v n 2i+1,2j+1 n v 2i,2j n 1 vi 1,j 1 1 1 [ ] 1 6 6 1 1 6 1,, 16 16 1 6 1 1 1 }{{} Stencils B v n 2i+1,2j n 1 vi 2,j 2 n 1 v i,j 1 n 1 v i 1,j 2 [ ] 1 1 1. 4 1 1 }{{} Stencil C n 1 vi,j 2 Page 38

Generalized subdivision So far: polynomial surfaces can be described by subdivision Want to extend rules to handle meshes that are not regular grids Also want the limit surface to be as smooth as possible. Page 39

Non-uniform meshes Faces with n vertices (not only 3 and 4) Vertices with valence m 4, 6, so called extraordinary points Many subdivision schemes, for different mesh-types typically polynomial locally... but not near extraordinary points. Page 40

Catmull-Clark subdivision surfaces A generalization of C 2 bicubic spline subdivision scheme to an arbitrary polygonal mesh. The limit surface is C 1 at extraordinary points and C 2 elsewhere. It has been shown that C 2 continuity at extraordinary points is impossible without using larger stencils. Page 41

The basic idea of the Catmull-Clark subdivision scheme is: The input mesh can contain any types of polygons (triangles, quads, etc.) Calculate face points, edge points, and vertex points. For each vertex in each face, create a quad connecting the vertex point, two edge points, and a face point. After one refinement, the mesh consists of quads exclusively. Page 42

Face points are averages of the polygon vertices v1 k,..., vk m, f k+1 = 1 n vi k n Edge points are the average of the two end-points of the edge v k, e k and the face points of the two adjacent faces f k+1 i, f k+1 e k+1 = 1 ( ) v k + e k + f k+1 i + f k+1 j 4 i=1 j, Vertex points are combinations of surrounding vertices v1 k,..., vk n and the face points f1 k,..., fk n of the adjacent faces, v k+1 = n 2 n vk + 1 n n 2 e k i + 1 n n 2 f k+1 i i=1 i=1 Page 43

Catmull Clark New control points are convex comb. of the old = Convex hull property, stable algorithms Limit points, tangents, etc can be computed Usually not evaluated, but can be done Page 44

Loop subdivision A subdivision scheme for arbitrary triangle meshes. The Loop scheme is based on so-called C 2 quartic box-splines Page 45

The Loop subdivision scheme uses the 1-4 split: After one subdivision step each former triangle is replaced by four: V i+1 = V i + E i, E i+1 = 2 E i + 3 T i, T i+1 = 4 T i. There are only two stencils in the Loop scheme: 1. positions for vertices corresponding to the old vertices, and 2. positions for vertices corresponding to edge points. Page 46

In the Loop scheme, the new position is a combination of the position of the old vertex and its immediate neighbours: where β β β β = 1 ( ) 5 (3 + 2 cos(2π/n))2. n 8 64 1 nβ β β β β The canonical case is n = 6 in which case the scheme reduces to box-spline subdivision, yielding a C 2 surface. Loop showed that the limit surface is C 1 at extraordinary points, and C 2 elsewhere. Page 47

The position of the edge-point is a combination of the vertices of the two triangles adjacent to that edge: 1/8 3/8 3/8 1/8 Then, what should we do along the boundary? Page 48

A common technique for dealing with the boundary in the Loop scheme is to let the boundary curve be a cubic spline. Recall that the mask of cubic spline curve subdivision is a = { 1 8, 1 2, 3 4, 1 2, 1 8 } and let boundary edge points be determined by the odd stencil and the boundary vertices be determined by the even stencil, i.e., 1/8 3/4 1/2 1/8 1/2 Page 49

3 subdivision A subdivision scheme for arbitrary triangle meshes. The 3 subdivision scheme of Leif Kobbelt creates only 3 new triangles per triangle in each subdivision step (Loop creates 4). C 1 continuous in extraordinary vertices and C 2 elsewhere Page 50

The splitting scheme of 3 subdivision is: Given a triangle mesh, compute the new positions for the vertices as well as the triangle midpoints from the old vertices, split each triangle into three new triangles, then swap the diagonal of all pairs of adjacent triangles where the common edge is an old edge. Page 51

We can create the new triangles directly: Each edge in the old mesh yields two new triangles. To handle boundaries, we use the same rules as Loop (Slide??) to calculate boundary edge points and boundary vertices. Each boundary edge yields two new triangles connecting the end points of the edge, the adjacent triangle midpoint, and the edge point. Note: Only boundary edges get an edge point! Page 52

3 subdivision has a vertex rule and a triangle rule: β β 1 nβ β β The vertex rule is a blend of the old position and the surrounding vertices, where β β β β = 4 2 cos(2π/n). 9n 1/3 The triangle midpoint rule is simple, the position is the barycentre of the triangle. 1/3 1/3 Page 53

Interpolatory subdivision schemes The butterfly scheme: vertex points preserved, edge points by affine combination Yields C 1 smooth surfaces that interpolates control mesh Page 54

Interpolatory subdivision schemes The butterfly scheme: vertex points preserved, edge points by affine combination Yields C 1 smooth surfaces that interpolates control mesh Approximating (spline-based) and interpolatory schemes produce very different limit surfaces Page 55

Features, creases Subdivision surfaces with piecewise continuity Modified rules to get features, sharp creases etc. Page 56

Subdivision surfaces - summary Pros: Many of the pros of splines Flexibility, wrt. topology/mesh Spline surfaces without gaps and seams! Simple to implement Simple/intuitive to manipulate Cons: No global closed form (but locally) Evaluation not straight forward (but?) C k, k > 1 is hard Artefacts (ripples etc.) CC cannot make convex surface for n > 5 Page 57

The last slide Next time - advanced topics: Global illumination Shadows GPU programming... Page 58