2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford...

42
Me Again! Peter Chapman | Bradford University Peter Chapman [email protected] [email protected] – if it’s important / time-sensitive Issues? Working on something specific? Need some direction? Don’t hesitate to get in touch 2016 | Intro to 3D | Week 03 | Modelling

Transcript of 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford...

Page 1: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Me Again!

Peter Chapman | Bradford University

Peter Chapman

[email protected]@gmail.com – if it’s important / time-sensitive

Issues? Working on something specific? Need some direction?

Don’t hesitate to get in touch

2016 | Intro to 3D | Week 03 | Modelling

Page 2: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Modelling

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

Page 3: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Lecture Outline

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• 3D production pipeline

• Modelling methods

• Polygons

• Issues and problems• Some maths

• Vectors• Matrices & transformations• Homogeneous coordinates

• Curves• Types• Nurbs

Page 4: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

3D Production Pipeline

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

Agree? Disagree?

Page 5: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Modelling

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• There are many ways to model objects: • None of these are right or wrong

• Different modelling methods suit different objects and different people

• Try some or all of these methods to see which suits you and the type of objects you want to create.

Page 6: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Types of Modelling

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• Boundary modelling• Polygonal• Extrusions and surfaces of revolution• Patches (think 3d-curves)

• Procedural modelling• Fractals

• 2d models created by equations• Implicit surfaces

• 3d models created by equations• Volumetric models

• Constructive Solid Geometry (CSG) (i.e. booleon)

Page 7: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Solid Modelling

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• Volumetric representations are often used in engineering applications where properties such as mass are often important

Page 8: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Surface Modelling

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• Boundary representations usually used in animation since we are concerned with the look of the object

Page 9: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Editing Models

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• Adding detail• Subdivision• Adding/merging/deleting points

• Booleans• Transformations

Page 10: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Polygonal ModellingBasics

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• Start with a point in 3D space• If we connect two points together we create a line segment

(a 1D object)• If we connect three or more points together to form a

closed loop, the interior of the loop can be considered to be a 2D object, or a polygon

• If we position several of these polygons adjacent to each other we can form a surface

• If this surface is closed, we have created a polyhedron

Page 11: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Why use Polygons?

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• Polygons can approximate any shape, even curved ones• Increasing the number of polygons can make the polygonal

representation indistinguishable from the original shape at the expense of hardware limitations

• Polygons can be easily handled by a computer because they are just sets of points and points are just sets of floating point numbers

Page 12: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Polygon Models

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• We can build an approximation of any shape using polygons, which in turn are made up of points, which are made up of 3 coordinates, x, y and z

• Technically Polygons can have any number of sides >= 3• When we model we should remember certain important

points...

Page 13: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Polygon Models

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• When a computer renders our model it needs to know the angle of the surface to the light and the viewer

• To do this it needs to calculate the normal to the surface, the vector that represents the direction that the surface is facing.

• This can be easy or hard depending on the nature of the polygon...

Page 14: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Polygons

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

Consider a four-sided polygon:

• To calculate the normal, we can take the cross-product of the two vectors representing two of the sides

• This works because all the points in this example are coplanar: we would get the same normal from any two sides

• But what if we raise one vertex?

Page 15: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Polygons

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• How do we calculate the normal now that we no longer have straight edges?

• We can’t since the surface doesn’t point in one direction any more

• This can cause major problems for renderers• Solution is to only use triangles, or be certain that your

polygons are coplanar

Page 16: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Polygons

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

Page 17: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Polygons

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• The normal also defines the side of the polygon that is visible: it is invisible from the other side

• This is because it has no thickness.• i.e. a single polygon could not exist in the real world

• We can cheat and use double sided polygons• i.e. they have a normal pointing out of both sides of

them• This is generally bad practice and the mark of crap

modelling• Always think of how the object will be animated when at

the modelling stage

Page 18: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Polygons

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

Page 19: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Starting from Primitives

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• Basic building blocks of many complex shapes are the primitives

• These can be used to directly construct the shape• They can also be used as a cage for curved surface

modelling

Page 20: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Adding Details to Primitives

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• You can use other primitives to add or remove parts of your model (booleans)• Bad modelling technique in most cases!

• You can subdivide your model• You can extrude faces and edges• You can directly add or remove (or merge) points or edges• You can create edge loops• You can slice through faces using a knife

Page 21: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Starting from Points

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• Use Create Polygon tool to draw polygons one by one• Very time consuming but gives ultimate control• Final model is very efficient (i.e. no wasted points)• You can also extrude edges to fill in the space but in this

case you need to remember to merge your vertices when you are finished.

Page 22: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

How do we store the points?

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• Store points (the vertices)• These must have 3 dimensions, i.e. one more than on our

computer screen• We need to be able to transform these (e.g. scale, rotate,

translate…)• Store indices into the vertex storage for each face

Page 23: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Three dimensional coordinates

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• To define a point in a three dimensional world we need a third coordinate

• In the coordinate system, x is usually running left to right, y is usual upwards and z is usually considered to be directed into (or out of!) the screen in computer systems

