<<

CS 430/536 Computer I Overview • 3D model representations : • Mesh formats Surfaces • Bicubic surfaces • Bezier surfaces Week 8, Lecture 16 • Normals to surfaces

David Breen, William Regli and Maxim Peysakhov • Direct rendering Geometric and Intelligent Computing Laboratory Department of Computer Science Drexel University 1 2 http://gicl.cs.drexel.edu 1994 Foley/VanDam/Finer/Huges/Phillips ICG

3D Modeling Representing 3D Objects

• 3D Representations • Exact • Approximate – Wireframe models – Surface Models – Wireframe – Facet / Mesh – Solid Models – Parametric • Just surfaces – Meshes and Polygon soups – /Volume models Surface – Voxel – Decomposition-based – Solid Model • Volume info • Octrees, • CSG • Modeling in 3D – Constructive Solid (CSG), • BRep Breps and feature-based • Implicit

3 4

Negatives when Representing 3D Objects Representing 3D Objects • Exact • Approximate • Exact • Approximate – Complex data structures – Lossy – Precise model of – A discretization of – Expensive algorithms – Data structure sizes can object the 3D object – Wide variety of formats, get HUGE, if you want each with subtle nuances good fidelity – Mathematically – Use simple – Hard to acquire data – Easy to break (i.e. cracks represent all primitives to – Translation required for can appear) rendering – Not good for certain geometry model topology applications • Lots of interpolation and and geometry guess work

5 6

1

Positives when Exact Representations Representing 3D Objects • Exact • Approximate • Wireframe – Precision – Easy to implement • Simulation, modeling, • Parametric Surface etc – Easy to acquire – Lots of modeling • 3D scanner, CT • Solid Model environments – Physical properties – Easy to render – operations – Many applications (tool • Direct mapping to the path generation, motion, – CSG, BRep, implicit geometry etc.) – Lots of algorithms – Compact

7 8

Wireframes Issues with Wireframes

• Basic idea: • Visually ambiguous – Represent the model • No surfaces! as the set of all of its – What’s inside? What’s outside? edges – Hidden removal? • What does validity entail? • Example: – Don’t we just have a bunch of wires? A simple cube – Do they need to add up to something? – 12 lines • How to model wireframe shapes? – 8 vertices – Wire by wire? Not very easy!

• How about the faces? 9 11

Foley/VanDam, 1990/1994

Surface Models 3D Mesh File Formats

• Basic idea: Some common formats – Represent a model as a set of • STL faces/patches • Limitations: • SMF – Topological integrity; how do faces “line up”?; which way is ‘inside’/ ‘outside’? • OpenInventor • Used in many CAD applications • VRML – Why? They are fine for drafting and rendering, not as good for creating true

physical models 12 13

2

Minimal Full-Featured

• Vertex + Face • Colors / Transparency • Vertex-Face Normals (optional, can be computed) • No colors, normals, • Scene Graph or texture • Lights • Textures • Primarily used to • Views and Navigation demonstrate geometry algorithms

14 15

Simple Mesh Format (SMF) Stereolithography (STL)

• Michael Garland http://graphics.cs.uiuc.edu/~garland/ • Triangle data + Face Normal

• Triangle data • The de-facto standard for • Vertex indices begin at 1

16 17

How STL Works Open Inventor

• Developed by SGI • Predecessor to VRML – Scene Graph

18 20

3

Virtual Reality Modeling Issues with 3D “mesh” formats Language (VRML) • Easy to acquire • SGML Based • Easy to render • Harder to model with • Scene-Graph • Error prone – split faces, holes, gaps, etc • Full Featured

21 22

BRep Data Structure BRep Data Structures • Vertex structure • Winged-Edge Data – X,Y,Z Structure (Weiler) – Pointers to n coincident edges • Vertex • Edge structure – 2 pointers to end-point vertices – n edges – 2 pointers to adjacent faces • Edge – Pointer to next edge – 2 vertices – Pointer to previous edge – 2 faces • Face structure • Face – Pointers to m edges – m edges 23 24

Pics/Math courtesy of Dave Mount @ UMD-CP

