CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides ›...
Transcript of CMSC427 Parametric surfaces and polygonal meshes › ~reastman › slides ›...
CMSC427Parametricsurfacesandpolygonalmeshes
• Theseslidesareincomplete• SeeaccompanyingPDFwithdetailedoutline• Willdevelopmanyequationsinclass• Readinglatertosupplement
Note
• Polygonalmeshes• SetofstandardshapesinBlender
• Andhowtocreatethem• Andstorethem• Anddrawthem
Moving to 3D
• Blendingoffour3Dpoints• Ruledsurface• Sweptoutbysequenceoflines
Bilinear patch
P0
P1 P2
P3
• Blendsimultaneouslyalongtwolines• P01=t(P1-P0)+P0• P23=t(P2-P3)+P3• Sametin[0,1]
Bilinear patch
P0
P1 P2
P3
P01P23
• 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
• 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
• 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
• What’shappeninginthissurface?
Coons patch
• What’shappeninginthissurface?
• Blendingtwoarcs• Isthisaruledsurface?
Coons patch
• Blendfourarbitrarycurves
• HereC1,C2,D1,D2
Coons patch
Circle with trig: review
Parametricequation
t
𝑥 = 𝑅cos(𝑡)
𝑦 = 𝑅sin(𝑡)cos(𝑡)
sin(𝑡)
0 ≤ 𝑡 ≤? ?
Parametric cone
r
h
Parametric cylinder
r
h
Rendering faces: need location and normal
• Needdistanceandorientationrelativetolightstocomputereflectedlight
Polygonal mesh
• Simplestmesh:tetrahedron• Indexedmeshrepresentation• Vertexlist• Normallist• Facelist
• Non-indexedrepresentation• Listoffaceswithrepeatedvertices
Polygonal mesh
• Hill’sbarn• 10vertices• 7faces• 7normals
Polygonal mesh
• Hill’sbarn• 10vertices• 7faces• 7normals
• Solutionforoneface:• Facevertices(CCW):
• 56789• Facenormals:
• 55555
• Alternative:triangulate• Face1:567,Face2:579,Face3:789
Drawing mesh
• Drawaspoints:iteratethroughpoints• Drawaslines:iteratethroughadj.pts.infaces• Problem?• Alternative:addedgelisttostructure• Alternative:betterlinkfacestoavoidredundancy
• Drawas”solid”:iteratethroughfaces
File formats
• STL• https://en.wikipedia.org/wiki/STL_(file_format)
• OBJ• https://en.wikipedia.org/wiki/Wavefront_.obj_file
• Manyothers
• NothardtogenerateyourownSTLfiles
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
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
Topological properties of meshes
• Isameshwellconnected?• Anyflaws?• Morelater
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
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 >
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.