Geometric Features for Non-photorealistiic Rendering

Similar documents
CS 283: Assignment 1 Geometric Modeling and Mesh Simplification

Geometry Processing & Geometric Queries. Computer Graphics CMU /15-662

CSE 554 Lecture 6: Fairing and Simplification

Mesh Repairing and Simplification. Gianpaolo Palma

Appearance Preservation

Mesh Simplification. Mesh Simplification. Mesh Simplification Goals. Mesh Simplification Motivation. Vertex Clustering. Mesh Simplification Overview

CSE 163: Assignment 2 Geometric Modeling and Mesh Simplification

CGAL. Mesh Simplification. (Slides from Tom Funkhouser, Adam Finkelstein)

Computer Graphics I Lecture 11

Digital Geometry Processing. Computer Graphics CMU /15-662

Surface Simplification Using Quadric Error Metrics

3D Programming. 3D Programming Concepts. Outline. 3D Concepts. 3D Concepts -- Coordinate Systems. 3D Concepts Displaying 3D Models

For each question, indicate whether the statement is true or false by circling T or F, respectively.

CSE 167: Introduction to Computer Graphics Lecture #11: Visibility Culling

Progressive Mesh. Reddy Sambavaram Insomniac Games

CS 4620 Midterm, March 21, 2017

Rendering. Converting a 3D scene to a 2D image. Camera. Light. Rendering. View Plane

Mesh Decimation Using VTK

CSE 167: Introduction to Computer Graphics Lecture #10: View Frustum Culling

Pipeline Operations. CS 4620 Lecture 14

CS 4620 Program 3: Pipeline

Homework #2. Shading, Projections, Texture Mapping, Ray Tracing, and Bezier Curves

To Do. Resources. Algorithm Outline. Simplifications. Advanced Computer Graphics (Spring 2013) Surface Simplification: Goals (Garland)

CSE 167: Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

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

Advanced Lighting Techniques Due: Monday November 2 at 10pm

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

Scalar Field Visualization I

As a consequence of the operation, there are new incidences between edges and triangles that did not exist in K; see Figure II.9.

Applications. Oversampled 3D scan data. ~150k triangles ~80k triangles

Meshes: Catmull-Clark Subdivision and Simplification

3D GRAPHICS. design. animate. render

Geometric Modeling. Mesh Decimation. Mesh Decimation. Applications. Copyright 2010 Gotsman, Pauly Page 1. Oversampled 3D scan data

0. Introduction: What is Computer Graphics? 1. Basics of scan conversion (line drawing) 2. Representing 2D curves

Mach band effect. The Mach band effect increases the visual unpleasant representation of curved surface using flat shading.

Computer Graphics. Instructor: Oren Kapah. Office Hours: T.B.A.

All the Polygons You Can Eat. Doug Rogers Developer Relations

Orthogonal Projection Matrices. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Image Precision Silhouette Edges

Scalar Field Visualization I

Mesh Decimation. Mark Pauly

CS451Real-time Rendering Pipeline

CHAPTER 1 Graphics Systems and Models 3

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

Homework #2. Hidden Surfaces, Projections, Shading and Texture, Ray Tracing, and Parametric Curves

The Traditional Graphics Pipeline

Introduction to Computer Graphics

Feature Lines on Surfaces

Pipeline Operations. CS 4620 Lecture 10

LOD and Occlusion Christian Miller CS Fall 2011

Topics and things to know about them:

Models and Architectures

Computer Science 175. Introduction to Computer Graphics lib175 time: m/w 2:30-4:00 pm place:md g125 section times: tba

CMSC427 Advanced shading getting global illumination by local methods. Credit: slides Prof. Zwicker

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

CS2401 COMPUTER GRAPHICS ANNA UNIV QUESTION BANK

Game Architecture. 2/19/16: Rasterization

CS 130 Final. Fall 2015

Adjacency Data Structures

Geometric Modeling and Processing

Reading. 18. Projections and Z-buffers. Required: Watt, Section , 6.3, 6.6 (esp. intro and subsections 1, 4, and 8 10), Further reading:

A Developer s Survey of Polygonal Simplification algorithms. CS 563 Advanced Topics in Computer Graphics Fan Wu Mar. 31, 2005

I expect to interact in class with the students, so I expect students to be engaged. (no laptops, smartphones,...) (fig)

CMSC427: Computer Graphics Lecture Notes Last update: November 21, 2014

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