Biparametric Surfaces Bicubic Surfaces

• Biparametric surfaces • Recall the 2D : – A generalization of parametric – G: Geometry – 2 parameters: s, t (or u, v) – M: Basis Matrix – Two parametric functions – S: Polynomial Terms [s3 s2 s 1] • For 3D, we allow the points in G to vary in 3D along t as well:

25 26

4

Observations About Bicubic Surfaces Bicubic Surfaces

• For a fixed t1, • Each is , where is a curve • Gradually

incrementing t1 to t2, we get a new curve • Transposing , we get • The combination of these curves is a surface • are 3D curves

27 28

Bicubic Surfaces Bicubic Surfaces

• Substituting into , • Writing out we get Q(s, t) gives

• The g11, etc. are the control points for the Bicubic surface patch:

29 30

Faceting Bézier Surfaces

• Bézier Surfaces (similar definition)

32 33

5

Plotting Isolines Faceting

34 35

Bézier Surfaces: Example Bézier Surfaces

• C0 and G0 continuity can be achieved between two patches by setting • the 4 boundary modeled by 32 control points to be Bézier Patches with equal G1 continuity • G1 continuity achieved when cross-wise CPs are co-linear 36 37

Bezier Surface: Example B-spline Surfaces

• Increased facet resolution • Rendered

• Representation for B-spline patches • C2 continuity across boundaries is automatic with B-splines

38 39

6

Computing the Normals to Surfaces Normals to Surfaces • Normals used for • For a bicubic surface, – first, compute the s tangent vector – Interference detection in robotics – Calculating offsets for numerically controlled machining

40 41

Computing the Computing the Normals to Surfaces Normals to Surfaces • Next, compute the t tangent vector: • Since s and t are tangent to the surface, their cross product is the normal vector to the surface! t

• xs - x component of s tangent

• ys - y component of s tangent • z - z component of s tangent 42 s 43

Drawing Parametric Surfaces Direct Rendering

• Usually done “patch by patch” • Use a scan-line algorithm • Two choices – Evaluate pixel by pixel – Draw/render directly from the parametric – Problem: How to go from (x,y) “screen description space” to point on the 3D patch – Approximate the surface with a polygon • Easy for a planar polygon where we know max/min y, equations for edges, screen depth mesh, then draw/render the mesh • Not as easy for parametric surfaces

45 46

7

Direct Scan Conversion of Issues for Direct Rendering Patches • Max/Min y coords may not lie on boundaries • Basic idea • Silhouette edges result from patch bulges – Find intersection of – Need to track both silhouettes and boundaries patch with XZ • What if they intersect? • Producing a planar curve • Note: patch edges need not be monotonic in x or y – Draw the curve • De Boor, D’Casteljeau • Idea: Scan convert patch plane-by-plane, using scan planes instead of scan lines – Note: if doing rendering, one can compute pixel- by-pixel color values this way

47 – Patch: x=X(u,v), y=Y(u,v), z=Z(u,v) 48

Object Space Conversion: Patch to Polygon Conversion Uniform Subdivision Two methods: Basic Procedure • Object Space Conversion • Cut parameter space into equal parts – Techniques • Uniform subdivision • Find new points on the surface • Non-uniform subdivision – Resolution: depends on object space • Recurse/Repeat “until done” • Image Space Conversion • Split squares into – Resolution: depends on pixels and screen triangles • Render 50 51

Object Space Conversion: Image Space Conversion Non-Uniform Subdivision • Basic idea • Idea: control subdivision based on – More facets in areas of high screen criteria – Use change in normals to surface to – Minimum pixel area assess curvature • Stop when patch is basically one pixel • More derivatives – Screen flatness – Break patch into sub-patches based on • Stop when patch converges to a polygon curvature changes – Screen flatness of silhouette edges • Stop when edge is straight or size of pixel

52 53

8

How do I know if I’ve found a silhouette edge?

• If the viewing ray is tangent to the surface at the point it hits the surface! N • L = 0 – Where N is the normal at the point where L, the line of sight, hits the surface

54

9