constructive solid geometry (csg) and other modelling techniques€¦ · cosc342 constructive solid...
TRANSCRIPT
![Page 1: Constructive Solid Geometry (CSG) and other modelling techniques€¦ · COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21. Subdivision surfaces É A recursive](https://reader034.vdocuments.net/reader034/viewer/2022042521/5f56ac3b4e1d9d0e177ab7bb/html5/thumbnails/1.jpg)
Constructive Solid Geometry (CSG)and other modelling techniques
COSC342
Lecture 2112 May 2015
![Page 2: Constructive Solid Geometry (CSG) and other modelling techniques€¦ · COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21. Subdivision surfaces É A recursive](https://reader034.vdocuments.net/reader034/viewer/2022042521/5f56ac3b4e1d9d0e177ab7bb/html5/thumbnails/2.jpg)
There are many ways to model objects
É So far we have represented objects as sets of transformed, ray tracedprimitives.
É In this lecture we will explore some other techniques for modellingreal-world objects.
É Constructive Solid Geometry (CSG)
É Parametric Patches
É Subdivision Surfaces
É Implicit Surfaces
COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 2
![Page 3: Constructive Solid Geometry (CSG) and other modelling techniques€¦ · COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21. Subdivision surfaces É A recursive](https://reader034.vdocuments.net/reader034/viewer/2022042521/5f56ac3b4e1d9d0e177ab7bb/html5/thumbnails/3.jpg)
Constructive Solid Geometry (CSG)
COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 3
![Page 4: Constructive Solid Geometry (CSG) and other modelling techniques€¦ · COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21. Subdivision surfaces É A recursive](https://reader034.vdocuments.net/reader034/viewer/2022042521/5f56ac3b4e1d9d0e177ab7bb/html5/thumbnails/4.jpg)
Building a simple object using CSG
É A sequence of images from the (Otago) Mirage CSG engine built bystudent David Mason.
COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 4
![Page 5: Constructive Solid Geometry (CSG) and other modelling techniques€¦ · COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21. Subdivision surfaces É A recursive](https://reader034.vdocuments.net/reader034/viewer/2022042521/5f56ac3b4e1d9d0e177ab7bb/html5/thumbnails/5.jpg)
Direct ray tracing example
COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 5
![Page 6: Constructive Solid Geometry (CSG) and other modelling techniques€¦ · COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21. Subdivision surfaces É A recursive](https://reader034.vdocuments.net/reader034/viewer/2022042521/5f56ac3b4e1d9d0e177ab7bb/html5/thumbnails/6.jpg)
Our object and its CSG ‘tree’
É We show the two ‘subtract’ nodes in the CSG tree on the right.
É Yellow volumes are subtracted from our resulting shape.
−
−
COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 6
![Page 7: Constructive Solid Geometry (CSG) and other modelling techniques€¦ · COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21. Subdivision surfaces É A recursive](https://reader034.vdocuments.net/reader034/viewer/2022042521/5f56ac3b4e1d9d0e177ab7bb/html5/thumbnails/7.jpg)
Classifying the ray
É There are five intersections between the ray and CSG tree geometry:
É . . . these are labelled ‘a’ to ‘e’ in the figures below.
aedb c
−
−
COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 7
![Page 8: Constructive Solid Geometry (CSG) and other modelling techniques€¦ · COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21. Subdivision surfaces É A recursive](https://reader034.vdocuments.net/reader034/viewer/2022042521/5f56ac3b4e1d9d0e177ab7bb/html5/thumbnails/8.jpg)
Classification at a CSG subtract node
Right tree child
In Out Border
Lef
ttr
eech
ild In Out In Border
Out Out Out Out
Border Out Border “yuck”
COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 8
![Page 9: Constructive Solid Geometry (CSG) and other modelling techniques€¦ · COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21. Subdivision surfaces É A recursive](https://reader034.vdocuments.net/reader034/viewer/2022042521/5f56ac3b4e1d9d0e177ab7bb/html5/thumbnails/9.jpg)
Subtract nodes for our object
É Consider point ‘a’.
É It’s outside the hemisphere
É . . . and outside our object.
aedb c
a a
a
−
a
a
−
COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 9
Right tree childIn Out Border
Lef
tt.
c. In Out In BorderOut Out Out Out
Border Out Border
![Page 10: Constructive Solid Geometry (CSG) and other modelling techniques€¦ · COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21. Subdivision surfaces É A recursive](https://reader034.vdocuments.net/reader034/viewer/2022042521/5f56ac3b4e1d9d0e177ab7bb/html5/thumbnails/10.jpg)
Subtract nodes for our object
É Now consider point ‘b’.
É It’s outside hemisphere
É . . . and outside our object
aedb c
b b
b
−
b
b
−
COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 10
Right tree childIn Out Border
Lef
tt.
c. In Out In BorderOut Out Out Out
Border Out Border
![Page 11: Constructive Solid Geometry (CSG) and other modelling techniques€¦ · COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21. Subdivision surfaces É A recursive](https://reader034.vdocuments.net/reader034/viewer/2022042521/5f56ac3b4e1d9d0e177ab7bb/html5/thumbnails/11.jpg)
Subtract nodes for our object
É Next consider point ‘c’.
É It’s on hemisphere’s border
É . . . but still outside object
aedb c
c c
c
−
c
c
−
COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 11
Right tree childIn Out Border
Lef
tt.
c. In Out In BorderOut Out Out Out
Border Out Border
![Page 12: Constructive Solid Geometry (CSG) and other modelling techniques€¦ · COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21. Subdivision surfaces É A recursive](https://reader034.vdocuments.net/reader034/viewer/2022042521/5f56ac3b4e1d9d0e177ab7bb/html5/thumbnails/12.jpg)
Subtract nodes for our object
É Finally, consider point ‘d’.
É It’s inside the hemisphere
É . . . on our object’s border.
aedb c
d d
d
−
d
d
−
COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 12
Right tree childIn Out Border
Lef
tt.
c. In Out In BorderOut Out Out Out
Border Out Border
![Page 13: Constructive Solid Geometry (CSG) and other modelling techniques€¦ · COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21. Subdivision surfaces É A recursive](https://reader034.vdocuments.net/reader034/viewer/2022042521/5f56ac3b4e1d9d0e177ab7bb/html5/thumbnails/13.jpg)
Classification at an add node
Right tree child
In Out Border
Lef
ttr
eech
ild In In In In
Out In Out Border
Border In Border
COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 13
![Page 14: Constructive Solid Geometry (CSG) and other modelling techniques€¦ · COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21. Subdivision surfaces É A recursive](https://reader034.vdocuments.net/reader034/viewer/2022042521/5f56ac3b4e1d9d0e177ab7bb/html5/thumbnails/14.jpg)
Pros and cons of CSG
É Ø Engineering objects can be created easily.
É Ø CSG is directly ray traceable.
É Ø CSG can be used to compute volume properties.
É ✗ It is difficult to make free-form shapes.
COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 14
![Page 15: Constructive Solid Geometry (CSG) and other modelling techniques€¦ · COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21. Subdivision surfaces É A recursive](https://reader034.vdocuments.net/reader034/viewer/2022042521/5f56ac3b4e1d9d0e177ab7bb/html5/thumbnails/15.jpg)
Parametric patches
É Polygons are flat.
É Most objects have curved faces.
É Can we fit a mathematical curve through particular points in space?
É Can we fit a surface to points in space?
COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 15
![Page 16: Constructive Solid Geometry (CSG) and other modelling techniques€¦ · COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21. Subdivision surfaces É A recursive](https://reader034.vdocuments.net/reader034/viewer/2022042521/5f56ac3b4e1d9d0e177ab7bb/html5/thumbnails/16.jpg)
Curve fitting
É We can define y = f (x), e.g. f (x) = c1(x1 − x)(x2 − x)(x3 − x) + c2É Alternatively, we can define a start and end point and two control
points that influence curvature.É This is still just four pieces of information.
X
Y
X
Y
COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 16
![Page 17: Constructive Solid Geometry (CSG) and other modelling techniques€¦ · COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21. Subdivision surfaces É A recursive](https://reader034.vdocuments.net/reader034/viewer/2022042521/5f56ac3b4e1d9d0e177ab7bb/html5/thumbnails/17.jpg)
But how do we do this one?
É We are likely to want to fitcurves to shapes where y isn’tjust a function of x .
É We can use a parameter (e.g. t).
É Define two functions y = f1(t)and x = f2(t).
É Aside: this figure is defined by:x(t) = 0.9 + 0.9t cos t andy(t) = 0.4 + t sin t
X
Y
COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 17
![Page 18: Constructive Solid Geometry (CSG) and other modelling techniques€¦ · COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21. Subdivision surfaces É A recursive](https://reader034.vdocuments.net/reader034/viewer/2022042521/5f56ac3b4e1d9d0e177ab7bb/html5/thumbnails/18.jpg)
Defining a circle using a parameter, θ
θ
X
θ
Y
X
Y
COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 18
![Page 19: Constructive Solid Geometry (CSG) and other modelling techniques€¦ · COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21. Subdivision surfaces É A recursive](https://reader034.vdocuments.net/reader034/viewer/2022042521/5f56ac3b4e1d9d0e177ab7bb/html5/thumbnails/19.jpg)
Patches
É Beyond generating a curve in space, we can generate a surface if weuse two parameters: e.g. s and t.
É (The uv coordinates used in texture mapping are a similar concept.)
s
t
É Coordinates of point p = (x , y , z) on the green patch are given by:x = fx(s, t) y = fy (s, t) z = fz(s, t)
COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 19
![Page 20: Constructive Solid Geometry (CSG) and other modelling techniques€¦ · COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21. Subdivision surfaces É A recursive](https://reader034.vdocuments.net/reader034/viewer/2022042521/5f56ac3b4e1d9d0e177ab7bb/html5/thumbnails/20.jpg)
Function for x in a bicubic patch
É If we use degree 3 polynomials in s and t to define the x coordinateof point p, we get the following form of equation:
fx(s, t) =
x3,3s3t3+x3,2s
3t2+x3,1s3t+x3,0s
3+x2,3s
2t3+x2,2s2t2+x2,1s
2t+x2,0s2+
x1,3st3+ x1,2st
2+ x1,1st+x1,0s+x0,3t
3+ x0,2t2+ x0,1t+x0,0
É As well as these sixteen constant xi ,j coefficients, we need coefficientsfor y and z , for 48 in total!
É Often these coefficients will be grouped into 16 points ui ,.j .
COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 20
![Page 21: Constructive Solid Geometry (CSG) and other modelling techniques€¦ · COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21. Subdivision surfaces É A recursive](https://reader034.vdocuments.net/reader034/viewer/2022042521/5f56ac3b4e1d9d0e177ab7bb/html5/thumbnails/21.jpg)
Pros and cons of parametric patches
É Ø We can make a huge variety of shapes.
É Ø Smooth surfaces are produced.
É Ø Spheres and cylinders can be represented well.É ✗ It is difficult to coordinate boundary conditions.
É e.g. patches meeting other patches.
É ✗ Parametric patches only define the surface—there’s no ‘inside’.
COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21
![Page 22: Constructive Solid Geometry (CSG) and other modelling techniques€¦ · COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21. Subdivision surfaces É A recursive](https://reader034.vdocuments.net/reader034/viewer/2022042521/5f56ac3b4e1d9d0e177ab7bb/html5/thumbnails/22.jpg)
Subdivision surfaces
É A recursive approach to adding detail.
É For example, Catmull-Clark mesh subdivision:(steps are only sketched out here)
É Add a point at centroid of each face.É Add new ‘average’ edge points.É ‘Smooth out’ original vertices.
É In the limit, a cube becomes a sphere.
COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 22
![Page 23: Constructive Solid Geometry (CSG) and other modelling techniques€¦ · COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21. Subdivision surfaces É A recursive](https://reader034.vdocuments.net/reader034/viewer/2022042521/5f56ac3b4e1d9d0e177ab7bb/html5/thumbnails/23.jpg)
Implicit surfaces
É Instead of generating points p explicitly using parameters, e.g.
p =�
fx(s, t), fy (s, t), fz(s, t)�
É . . . implicitly define the conditions for a point p to be on a surface:f (p) = k
É For example, p2 = 1 defines a sphere.
É Usually f (p) will be a function of distance, such as the function below:
d
f (d)
maximum D
COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 23
![Page 24: Constructive Solid Geometry (CSG) and other modelling techniques€¦ · COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21. Subdivision surfaces É A recursive](https://reader034.vdocuments.net/reader034/viewer/2022042521/5f56ac3b4e1d9d0e177ab7bb/html5/thumbnails/24.jpg)
Example implicit surfaces
É Thermodynamics analogy: think of each red control point as a heater.
É The implicit surface is defined where the air temperature crosses acertain threshold.
COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 24
![Page 25: Constructive Solid Geometry (CSG) and other modelling techniques€¦ · COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21. Subdivision surfaces É A recursive](https://reader034.vdocuments.net/reader034/viewer/2022042521/5f56ac3b4e1d9d0e177ab7bb/html5/thumbnails/25.jpg)
Pros and cons of implicit surfaces
É Ø Intuitive overall construction concept.
É Ø Guaranteed inside/outside for objects—no holes.
É Ø Fairly easily ray traceable.
É Ø Can straightforwardly change topology.
É ✗ There is no obvious way to draw a surface.
É ✗ Good design seems to be by black art.
COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 25
![Page 26: Constructive Solid Geometry (CSG) and other modelling techniques€¦ · COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 21. Subdivision surfaces É A recursive](https://reader034.vdocuments.net/reader034/viewer/2022042521/5f56ac3b4e1d9d0e177ab7bb/html5/thumbnails/26.jpg)
Examples of various modelling techniques
CSG in CAD Parametric surface teapot
Implicit surfaces “Swirling sweepers”
COSC342 Constructive Solid Geometry (CSG) and other modelling techniques 26