CS 381 Computer Graphics, Fall 2012 Midterm Exam Solutions. The Midterm Exam was given in class on Tuesday, October 16, 2012.

CSE 167: Introduction to Computer Graphics Lecture #4: Vertex Transformation

Homework #2. Shading, Ray Tracing, and Texture Mapping

Geometry Processing & Geometric Queries. Computer Graphics CMU /15-662

Culling. Computer Graphics CSE 167 Lecture 12

Scanning Real World Objects without Worries 3D Reconstruction

Shading and Texturing Due: Friday, Feb 17 at 6:00pm

Advanced Real- Time Cel Shading Techniques in OpenGL Adam Hutchins Sean Kim

Deferred Rendering Due: Wednesday November 15 at 10pm

CMSC 491A/691A Artistic Rendering. Announcements

INTRODUCTION TO COMPUTER GRAPHICS. It looks like a matrix Sort of. Viewing III. Projection in Practice. Bin Sheng 10/11/ / 52

CS 563 Advanced Topics in Computer Graphics QSplat. by Matt Maziarz

Basic Triangle Congruence Lesson Plan

Midterm Exam Fundamentals of Computer Graphics (COMP 557) Thurs. Feb. 19, 2015 Professor Michael Langer

Computer Graphics and Visualization. Graphics Systems and Models

COMP environment mapping Mar. 12, r = 2n(n v) v

CS770/870 Spring 2017 Color and Shading

Visualization Computer Graphics I Lecture 20

11/1/13. Polygon Meshes and Implicit Surfaces. Shape Representations. Polygon Models in OpenGL. Modeling Complex Shapes

Overview. Shading. Shading. Why we need shading. Shading Light-material interactions Phong model Shading polygons Shading in OpenGL

Computer Graphics. Shadows

Point-based Simplification Algorithm

Assignment 4: Mesh Parametrization

Illumination and Geometry Techniques. Karljohan Lundin Palmerius

Introduction to Computer Graphics with WebGL

Hermite Curves. Hermite curves. Interpolation versus approximation Hermite curve interpolates the control points Piecewise cubic polynomials

coding of various parts showing different features, the possibility of rotation or of hiding covering parts of the object's surface to gain an insight

CS 559 Computer Graphics Midterm Exam March 22, :30-3:45 pm

Overview. By end of the week:

Lets assume each object has a defined colour. Hence our illumination model is looks unrealistic.

3D Modeling: Surfaces

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

Lecture 17: Shading in OpenGL. CITS3003 Graphics & Animation

Shape from LIDAR Data. Univ. of Florida

Exaggerated Shading for Depicting Shape and Detail. Szymon Rusinkiewicz Michael Burns Doug DeCarlo

Transcription:

CS348a: Computer Graphics Handout # 6 Geometric Modeling and Processing Stanford University Monday, 27 February 2017 Homework #4: Due Date: Mesh simplification and expressive rendering [95 points] Wednesday, 15 March 2017 in class no late days will be available for this homework This is the last homework of CS 348a, consisting of one programming problem in three parts. It is a more open-ended assignment compared to the earlier ones, allowing you to combine the modeling and algorithmic tools you have learned about in a variety of ways. The parts are designed to be worked on in parallel, but do get started as early as possible since each part is challenging! Problem 1. [95 points] Geometric Features for Non-photorealistiic Rendering In this project you will implement a pipeline for rendering interesting features on a 3D mesh. You first will decimate the mesh to a smaller number of triangles, so that fewer triangles need to be processed in the second part of the project. Then, you will implement part of a technique for finding suggestive contours highlighting key geometric features of the object being modeled. Finally, you will extend the system to have additional capabilities of your choosing. Mesh Decimation In this part of the final project, you will implement surface decimation using the method proposed in Garland and Heckbert s Surface Simplification Using Quadric Error Metrics (SIG- GRAPH 1997). The algorithm proceeds as follows: 1. Compute and save an initial quadric approximating the surface near each vertex. 2. Compute collapse priorities for each of the vertices by summing quadrics. 3. Merge adjacent pairs of vertices by collapsing halfedges when such a collapse is valid and preferable according to the priority value. You are provided with two starter files, src/decimation.cpp and include/ decimation.h. The simplify function performing the decimation takes a mesh in halfedge format and the desired ratio between the initial and final vertex count (a float value 1). Decimation algorithm: The decimation algorithm uses a quadric error measure to collapse halfedges. Given an edge e joining vertices s and t, a halfedge collapse pulls s into t, removing s, e and the two triangles adjacent to e. This operation is illustrated in Figure 1. The decimation algorithm operates on the following principles:

