geometric modeling for computer...

33
mjb – August 23, 2020 1 Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx This work is licensed under a Creative Commons Attribution-NonCommercial- NoDerivatives 4.0 International License Mike Bailey [email protected]

Upload: others

Post on 13-Oct-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

1

Computer Graphics

Geometric Modeling for Computer Graphics

GeometricModeling.pptx

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License

Mike [email protected]

Page 2: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

2

Computer Graphics

What do we mean by “Modeling”?

How we model geometry depends on what we would like to use the geometry for:

• Looking at its appearance

• Interacting with its shape?

• How does it interact with its environment?

• What is its surface area and volume?

• Will it need to be 3D-printed?

• Etc.

Page 3: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

3

Computer Graphics

Explicitly Listing Geometry and Topology

Models can consist of thousands of vertices and faces – we need some way to list them efficiently

http://graphics.stanford.edu/data/3Dscanrep

This is called a Mesh.If it’s in nice neat rows like this, it is called a Regular Mesh. If it’s not, it is called an Irregular Mesh, or oftentimes called a Triangular Irregular Network, or TIN.

Page 4: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

4

Computer Graphics

Cube Example

3

2

1

5

4

76

Page 5: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

5

Computer Graphics

static GLfloat CubeVertices[ ][3] ={

{ -1., -1., -1. },{ 1., -1., -1. },{ -1., 1., -1. },{ 1., 1., -1. },{ -1., -1., 1. },{ 1., -1., 1. },{ -1., 1., 1. },{ 1., 1., 1. }

};static GLfloat CubeColors[ ][3] ={

{ 0., 0., 0. },{ 1., 0., 0. },{ 0., 1., 0. },{ 1., 1., 0. },{ 0., 0., 1. },{ 1., 0., 1. },{ 0., 1., 1. },{ 1., 1., 1. },

};

static GLuint CubeQuadIndices[ ][4] ={

{ 0, 2, 3, 1 },{ 4, 5, 7, 6 },{ 1, 3, 7, 5 },{ 0, 4, 6, 2 },{ 2, 6, 7, 3 },{ 0, 1, 5, 4 }

};

Explicitly Listing Geometry and Topology

0 1

32

4 5

76

Page 6: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

6

Computer Graphics

GLuint CubeQuadIndices[ ][4] ={

{ 0, 2, 3, 1 },{ 4, 5, 7, 6 },{ 1, 3, 7, 5 },{ 0, 4, 6, 2 },{ 2, 6, 7, 3 },{ 0, 1, 5, 4 }

};

The Cube Can Also Be Defined with Triangles

0 1

32

4 5

76

GLuint CubeTriangleIndices[ ][3] ={

{ 0, 2, 3 },{ 0, 3, 1 },{ 4, 5, 7 },{ 4, 7, 6 },{ 1, 3, 7 },{ 1, 7, 5 },{ 0, 4, 6 },{ 0, 6, 2 },{ 2, 6, 7 },{ 2, 7, 3 },{ 0, 1, 5 }{ 0, 5, 4 }

};

Page 7: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

7

Computer Graphics

3D Printing uses an Irregular Triangular Mesh Data Format

Page 8: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

8

Computer Graphics

3D Printing uses a Triangular Mesh Data Format

Page 9: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

9

Computer Graphics

Go Beavs – mmmmmm!

Page 10: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

10

Computer Graphics

Meshes Can Be Smoothed

Page 11: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

11

Computer Graphics

Editing the Vertices of a Mesh

Original Pulling on a single Vertex Pulling on a Vertex with Proportional Editing Turned On

“Circle of Influence”

Page 12: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

12

Computer Graphics

Remember Venn Diagrams (2D Boolean Operators) from High School?

Two Overlapping Shapes Union: AB

Difference: A-BIntersection: AB

A B

Page 13: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

13

Computer Graphics

Well, Welcome to Venn Diagrams in 3D

Two Overlapping Solids

This is often called Constructive Solid Geometry, or CSG

Union: AB

Difference: A-BIntersection: AB

A

B

Page 14: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

14

Computer Graphics

Two Overlapping Solids Union: AB

Difference: A-BIntersection: AB

Geometric Modeling Using 3D Boolean Operators

Page 15: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

15

Computer Graphics

Another way to Model:Curve Sculpting – Bézier Curve Sculpting

3 2 2 30 1 2 3( ) (1 ) 3 (1 ) 3 (1 )P t t P t t P t t P t P

P0

P1P2

P3

0. 1.t

where P represents

Page 16: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

16

Computer Graphics

t goes from 0.0 to 1.0 in whatever increment you’d like

P0

P1P2

P3

0. 1.t

t=0.0t=0.2

t=0.4 t=0.6 t=0.8

t=1.0

You draw the curve as a series of lines

GL_LINE_STRIP is a good topology for this

