26
CMSC427 Parametric surfaces and polygonal meshes

CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

CMSC427Parametricsurfacesandpolygonalmeshes

Page 2: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

• Theseslidesareincomplete• SeeaccompanyingPDFwithdetailedoutline• Willdevelopmanyequationsinclass• Readinglatertosupplement

Note

Page 3: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

• Polygonalmeshes• SetofstandardshapesinBlender

• Andhowtocreatethem• Andstorethem• Anddrawthem

Moving to 3D

Page 4: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

• Blendingoffour3Dpoints• Ruledsurface• Sweptoutbysequenceoflines

Bilinear patch

P0

P1 P2

P3

Page 5: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

• Blendsimultaneouslyalongtwolines• P01=t(P1-P0)+P0• P23=t(P2-P3)+P3• Sametin[0,1]

Bilinear patch

P0

P1 P2

P3

P01P23

Page 6: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

• Blendsimultaneouslyalongtwolines• P01=tP1+(1-t)P0• P23=tP3+(1-t)P2• Sametin[0,1]

• Thenblendbetweenthetwolines

• P=sP23+(1-s)P01• P=s(tP1+(1-t)P0)+(1-s)(tP3+(1-t)P2)

Bilinear patch

P0

P1 P2

P3

P01P23

P

Page 7: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

• Questions• Whatorderpolynomial?• Convexcombination?• Whatisdrawniftisconstant?• Whatisdrawnifsisconstant?

• P=s(tP1+(1-t)P0)+(1-s)(tP3+(1-t)P2)

Bilinear patch

P0

P1 P2

P3

P01P23

P

Page 8: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

• Questions• Whatorderpolynomial?• Convexcombination?• Whatisdrawniftisconstant?• Whatisdrawnifsisconstant?

• P=s(tP1+(1-t)P0)+(1-s)(tP3+(1-t)P2)• P=stP1+s(1-t)P0+(1-s)tP3+(1-s)(1-t)P2

Bilinear patch

P0

P1 P2

P3

P01P23

P

Page 9: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

• What’shappeninginthissurface?

Coons patch

Page 10: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

• What’shappeninginthissurface?

• Blendingtwoarcs• Isthisaruledsurface?

Coons patch

Page 11: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

• Blendfourarbitrarycurves

• HereC1,C2,D1,D2

Coons patch

Page 12: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

Circle with trig: review

Parametricequation

t

𝑥 = 𝑅cos(𝑡)

𝑦 = 𝑅sin(𝑡)cos(𝑡)

sin(𝑡)

0 ≤ 𝑡 ≤? ?

Page 13: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

Parametric cone

r

h

Page 14: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

Parametric cylinder

r

h

Page 15: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

Rendering faces: need location and normal

• Needdistanceandorientationrelativetolightstocomputereflectedlight

Page 16: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

Polygonal mesh

• Simplestmesh:tetrahedron• Indexedmeshrepresentation• Vertexlist• Normallist• Facelist

• Non-indexedrepresentation• Listoffaceswithrepeatedvertices

Page 17: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

Polygonal mesh

• Hill’sbarn• 10vertices• 7faces• 7normals

Page 18: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

Polygonal mesh

• Hill’sbarn• 10vertices• 7faces• 7normals

• Solutionforoneface:• Facevertices(CCW):

• 56789• Facenormals:

• 55555

• Alternative:triangulate• Face1:567,Face2:579,Face3:789

Page 19: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

Drawing mesh

• Drawaspoints:iteratethroughpoints• Drawaslines:iteratethroughadj.pts.infaces• Problem?• Alternative:addedgelisttostructure• Alternative:betterlinkfacestoavoidredundancy

• Drawas”solid”:iteratethroughfaces

Page 20: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

File formats

• STL• https://en.wikipedia.org/wiki/STL_(file_format)

• OBJ• https://en.wikipedia.org/wiki/Wavefront_.obj_file

• Manyothers

• NothardtogenerateyourownSTLfiles

Page 21: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

Meshlab

• Freeviewingsoftware:Meshlab• (http://www.meshlab.net)• Goodforviewing,repairing,decimatingmeshes

• Sourcesof3Dmeshmodels:• SketchFab (https://sketchfab.com)• Thingiverse (https://www.thingiverse.com)• Stanfordrepository(http://graphics.stanford.edu/data/3Dscanrep/)

• Std Examples:Utahteapot,Stanfordbunny

Page 22: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

Generating polygonal mesh from parametric surface

• Step1:

• Sourcesof3Dmeshmodels:• SketchFab (https://sketchfab.com)• Thingiverse (https://www.thingiverse.com)• Stanfordrepository(http://graphics.stanford.edu/data/3Dscanrep/)

• Std Examples:Utahteapot,Stanfordbunny

Page 23: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

Topological properties of meshes

• Isameshwellconnected?• Anyflaws?• Morelater

Page 24: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

Generating mesh from parametric surface

• Givenparametricsurface• P(u,v)=<x(u,v),y(u,v),z(u,v)>

• Generatemesh• Steps:• 1.Set#divisionsinu,v asn,m• 2.Generateu,vinforloops• 3.Storein2Darrayof3Dpoints• 4.Fromarraygeneratefaces

i= 0 1 2 3 4u= u0 u1 u2 u3 u4j= v=

0

1

2

3

4

v0

v1

v2

v3

v4

faceV0

V1 V2

V=<x,y,z>V3

Page 25: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

Computing normal vectors for mesh

• Approach1:Crossproductofnumericdata• Findv1andv2fromvertices(which?)• N=v1xv2• Lessarbitrary:Newell’smethod

• Approach2:Partialderivativesofparametriccurve• GivenvectorP(u,v)=<x(u,v),y(u,v),z(u,v)>• DerivevectorsdU =dP(u,v)/duanddV =dP(u,v)/dv• N=dU xdV

• Approach3:Gradientvectorofimplicitsurface• Givenimplicitfunctionf(x,y,z)• Derivegradient<df/dx,df/dy,df/dz >

Page 26: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes

Creating polygonal meshes: summary

• Fixedshapes.• Anyshapebasedonidiosyncraticdata,suchastheexactshapeofastone,foot,sculpture,etc.Allhard-coded,somefromrealworlddatacollection

• Regularpolyhedron• Cubes,tetrahedrons,icosahedrons,dodecahedrons,...

• Operationsthatcreateshapes• Extrusion• Lathing(surfacesofrotation)• Surfacesubdivision

• Parametricshapes(relatedtooperations)• Bilinearpatches,quadrics,superellipses,etc.