2 CS348a: Handout # 6 Figure 1: Halfedge collapse 1. A pair of vertices may be collapsed to a single vertex only if they are connected by an edge and they do not result in a triangle flip. This condition is checked by calling the is_collapse_legal() function. 2. A halfedge h = s t will be assigned a priority priority(h) based on the quadric error metric. We assign a priority to every vertex s such that the priority of s is equal to that of the halfedge leaving from s having minimum priority: priority(x) = min h=s t priority(h) Label the opposite vertex of the minimal halfedge as t, that is, t = target(s). 3. We will store a priority queue of vertices instead of halfedges so that each vertex has a priority based on the quality of the quadric approximation and a target t. 4. In the main loop of the algorithm, we release the vertex s having the minimum priority from the queue. Then the halfedge, s target(s) is collapsed so that s coincides with t = target(s). The properties of t and other affected vertices are updated in the queue. Computing quadrics: Each triangular face is associated with a quadric measuring squared distance to the plane defined by its vertices. Then, the quadric associated with a vertex p is the sum of the quadrics of its adjacent triangles. In particular, these quadrics are given by a sum of squared distances: i dist(q i, p) 2 = i p Q i p = p ( i Q i ) p p Qp where p = (x,y,z,1) is the homogeneous coordinates of the vertex p, q i = (a i,b i,c i,d i ) the unit length vector containing the coefficients of q i s plane equation a i x+b i y+c i z+d i = 0, and the matrix Q i is given by Q i = q i q i. Use the quadric structure is located in decimation.h. (a) (10 points) Complete the initialize() function in decimation.cpp so that it calculates vertex quadrics from the quadrics of the incident triangles.

CS348a: Handout # 6 3 (a) (b) (c) Figure 2: (a) An input mesh, (b) the mesh simplified to 50% of its vertices, and (c) the mesh simplified to 10% of its vertices. (b) (10 points) Compute the priority of a halfedge using the sum of its two end-vertex quadrics and return it in the function compute_priority(). (c) (15 points) Implement the main loop of the decimate() function. In every iteration there are three steps: 1. Take the vertex with the lowest priority from the queue by calling the top() and pop() function. 2. The vertex priority values in the queue can be outdated. Check whether the halfedge is valid using is_vertex_priority_valid() function. 3. If the corresponding collapse is legal (using the is_collapse_valid() function), then collapse the halfedge corresponding to this vertex. 4. Update the properties of the vertices in the queue whose adjacent triangles have been changed using the enqueue_vertex() function. It may be useful to check your output using a mesh viewer such as MeshLab, which can be downloaded for free from http://meshlab.sourceforge.net. Your final result should look like Figure 2 for the simplification to 50% and 10% of the vertex count of the homer.off mesh. Rendering Suggestive Contours Now that you have simplified the mesh to a reasonable number of triangles, we will use our principal curvatures and directions from the last assignment to implement a rudimentary method for finding curve features on meshes based on Suggestive Contours for Conveying Shape by DeCarlo et al. (SIGGRAPH 2003). Your first task is simple: Import your code from the last homework for computing principal curvatures and directions. This code should be stable to make sure that the remaining parts of the program work as advertised. If you have switched project groups since the last assignment, you can use any group member s code.

