Shapes Digital Image Synthesis Yung-Yu Chuang 10/05/2006 with slides by Pat Hanrahan.

Slides:



Advertisements
Similar presentations
COMP 175 | COMPUTER GRAPHICS Remco Chang1/6103b – Shapes Lecture 03b: Shapes COMP 175: Computer Graphics February 3, 2015.
Advertisements

Advanced Computer Graphics (Spring 2005) COMS 4162, Lecture 14: Review / Subdivision Ravi Ramamoorthi Slides courtesy.
Advanced Computer Graphics CSE 190 [Spring 2015], Lecture 10 Ravi Ramamoorthi
CHAPTER 12 Height Maps, Hidden Surface Removal, Clipping and Level of Detail Algorithms © 2008 Cengage Learning EMEA.
CS Peter Schröder Subdivision I: The Basic Ideas.
Representing Geometry in Computer Graphics Rick Skarbez, Instructor COMP 575 September 18, 2007.
Ray Casting Ray-Surface Intersections Barycentric Coordinates Reflection and Transmission [Shirley, Ch.9] Ray Tracing Handouts Ray Casting Ray-Surface.
Implicit Surfaces Tom Ouyang January 29, Outline Properties of Implicit Surfaces Polygonization Ways of generating implicit surfaces Applications.
Content Subdivision First some basics (control point polygon, mesh)
ENDS 375 Foundations of Visualization Geometric Representation 10/5/04.
Ray Tracing Outline For each pixel { Shoot ray r from eye to center of pixel with trace( r ) } function trace( r ) For each object { Find object with closest.
Cornell CS465 Fall 2004 Lecture 3© 2004 Steve Marschner 1 Ray Tracing CS 465 Lecture 3.
Cornell CS465 Fall 2004 Lecture 3© 2004 Steve Marschner 1 Ray Tracing CS 465 Lecture 3.
Week 13 - Wednesday CS361.
Modeling and representation 1 – comparative review and polygon mesh models 2.1 Introduction 2.2 Polygonal representation of three-dimensional objects 2.3.
Acceleration Digital Image Synthesis Yung-Yu Chuang 10/4/2005 with slides by Mario Costa Sousa and Pat Hanrahan.
1 Computer Graphics Week13 –Shading Models. Shading Models Flat Shading Model: In this technique, each surface is assumed to have one normal vector (usually.
11/30/04© University of Wisconsin, CS559 Fall 2004 Last Time More modeling: –Hierarchical modeling –Instancing and Parametric Instancing –Constructive.
CS-321 Dr. Mark L. Hornick 1 3-D Object Modeling.
Computer graphics & visualization Ray-Tracing – A Quick review.
COMP 175: Computer Graphics March 24, 2015
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Graphics Graphics Korea University cgvr.korea.ac.kr Creating Virtual World I 김 창 헌 Department of Computer Science Korea University
CSE 381 – Advanced Game Programming Basic 3D Graphics
Geometry and Transformations Digital Image Synthesis Yung-Yu Chuang 9/28/2006 with slides by Pat Hanrahan.
4/15/04© University of Wisconsin, CS559 Spring 2004 Last Time More modeling: –Hierarchical modeling –Instancing and Parametric Instancing –Constructive.
2D/3D Shape Manipulation, 3D Printing Shape Representations Slides from Olga Sorkine February 20, 2013 CS 6501.
1 Surface Applications Fitting Manifold Surfaces To 3D Point Clouds, Cindy Grimm, David Laidlaw and Joseph Crisco. Journal of Biomechanical Engineering,
Week 13 - Monday.  What did we talk about last time?  Exam 2!  Before that…  Polygonal techniques ▪ Tessellation and triangulation  Triangle strips,
Object Representation Rama C Hoetzlein, 2010 Univ. of California Santa Barbara Lecture Notes.
Subdivision Schemes Basic idea: Start with something coarse, and refine it into smaller pieces for rendering –We have seen how subdivision may be used.
Introduction to Computer Graphics: Object Representation Rama C Hoetzlein, 2010 Univ. of California Santa Barbara Lecture Notes.
Surface Meshing Material tret de: S. J. Owen, "A Survey of Unstructured Mesh Generation Technology", Proceedings 7th International Meshing Roundtable,
Materials Digital Image Synthesis Yung-Yu Chuang 11/19/2008 with slides by Robin Chen.
Shapes Digital Image Synthesis Yung-Yu Chuang with slides by Pat Hanrahan.
1 Polygonal Techniques 이영건. 2 Introduction This chapter –Discuss a variety of problems that are encountered within polygonal data sets The.
Geometric Modeling using Polygonal Meshes Lecture 3: Discrete Differential Geometry and its Application to Mesh Processing Office: South B-C Global.
Minimum Distance between curved surfaces Li Yajuan Oct.25,2006.
Vertices, Edges and Faces By Jordan Diamond. Vertices In geometry, a vertices is a special kind of point which describes the corners or intersections.
Bump Map 1. High Field Function: H(u, v) New Normal : N’
Lee Byung-Gook Dongseo Univ.
3D Object Representations graphics scenes contain solid geometric objects trees, flowers, clouds, rocks, water representations surface ↔interior models.
Splines I – Curves and Properties based on: Michael Gleicher Curves, chapter 15 in Fundamentals of Computer Graphics, 3 rd ed. (Shirley & Marschner) Slides.
Three-Dimensional Object Representation
Greg Humphreys CS445: Intro Graphics University of Virginia, Fall 2003 Subdivision Surfaces Greg Humphreys University of Virginia CS 445, Fall 2003.
In the name of God Computer Graphics. Introduction Modeling techniques modeling techniques managements Some renderings.
Volume and Solid Modeling
Chapter III Rasterization
RENDERING : Global Illumination
11/16/04© University of Wisconsin, CS559 Fall 2004 Last Time Texture Anti-Aliasing Texture boundaries Modeling introduction.
Shapes Digital Image Synthesis Yung-Yu Chuang 10/1/2008 with slides by Pat Hanrahan.
Solid Modeling Dr. Scott Schaefer.
Ray Tracing I. Reading Hill, Chapter 14, Sections 14.1 to 14.5 Hill, Chapter 14, Sections and
Subdivision Schemes. Center for Graphics and Geometric Computing, Technion What is Subdivision?  Subdivision is a process in which a poly-line/mesh is.
1 Spherical manifolds for hierarchical surface modeling Cindy Grimm.
Digital Image Synthesis Yung-Yu Chuang 10/8/2009
Advanced Computer Graphics
Ray Tracing Forward Ray Tracing
Lecture 33: Shape Modeling Li Zhang Spring 2008
3D Graphics Rendering PPT By Ricardo Veguilla.
Digital Image Synthesis Yung-Yu Chuang 11/16/2006
3D Object Representation
Digital Image Synthesis Yung-Yu Chuang 10/4/2005
Lecture 13 Clipping & Scan Conversion
Geometry and Transformations
Subdivision Surfaces 고려대학교 컴퓨터 그래픽스 연구실 cgvr.korea.ac.kr.
3D Object Representation
Digital Image Synthesis Yung-Yu Chuang 10/04/2007
Last Time B-splines Project 3 was made available
Presentation transcript:

Shapes Digital Image Synthesis Yung-Yu Chuang 10/05/2006 with slides by Pat Hanrahan

Announcements 10/12’s class is cancelled. 10/9 talks by Leif Kobbelt and Paul Debevec. 10:00am-12:00pm, Room 102. Assignment #1 will be handed out today. Due three weeks later.

Shapes One advantages of ray tracing is it can support various kinds of shapes as long as we can find ray-shape intersection. Careful abstraction of geometric shapes is a key component for a ray tracer. Ideal candidate for object-oriented design. All shape classes implement the same interface and the other parts of the ray tracer just use this interface without knowing the details about this shape.

Shapes Primitive = Shape + Material Shape : raw geometry properties of the primitive, implements interface such as surface area and bounding box. Source code in core/shape.* and shapes/*

Shapes pbrt provides the following shape plug-ins: –quadrics: sphere, cone, cylinder, disk, hyperboloid ( 雙曲面 ), paraboloid( 拋物面 ) (surface described by quadratic polynomials in x, y, z) –triangle mesh –height field –NURBS –Loop subdivision surface Some possible extensions: other subdivision schemes, fractals, CSG, point-sampled geometry

Shapes class Shape : public ReferenceCounted { public: all are virtual functions const Transform ObjectToWorld, WorldToObject; const bool reverseOrientation, transformSwapsHandedness; } All shapes are defined in object coordinate space

Shape interface: bounding BBox ObjectBound() const=0; left to individual shape BBox WorldBound() { default implementation; can be overridden return ObjectToWorld(ObjectBound()); }

Shape interface: intersecting bool CanIntersect() returns whether this shape can do intersection test; if not, the shape must provide void Refine(vector >&refined) examples include complex surfaces (which need to be tessellated first) or placeholders (which store geometry information in the disk) bool Intersect(const Ray &ray, float *tHit, DifferentialGeometry *dg) bool IntersectP(const Ray &ray) not pure virtual functions so that non-intersectable shapes don’t need to implement them; instead, a default implementation which prints error is provided. in world space

Shape interface float Area() useful when using as a area light void GetShadingGeometry( const Transform &obj2world, const DifferentialGeometry &dg, DifferentialGeometry *dgShading) No back culling for that it doesn’t save much for ray tracing and it is not physically correct for object instancing

Surfaces Implicit: F(x,y,z)=0 you can check Explicit: (x(u,v),y(u,v),z(u,v)) you can enumerate also called parametric Quadrics

Sphere A sphere of radius r at the origin Implicit: x 2 +y 2 +z 2 -r 2 =0 Parametric: f(θ,ψ) x=rsinθcosψ y=rsinθsinψ z=rcosθ mapping f(u,v) over [0,1] 2 ψ=uψ max θ=θ min +v(θ max -θ min ) useful for texture mapping

Sphere

Sphere (construction) class Sphere: public Shape { …… private: float radius; float phiMax; float zmin, zmax; float thetaMin, thetaMax; } Sphere(const Transform &o2w, bool ro, float rad, float zmin, float zmax, float phiMax); Bounding box for sphere, only z clipping thetas are derived from z

Intersection (algebraic solution) Perform in object space, WorldToObject(r, &ray) Assume that ray is normalized for a while Step 1

Algebraic solution If (B 2 -4AC<0) then the ray misses the sphere Step 2 Step 3 Calculate t 0 and test if t 0 <0 Step 4 Calculate t 1 and test if t 1 <0 check the real source code in sphere.cpp

Quadric (in pbrt.h) inline bool Quadratic(float A, float B, float C, float *t0, float *t1) { // Find quadratic discriminant float discrim = B * B - 4.f * A * C; if (discrim < 0.) return false; float rootDiscrim = sqrtf(discrim); // Compute quadratic _t_ values float q; if (B < 0) q = -.5f * (B - rootDiscrim); else q = -.5f * (B + rootDiscrim); *t0 = q / A; *t1 = C / q; if (*t0 > *t1) swap(*t0, *t1); return true; }

Why? Cancellation error: devastating loss of precision when small numbers are computed from large numbers by addition or subtraction. double x1 = ; double x2 = ; double y1 = ; double y2 = ; double z = (y1 - y2) / (x1 - x2); // 11.5

Range checking if (t0 > ray.maxt || t1 < ray.mint) return false; float thit = t0; if (t0 < ray.mint) { thit = t1; if (thit > ray.maxt) return false; }... phit = ray(thit); phi = atan2f(phit.y, phit.x); if (phi < 0.) phi += 2.f*M_PI; // Test sphere intersection against clipping parameters if (phit.z zmax || phi > phiMax) {... }

Geometric solution 1. Origin inside?

Geometric solution 2. find the closest point, t=-O ‧ D if t<0 and O outside return false t t D is normalized

Geometric solution 3. find the distance to the origin, d 2 =O 2 -t 2 if s 2 =r 2 -d 2 <0 return false; t r rd O s

Geometric solution 4. calculate intersection distance, if (origin outside) then t-s else t+s t r d O s t r d O s

Sphere Have to test sphere intersection against clipping parameters Fill in information for DifferentialGeometry –Position –Parameterization (u,v) –Parametric derivatives –Surface normal –Derivatives of normals –Pointer to shape

Partial sphere u=ψ/ψ max v=(θ-θ min )/ (θ max -θ min ) Partial derivatives (pp103 of textbook) Area (pp107)

Cylinder

Cylinder (intersection)

Disk

Disk (intersection) h-O z h t DzDz D

Other quadrics cone hyperboloidparaboloid

Triangle mesh The most commonly used shape. In pbrt, it can be supplied by users or tessellated from other shapes.

Triangle mesh class TriangleMesh : public Shape { … int ntris, nverts; int *vertexIndex; Point *p; Normal *n; per vertex Vector *s; tangent float *uvs; parameters } x,y,z … vi[3*i] vi[3*i+1] vi[3*i+2] p Note that p is stored in world space to save transformations. n and s are in object space.

Triangle mesh Pbrt calls Refine() when it encounters a shape that is not intersectable. Void TriangleMesh::Refine(vector > &refined) { for (int i = 0; i < ntris; ++i) refined.push_back(new Triangle(ObjectToWorld, reverseOrientation, (TriangleMesh *)this, i)); }

1.Intersect ray with plane 2.Check if point is inside triangle Ray triangle intersection

Algebraic Method Substituting for P, we get: Solution: Ray plane intersection

Algebraic Method For each side of triangle: end Ray triangle intersection I

Parametric Method Ray triangle intersection II

Ray triangle intersection III

Fast minimum storage intersection

O D V0V0 V1V1 V2V2 O D V0V0 V1V1 V2V2 1 1

Subdivision surfaces

Subdivision surfaces

Advantages of subdivision surfaces Smooth surface Existing polygon modeling can be retargeted Well-suited to describing objects with complex topology Easy to control localized shape Level of details

Geri’s game

Loop Subdivision Scheme Refine each triangle into 4 triangles by splitting each edge and connecting new vertices valence=4 valence=6 boundary interior

Loop Subdivision Scheme Where to place new vertices? –Choose locations for new vertices as weighted average of original vertices in local neighborhood even verticesodd vertices

Loop Subdivision Scheme Where to place new vertices? –Rules for extraordinary vertices and boundaries:

Butterfly subdivision Interpolating subdivision: larger neighborhood 1/21/21/21/2 1/21/21/21/2 -1 / 16 1/81/81/81/8 1/81/81/81/8