Page 24: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Example: a cube

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

Vertices:0.5,0.5,-0.5 -0.5,0.5,-0.5 -0.5,-0.5,-0.5 0.5,-0.5,-0.50.5,0.5,0.5 0.5,-0.5,0.5-0.5,-0.5,0.5 -0.5,-0.5,0.5

Faces:0,1,2,3 4,5,6,74,0,3,5 1,7,6,20,4,7,1 5,3,2,6

Triangles:0,1,3 1,2,3 4,0,33,5,4 4,5,7 5,6,70,4,1 4,7,1 7,1,62,1,6 6,3,2 6,5,3

0

32

1

4

56

7

X

ZY

(0.5,-0.5,-0.5)

(0.5,-0.5,0.5)

(0.5,0.5,0.5)(-0.5,0.5,0.5)

(-0.5,0.5,-0.5)

(-0.5,-0.5,-0.5)

(-0.5,-0.5,0.5)

(0.5,0.5,-0.5)

Page 25: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

But..

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• We need each vertex to point in three directions, not just one

• So we have to store three normals for each corner, i.e. a minimum of 24 vertices

Page 26: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Curves

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• Need to represent curves: very few objects that we need to model have straight edges

• In most modelling programs the final model is approximated with polygons

• Curves can be 2D or 3D• There are many ways we can represent curves...

Page 27: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Curve Representation

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• Line segments (polyline)• Simple set of points• Awkward to edit• Large number of points needed• Never truly smooth

• Splines• Control points affect regions of curve• Easy to reshape & truly curved• Compact and efficient to store• Actual curve is a mathematical representation• Usually cubic splines

Page 28: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Splines

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• Control points can affect curve in different ways• Two main categories• Interpolating spline• Approximating spline

Page 29: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Interpolating Splines

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• Curve passes through control points• Easy to place curve precisely• Difficult to make completely smooth

• E.g. Cardinal spline• Passes through all but first and last control point

EP Curve

Page 30: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Interpolating Splines

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• Curve passes through control points• Easy to place curve precisely• Difficult to make completely smooth

• E.g. Cardinal spline• Passes through all but first and last control

point

• Irregularly placed control points destroys continuity

Page 31: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Approximating Splines

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• Curves passes near control points• E.g. Bézier curves, B-splines (‘Basis’ Splines) and NURBS

(Non-Uniform Rational B-Splines)

Page 32: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Bézier Curves

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• Four control points on minimal curve• Uses tangent vectors to control curvature

Page 33: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Bézier Curves

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• Equation defines the points on the curve:

1 and 0

between varies and curve theeffecting points

control theare ),( & ),( where

)1(3)1(3)1()(

)1(3)1(3)1()(

),(End),,(Start

22

2

3

1

3

22

2

3

1

3

2211

t

yxyx

yttyttytytty

xttxttxtxttx

yxyx

ddcc

dc

dc

Page 34: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Bézier Curves

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• Demo on Maya

Page 35: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

B-Splines

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• Generalisation of Bézier curve• Curve doesn’t extend to first and last control points• Control points only influence local part of curve• You’re unlikely to use these

Page 36: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

NURBS

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• Non-Uniform Rational B-Splines• Curve passes through first and last control points but not

intermediate ones• Has ‘knots’ on the curve which can be moved as well as

normal control points• Combines best features of interpolating and approximating

splines

Page 37: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Features of Curves

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• All curves have a start and an end. This means we can define points on the curve as t along curve from start

• A parameter defines how far along the curve the point is, so these are called parameterised curves

• Can be used to define curved surfaces by moving the curve through space

• Moving the spline along a path defined by a second spline creates a patch (or a bicubic patch if both splines are bicubiccurves)

• Type of patch depends on type of splines used to create it (e.g. A B-spine patch or Bézier patch)

• This creates a network of control points, each of which can be moved individually

Page 38: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Curves in Maya

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• EP Curves• CV Curves• Nurbs Surfaces (Patches)

Page 39: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Subdivision Surfaces

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• We used to have a specific type for this (and some software still uses this legacy format)

• Now we just press ‘3’• This will not smooth

objects in some rendering engines and the model needs to subdivided or converted

Page 40: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Cross Product

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

Given two vectors, A and B, the cross product is defined as:A B = Cwhere C is another vector calculated by:C = ( ya zb – yb za , za xb – zb xa , xa yb – xb ya )

The length of C is given by:|C| = |A||B|sin( )where is the angle between A and B

Page 41: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Questions?

Peter Chapman | Bradford University

Course | Industry | Me | Anything!

2016 | Intro to 3D | Week 03 | Modelling

Page 42: 2016 | Intro to 3D | Week 03 | Modelling Me Again!€¦ · Lecture Outline Peter Chapman | Bradford University 2016 | Intro to 3D | Week 03 | Modelling • 3D production pipeline

Polygons cont.

Peter Chapman | Bradford University

2016 | Intro to 3D | Week 03 | Modelling

• An advantage of triangles is that they must be convex• This makes it easier to render again as the computer can

calculate the inside and outside areas of the polygon• Useful for applications with limited hardware