4 CS348a: Handout # 6 Suggestive Contours is an example of a method for nonphotorealistic rendering, a class of techniques for rendering meshes by emphasizing interesting features rather than applying the physics of light. We will be implementing a part of the paper for finding two types of contours on the surface that highlight what the surface looks like from a given camera angle. Our mesh simplification from the first part of the assignment will allow us to preview these curves in real time. We will first identify silhouette edges on our input meshes. These edges denote the boundaries between visible and invisible parts of a mesh. (d) (5 points) Complete the issilhouette function in src/mesh_features.cpp. The definition of a silhouette edge is one for which one neighboring triangle points toward the camera and the other points away. Also, complete issharpedge to detect edges for which the dot product of the normals of the adjacent faces is less than 1/2. In the starter code, you can make the mesh invisible by pressing s; note that the mesh still is rendered in white to remove hidden lines. You should still see an silhouette curves as shown on the right. These curves obviously are important for conveying the shape of a 3D object, but are far from enough for communicating important geometric detail. Suggestive contours make use of the mesh curvature for finding additional expressive features. In particular, take a point p on a surface. Take v to be the vector pointing from p to the viewer, and let w be its projection onto the tangent plane S at p normalized to unit length. From Assignment 3, we know how to compute κ w (denoted κ r in the DeCarlo paper), the curvature of the surface in the w direction. (e) (5 points) Complete the computeviewcurvature method in src/curvature.cpp. To do so, compute κ w at each vertex of the mesh, and store the result in the mesh property viewcurvature. A suggestive contour is a zero crossing of κ w (in our notation). Since we have one value of κ w per vertex of the mesh, the zero crossings will happen along the edges that is, if you linearly interpolate κ w along an edge using the values at its vertices, if there is a sign change then somewhere in between the view curvature will be zero. Triangles for which κ w has different signs on different vertices will contain such edges; the suggestive contour can be thought of as a line segment connecting the κ w = 0 points on the edges. As explained in the paper, you should only show those contours for which the derivative of κ w in the w direction notated D w κ w is positive. We provide code for computing the gradient of κ w on the mesh as one vector per face and adding it to the property

CS348a: Handout # 6 5 viewcurvaturederivative. Take the dot product of this gradient and w to obtain the directional derivative D w κ w. (f) (20 points) Complete the rendersuggestivecontours method in src/main.cpp. To do so, determine which faces will have suggestive contours running across them, and then draw segments across these faces. As proposed in the paper, you should eliminate curves where D w κ w is positive but small and ones where the angle between the surface normal and the view vector is small. Additional Features The final part of the project will be more open-ended. We would like you to add an additional geometric feature to the rendering system to improve or extend it: (g) (30 points) Add an additional feature. You are welcome to contact the course staff with ideas or to help figure out what will be feasible or interesting for this part of the project. In case you re low on ideas, we have provided you with starter code for one potential extension. In particular, our viewer shows feature curves as chains of line segments, but we d like to see smooth curves. So, in src/image_generation.cpp we have provided code to help generate 2D images with small numbers of smooth curves instead of large numbers of 3D line segments. In particular, we provide you with a method toimageplane to take 3D points and convert them to 2D image locations (the third coordinate is the depth buffer value) and an additional method isvisible using the depth buffer to check if a 3D point is visible. 1 In this additional feature, you should generate a.svg file in the writeimage function containing a curve-based drawing of the mesh. Project feature line segments from the second part of the assignment to curves on the image plane and remove segments that are invisible. Then, propose a method to replace the long chains of line segments with approximations using polynomial curves. The svg format has a path element that will be useful here. Your final output should be viewable in Inkscape, an open source image editor you can download. Note this is a difficult problem, so your final writeup should include a discussion when your technique works and when it fails. Other ideas include: Eliminate spurious feature curves that are too short or uninteresting. Smooth out the remaining curves before rendering them in OpenGL. Trace principal curves (curves whose tangents are principal directions T 1 or T 2 ) along the surface to obtain additional feature curves. Propose a way for choosing a set of interesting principal curves, since two exist starting at any point. 1 This method is highly inaccurate and should be replaced for more accurate visibility detection! You may choose to implement a more complex geometric visibility technique that doesn t read the OpenGL depth buffer, or you can add tolerances to render slightly less-than-visible points.

6 CS348a: Handout # 6 Use the principal curvatures or other geometric features to shade or texture the mesh in a way that makes it easier to see key features. Implement a more stable principal curvature computation method and explore whether it improves the suggestive contours. Animate the mesh as it rotates, and identify stable suggestive contours during this motion so that the animation looks stable. You are provided with an OpenMesh tutorial with this homework. You can use it to better understand OpenGL syntax before beginning to work on the assignment. What you will be given You will be provided with meshes in.off format, with the assumption that each mesh is fairly smooth and non-degenerate. Some sample meshes have been provided in the models/ directory of the starter code. What to hand in Remember that in programming assignments you are allowed to work in teams of up to three students, and that each team needs to hand in only a single write up. On Friday morning, 10 March 2017, you will receive the actual test data that will be used for grading. On or before the due date, you must submit the following: Final version of your source code Images demonstrating the capabilities of your program Paper write-up: Give an overview of your program and explain how your algorithms work. We will set up time periods on Friday, 17 March 2017, during which you will have to demo your program to the instructor and the CA.