CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides ›...
Transcript of CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides ›...
![Page 1: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes](https://reader030.fdocuments.in/reader030/viewer/2022041109/5f0cc6327e708231d43710a1/html5/thumbnails/1.jpg)
CMSC427Parametricsurfacesandpolygonalmeshes
![Page 2: CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides › L04P1SurfacesUpdated.pdf•StdExamples: Utah teapot, Stanford bunny. Topological properties of meshes](https://reader030.fdocuments.in/reader030/viewer/2022041109/5f0cc6327e708231d43710a1/html5/thumbnails/2.jpg)
• 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](https://reader030.fdocuments.in/reader030/viewer/2022041109/5f0cc6327e708231d43710a1/html5/thumbnails/3.jpg)
• 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](https://reader030.fdocuments.in/reader030/viewer/2022041109/5f0cc6327e708231d43710a1/html5/thumbnails/4.jpg)
• 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](https://reader030.fdocuments.in/reader030/viewer/2022041109/5f0cc6327e708231d43710a1/html5/thumbnails/5.jpg)
• 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](https://reader030.fdocuments.in/reader030/viewer/2022041109/5f0cc6327e708231d43710a1/html5/thumbnails/6.jpg)
• 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](https://reader030.fdocuments.in/reader030/viewer/2022041109/5f0cc6327e708231d43710a1/html5/thumbnails/7.jpg)
• 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](https://reader030.fdocuments.in/reader030/viewer/2022041109/5f0cc6327e708231d43710a1/html5/thumbnails/8.jpg)
• 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](https://reader030.fdocuments.in/reader030/viewer/2022041109/5f0cc6327e708231d43710a1/html5/thumbnails/9.jpg)
• 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](https://reader030.fdocuments.in/reader030/viewer/2022041109/5f0cc6327e708231d43710a1/html5/thumbnails/10.jpg)
• 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](https://reader030.fdocuments.in/reader030/viewer/2022041109/5f0cc6327e708231d43710a1/html5/thumbnails/11.jpg)
• 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](https://reader030.fdocuments.in/reader030/viewer/2022041109/5f0cc6327e708231d43710a1/html5/thumbnails/12.jpg)
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](https://reader030.fdocuments.in/reader030/viewer/2022041109/5f0cc6327e708231d43710a1/html5/thumbnails/13.jpg)
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](https://reader030.fdocuments.in/reader030/viewer/2022041109/5f0cc6327e708231d43710a1/html5/thumbnails/14.jpg)
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](https://reader030.fdocuments.in/reader030/viewer/2022041109/5f0cc6327e708231d43710a1/html5/thumbnails/15.jpg)
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](https://reader030.fdocuments.in/reader030/viewer/2022041109/5f0cc6327e708231d43710a1/html5/thumbnails/16.jpg)
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](https://reader030.fdocuments.in/reader030/viewer/2022041109/5f0cc6327e708231d43710a1/html5/thumbnails/17.jpg)
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](https://reader030.fdocuments.in/reader030/viewer/2022041109/5f0cc6327e708231d43710a1/html5/thumbnails/18.jpg)
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](https://reader030.fdocuments.in/reader030/viewer/2022041109/5f0cc6327e708231d43710a1/html5/thumbnails/19.jpg)
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](https://reader030.fdocuments.in/reader030/viewer/2022041109/5f0cc6327e708231d43710a1/html5/thumbnails/20.jpg)
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](https://reader030.fdocuments.in/reader030/viewer/2022041109/5f0cc6327e708231d43710a1/html5/thumbnails/21.jpg)
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](https://reader030.fdocuments.in/reader030/viewer/2022041109/5f0cc6327e708231d43710a1/html5/thumbnails/22.jpg)
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](https://reader030.fdocuments.in/reader030/viewer/2022041109/5f0cc6327e708231d43710a1/html5/thumbnails/23.jpg)
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](https://reader030.fdocuments.in/reader030/viewer/2022041109/5f0cc6327e708231d43710a1/html5/thumbnails/24.jpg)
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](https://reader030.fdocuments.in/reader030/viewer/2022041109/5f0cc6327e708231d43710a1/html5/thumbnails/25.jpg)
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](https://reader030.fdocuments.in/reader030/viewer/2022041109/5f0cc6327e708231d43710a1/html5/thumbnails/26.jpg)
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.