Page 17: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

17

Computer Graphics

Curve Sculpting – Bézier Curve Sculpting Example

P0

P1 P2

P3

Page 18: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

18

Computer Graphics

Curve Sculpting – Bézier Curve Sculpting Example

Moving a single control point moves its entire curve

A Small Amount of Input Change Results in aLarge Amount of Output Change

Page 19: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

19

Computer Graphics

The Yellow 4-Point Bézier Curve

1

2

30

3

0

Page 20: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

20

Computer Graphics

Another way to Model:Curve Sculpting – Catmull-Rom Curve Sculpting

P0

P1P2

P3

0. 1.t 𝑥𝑦𝑧

where P represents

𝑃 𝑡 0.5 ∗ 2 ∗ 𝑃 𝑡 ∗ 𝑃 𝑃 𝑡 2 ∗ 𝑃 5.∗ 𝑃 4𝑃 𝑃 𝑡 𝑃 3𝑃 3𝑃 𝑃

The Catmull-Rom curve consists of any number of points.The first point influences how the curve starts.The last point influences how the curve ends.The overall curve goes smoothly through all other points.

To draw the curve, grab points 0, 1, 2, and 3, call them P0, P1, P2, and P3, and loop through the following equation, varying t from 0. to 1. in an increment of your own choosing:

For each set of 4 points, this equation just draws the line between the second and third points. That’s why you keep having to use subsequent sets of 4 points 0

1

2

3

Page 21: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

21

Computer Graphics

Another way to Model:Curve Sculpting – Catmull-Rom Curve Sculpting

P1P2

P3For each set of 4 points, this equation just draws the line between the second and third points. That’s why you keep having to use subsequent sets of 4 points

To draw the curve, grab points 0, 1, 2, and 3, call them P0, P1, P2, and P3, and loop through the equation, varying t from 0. to 1. in an increment of your own choosing.

Then, grab points 1, 2, 3, and 4, call them P0, P1, P2, and P3, and loop through the same equation.

Then, grab points 2, 3, 4, and 5, call them P0, P1, P2, and P3, and loop through the same equation

And so on…

0

1

2

3

4

5

A Small Amount of Input Change Results in aLarge Amount of Output Change

Page 22: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

22

Computer Graphics

The Yellow 6-Point Catmull-Rom Curve

0, 51

2 3

4

14

0, 5

Page 23: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

23

Computer Graphics

Another way to Model:Bézier Surface Sculpting

Wireframe SurfaceMoving a single point moves its entire surface

A Small Amount of Input Change Results in aLarge Amount of Output Change

Page 24: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

24

Computer Graphics

Surface Equations can also be used for Analysis

Showing Contour Lines Showing Curvature

Page 25: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

25

Computer Graphics

This is often called a “Lattice” or a “Cage”.

Another Way to Model: Volume Sculpting

lattice.mp4

A Small Amount of Input Change Results in aLarge Amount of Output Change

Slip a simpler object (e.g., a subdivided cube) around some of the object’s vertices. As you sculpt the simpler object, all those object vertices get sculpted too.

Page 26: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

26

Computer Graphics

Voxelization as a Way to Model 3D Geometry

Randy Rauwendaal

Page 27: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

27

Computer Graphics

Metaball Objects

Page 28: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

28

Computer Graphics

Metaball ObjectsThe cool thing is that, if you move them close enough together, they will “glom” into a single object

Page 29: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

29

Computer Graphics

Metaball Objects Can Be Turned into Meshes for Later Editing

Page 30: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

30

Computer Graphics

Modeling → Simulation (Explosion)

Page 31: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

31

Computer Graphics

Object Modeling Rules for 3D Printing

The object must be a legal solid. It must have a definite inside and a definite outside. It can’t have any missing face pieces.

Missing face

“Definite inside and outside” is sometimes called “Two-manifold” or “Watertight”

Page 32: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

32

Computer Graphics

The Simplified Euler's Formula* for Legal Solids

F – E + V = 2

0 1

32

4 5

76

For a cube, 6 – 12 + 8 = 2

F FacesE EdgesV Vertices

*sometimes called the Euler-Poincaré formula

The full formula is:

F – E + V – L = 2( B – G )

F FacesE EdgesV VerticesL Inner Loops (within faces)B BodiesG Genus (number of through-holes)

Page 33: Geometric Modeling for Computer Graphicsweb.engr.oregonstate.edu/~mjb/cs550/PDFs/GeometricModeling.1p… · Computer Graphics Geometric Modeling for Computer Graphics GeometricModeling.pptx

mjb – August 23, 2020

33

Computer Graphics

Object Modeling Rules for 3D Printing

Overlapped in 3D -- bad Boolean union -- good

Objects cannot pass through other objects. If you want two shapes together, do a Boolean union on them so that they become one complete object.