cmsc427 parametric surfaces and alternatives generating
play

CMSC427 Parametric surfaces (and alternatives) Generating surfaces - PowerPoint PPT Presentation

CMSC427 Parametric surfaces (and alternatives) Generating surfaces From equations From data From curves Extrusion Straight Along path Lathing (rotation) Lofting 2 Constructive Solid Geometry (CSG)


  1. CMSC427 Parametric surfaces (and alternatives)

  2. Generating surfaces • From equations • From data • From curves • Extrusion • Straight • Along path • Lathing (rotation) • Lofting 2

  3. Constructive Solid Geometry (CSG) • Alternative/supplement to parametric shapes • Vocabulary: • Basic set of shapes (sphere, box, cylinder, etc) • Set operations on shapes • Union • Intersection • Difference • Demo • Tinkercad 3

  4. Constructive Solid Geometry (CSG) • Computer Aided Design (CAD) • Precise 3D modeling for industrial design • Less freeform, more control and feedback on shapes • Often compiled (openScad.org) cube([2,3,4]); translate([3,0,0]) { cube([2,3,4]); } color([1,0,0]) cube([2,3,4]); translate([3,0,0]) color([0,1,0]) cube([2,3,4]; translate([6,0,0]) color([0,0,1]) cube([2,3,4]); 4

  5. POVRAY • Stale but interesting ray tracing software • Scene description language (SDL) • Pixar’s Renderman #include "colors.inc" background { color Cyan } camera { location <0, 2, -3> look_at <0, 1, 2> } sphere { <0, 1, 2>, 2 texture { pigment { color Yellow } } } light_source { <2, 4, -3> color White } 5

  6. POVRAY • Support CSG operations union { box { <1, 1, 1>, <2, 2, 2> } sphere{ <1.5, 1.5, 1.5>, 1 } } 6

  7. Piecewise Bézier curves • Each segment spans four control points • Each segment contains four Bernstein polynomials • Each control point belongs to one Bernstein polynomial x 2 ( t ) x 0 ( t ) x 1 ( t ) x 3 ( t ) u = 12 u = 0 Bernstein polynomials u Segment 0 3 6 9 12 7

  8. Curved surfaces Curves • Described by a 1D series of control points • A function x ( t ) • Segments joined together to form a longer curve Surfaces • Described by a 2D mesh of control points • Parameters have two dimensions (two dimensional parameter domain) • A function x ( u,v ) • Patches joined together to form a bigger surface 8

  9. Parametric surface patch • x ( u,v ) describes a point in space for any given ( u,v ) pair • u,v each range from 0 to 1 x ( 0.8,0.7 ) v z 1 u y v x 0 1 u 2D parameter domain 9

  10. Parametric surface patch • x ( u,v ) describes a point in space for any given ( u,v ) pair • u,v each range from 0 to 1 x (0.8,0.7) v x (0.4 ,v ) x ( u, 0.25) z 1 u y v x 0 1 u • Parametric curves 2D parameter domain • For fixed u 0 , have a v curve x ( u 0 ,v ) • For fixed v 0 , have a u curve x ( u,v 0 ) • For any point on the surface, there is one pair of parametric curves that go through point 10

  11. Tangents • The tangent to a parametric curve is also tangent to the surface • For any point on the surface, there are a pair of (parametric) tangent vectors • Note: not necessarily perpendicular to each other ¶ x ¶ v v ¶ x ¶ u u 11

  12. Tangents Notation • Tangent along u direction or or • Tangent along v direction or or • Tangents are vector valued functions, i.e., vectors! 12

  13. Surface normal • Cross product of the two tangent vectors • Order matters (determines normal orientation) • Usually, want unit normal • Need to normalize by dividing through length ¶ x !" n ¶ v ¶ x ¶ u 13

  14. Bilinear patch • Control mesh with four points p 0 , p 1 , p 2 , p 3 • Compute x ( u,v ) using a two-step construction p 2 p 3 v p 0 p 1 u 14

  15. Bilinear patch (step 1) • For a given value of u , evaluate the linear curves on the two u - direction edges • Use the same value u for both: q 1 = Lerp(u, p 2 , p 3 ) q 1 p 2 p 3 v p 0 q 0 p 1 u q 0 = Lerp ( u, p 0 , p 1 ) 15

  16. Bilinear patch (step 2) • Consider that q 0 , q 1 define a line segment • Evaluate it using v to get x x = Lerp ( v , q 0 , q 1 ) q 1 p 2 p 3 x v p 0 q 0 p 1 u 16

  17. Bilinear patch • Combining the steps, we get the full formula x ( u , v ) = Lerp ( v , Lerp ( u , p 0 , p 1 ), Lerp ( u , p 2 , p 3 )) q 1 p 2 p 3 x v p 0 q 0 p 1 u 17

  18. Bilinear patch • Try the other order • Evaluate first in the v direction r 0 = Lerp ( v , p 0 , p 2 ) r 1 = Lerp ( v , p 1 , p 3 ) p 2 p 3 r 0 r 1 v p 0 p 1 u 18

  19. Bilinear patch • Consider that r 0 , r 1 define a line segment • Evaluate it using u to get x x = Lerp ( u , r 0 , r 1 ) p 2 p 3 x r 0 r 1 v p 0 p 1 u 19

  20. Bilinear patch • The full formula for the v direction first: x ( u , v ) = Lerp ( u , Lerp ( v , p 0 , p 2 ), Lerp ( v , p 1 , p 3 )) p 2 p 3 x r 0 r 1 v p 0 p 1 u 20

  21. Bilinear patch • It works out the same either way! x ( u , v ) = Lerp ( v , Lerp ( u , p 0 , p 1 ), Lerp ( u , p 2 , p 3 )) x ( u , v ) = Lerp ( u , Lerp ( v , p 0 , p 2 ), Lerp ( v , p 1 , p 3 )) q 1 p 2 p 3 x r 0 r 1 v p 0 q 0 p 1 u 21

  22. Bilinear patch • Visualization 22

  23. Bilinear patches • Weighted sum of control points • Bilinear polynomial • Matrix form exists, too 23

  24. Properties • Interpolates the control points • The boundaries are straight line segments • If all 4 points of the control mesh are co-planar, the patch is flat • If the points are not coplanar, get a curved surface • saddle shape, AKA hyperbolic paraboloid • The parametric curves are all straight line segments! • a (doubly) ruled surface: has (two) straight lines through every point • Not terribly useful as a modeling primitive 24

  25. Bicubic B é zier patch • Grid of 4x4 control points, p 0 through p 15 • Four rows of control points define B é zier curves along u p 0 ,p 1 ,p 2 ,p 3 ; p 4 ,p 5 ,p 6 ,p 7 ; p 8 ,p 9 ,p 10 ,p 11 ; p 12 ,p 13 ,p 14 ,p 15 • Four columns define B é zier curves along v p 0 ,p 4 ,p 8 ,p 12 ; p 1 ,p 6 ,p 9 ,p 13 ; p 2 ,p 6 ,p 10 ,p 14 ; p 3 ,p 7 ,p 11 ,p 15 p 12 p 13 p 8 v p 9 p 14 p 4 p 15 p 5 p 0 p 10 p 1 p 11 p 6 u p 7 p 2 p 3 25

  26. Bicubic B é zier patch (step 1) • Evaluate four u -direction B é zier curves at u • Get intermediate points q 0 … q 3 q 0 = Bez ( u , p 0 , p 1 , p 2 , p 3 ) q 1 = Bez ( u , p 4 , p 5 , p 6 , p 7 ) q 2 = Bez ( u , p 8 , p 9 , p 10 , p 11 ) q 3 = Bez ( u , p 12 , p 13 , p 14 , p 15 ) p 12 q 3 p 13 p 8 v p 9 p 14 p 4 p 15 p 5 q 2 q 1 p 0 p 10 p 1 p 11 p 6 q 0 u p 7 p 2 p 3 26

  27. Bicubic B é zier patch (step 2) • Points q 0 … q 3 define a B é zier curve • Evaluate it at v x ( u , v ) = Bez ( v , q 0 , q 1 , q 2 , q 3 ) p 12 q 3 p 13 p 8 v x p 9 p 14 p 4 p 15 p 5 q 2 q 1 p 0 p 10 p 1 p 11 p 6 q 0 u p 7 p 2 p 3 27

  28. Bicubic B é zier patch • Same result in either order (evaluate u before v or vice versa) q 0 = Bez ( u , p 0 , p 1 , p 2 , p 3 ) r 0 = Bez ( v , p 0 , p 4 , p 8 , p 12 ) q 1 = Bez ( u , p 4 , p 5 , p 6 , p 7 ) 1 = Bez ( v , p 1 , p 5 , p 9 , p 13 ) r q 2 = Bez ( u , p 8 , p 9 , p 10 , p 11 ) r 2 = Bez ( v , p 2 , p 6 , p 10 , p 14 ) Û q 3 = Bez ( u , p 12 , p 13 , p 14 , p 15 ) r 3 = Bez ( v , p 3 , p 7 , p 11 , p 15 ) x ( u , v ) = Bez ( v , q 0 , q 1 , q 2 , q 3 ) x ( u , v ) = Bez ( u , r 0 , r 1 , r 2 , r 3 ) p 12 q 3 p 13 r 0 r 1 p 8 v x p 9 p 14 p 4 p 15 p 5 q 2 r 2 r 3 q 1 p 0 p 10 p 1 p 11 p 6 q 0 u p 7 p 2 p 3 28

  29. T ensor product formulation • Corresponds to weighted average formulation • Construct two-dimensional weighting function as product of two one-dimensional functions • Bernstein polynomials B i , B j as for curves • Same tensor product construction applies to higher order Bézier and NURBS surfaces 29

  30. Bicubic Bézier patch: properties • Convex hull: any point on the surface will fall within the convex hull of the control points • Interpolates 4 corner points • Approximates other 12 points, which act as “handles” • The boundaries of the patch are the Bézier curves defined by the points on the mesh edges • The parametric curves are all B é zier curves 30

  31. Tangents of B é zier patch • Remember parametric curves x ( u,v 0 ), x ( u 0 ,v ) where v 0 , u 0 is fixed • Tangents to surface = tangents to parametric curves • Tangents are partial derivatives of x ( u,v ) • Normal is cross product of the tangents ¶ x p 13 p 12 ¶ v v 0 p 8 v x p 14 p 9 p 4 ¶ x p 15 p 5 ¶ u p 0 p 10 p 1 p 11 p 6 u 0 u p 7 p 2 31 p 3

  32. Tangents of B é zier patch q 0 = Bez ( u , p 0 , p 1 , p 2 , p 3 ) r 0 = Bez ( v , p 0 , p 4 , p 8 , p 12 ) q 1 = Bez ( u , p 4 , p 5 , p 6 , p 7 ) 1 = Bez ( v , p 1 , p 5 , p 9 , p 13 ) r q 2 = Bez ( u , p 8 , p 9 , p 10 , p 11 ) r 2 = Bez ( v , p 2 , p 6 , p 10 , p 14 ) q 3 = Bez ( u , p 12 , p 13 , p 14 , p 15 ) r 3 = Bez ( v , p 3 , p 7 , p 11 , p 15 ) ¶ x ¶ x ¶ v ( u , v ) = Be ¢ ¶ u ( u , v ) = Be ¢ z ( v , q 0 , q 1 , q 2 , q 3 ) z ( u , r 0 , r 1 , r 2 , r 3 ) ¶ x p 13 ¶ v p 12 r 0 q 3 r 1 p 8 v x p 14 p 9 p 4 ¶ x p 15 p 5 q 2 ¶ u r 2 r 3 q 1 p 0 p 10 p 1 p 11 p 6 q 0 u p 7 p 2 32 p 3

  33. T essellating a B é zier patch • Uniform tessellation is most straightforward • Evaluate points on uniform grid of u , v coordinates • Compute tangents at each point, take cross product to get per- vertex normal • Draw triangle strips (several choices of direction) • Adaptive tessellation/recursive subdivision • Potential for “cracks” if patches on opposite sides of an edge divide differently • Tricky to get right, but can be done 33

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend