Constructive solid Solid models and...

5
Solid models and fractals COM3404 Richard Everson School of Engineering, Computer Science and Mathematics University of Exeter [email protected] http://www.secamlocal.ex.ac.uk/studyres/COM304 Richard Everson 1 / 24 Outline 1 Constructive solid geometry 2 Metaballs 3 Fractals Dimension Examples Landscape generation 4 L-systems References Fundamentals of 3D Computer Graphics. Watt. Chapters 1 & 2 Computer Graphics: Principles and Practice. Foley et al (1995). Fractal Geometry of Nature. Mandelbrot. (1988). Richard Everson 2 / 24 Constructive solid geometry Models constructed from primitives using “volumetric Boolean” operations Primitives Cuboids, spheres, cylinders, prisms, cones. Operations union, intersection, subtraction Special algorithms (Goldfeather, SCS) for rendering the CSG without directly computing the 3D object representation. http://en.wikipedia.org/wiki/Constructive solid geometry Richard Everson 4 / 24 Constructive solid geometry Representation Stored in an attributed tree Nodes Combining operation Leaves Primitives Logic The logic underlying the model is preserved in the tree. Alteration Dimensions of primitives are easily altered. Limitations Limited range of operations to construct models Detailed modifications to a local region may be difficult because Boolean operations are global: e.g., blending at joins is difficult. Specific rendering algorithms or conversion to polygon form Richard Everson 5 / 24

Transcript of Constructive solid Solid models and...

  • Solid models and fractalsCOM3404

    Richard Everson

    School of Engineering, Computer Science and MathematicsUniversity of Exeter

    [email protected]

    http://www.secamlocal.ex.ac.uk/studyres/COM304

    Richard Everson 1 / 24

    Outline

    1 Constructive solidgeometry

    2 Metaballs3 Fractals

    DimensionExamplesLandscape generation

    4 L-systems

    References

    Fundamentals of 3D Computer Graphics. Watt. Chapters 1 & 2Computer Graphics: Principles and Practice. Foley et al (1995).Fractal Geometry of Nature. Mandelbrot. (1988).

    Richard Everson 2 / 24

    Constructive solid geometry

    Models constructed from primitives using “volumetric Boolean” operations

    Primitives Cuboids, spheres,cylinders, prisms, cones.

    Operations union,intersection, subtraction

    Special algorithms(Goldfeather, SCS) forrendering the CSG withoutdirectly computing the 3Dobject representation.

    http://en.wikipedia.org/wiki/Constructive solid geometry

    Richard Everson 4 / 24

    Constructive solid geometry

    Representation Stored in an attributed tree

    Nodes Combining operationLeaves Primitives

    Logic The logic underlying the model is preserved in the tree.

    Alteration Dimensions of primitives are easily altered.

    Limitations

    Limited range of operations to construct modelsDetailed modifications to a local region may bedifficult because Boolean operations are global:e.g., blending at joins is difficult.Specific rendering algorithms or conversion topolygon form

    Richard Everson 5 / 24

    [email protected]://www.secamlocal.ex.ac.uk/studyres/COM304http://en.wikipedia.org/wiki/Constructive_solid_geometry

  • Implicit functions and metaballs

    r = (x , y , z)

    Define a function f (r) on all of the modelling space.

    Surface of a model is the contour or iso-surface

    f (r) = const

    Examplef (x , y) = (x − x0)2 + (y − y0)2

    f (x , y) = c2 defines a circle ofradius c centred at (x0, y0)

    x0 = 1, y0 = 0.5, contour f (x , y) = 82

    −10 −8 −6 −4 −2 0 2 4 6 8 10−10

    −8

    −6

    −4

    −2

    0

    2

    4

    6

    8

    10

    40

    60

    80

    100

    120

    140

    160

    180

    200

    Richard Everson 7 / 24

    Metaballs

    SourcesDefine potential function as asum of ‘sources’ with locationand strength.

    −10 −8 −6 −4 −2 0 2 4 6 8 10−10

    −8

    −6

    −4

    −2

    0

    2

    4

    6

    8

    10

    0.2

    0.3

    0.4

    0.5

    0.6

    0.7

    0.8

    0.9

    Example

    f (x , y) = exp{−[(x + 5)2 + (y + 5)2]/60

    }+1.5 exp

    {−[(x − 5)2 + (y − 5)2]/60

    }Thick contour at f (r) = 0.8.

    Richard Everson 8 / 24

    Metaballs

    Richard Everson 9 / 24

    Metaballs

    Negatively weighted sourcescan be used to sculptconcavities

    −10 −8 −6 −4 −2 0 2 4 6 8 10−10

    −8

    −6

    −4

    −2

    0

    2

    4

    6

    8

    10

    0

    0.2

    0.4

    0.6

    0.8

    1

    Example

    f (x , y) = exp{−[(x + 5)2 + (y + 5)2]/60

    }+1.5 exp

    {−[(x − 5)2 + (y − 5)2]/60

    }− exp

    {−[x2 + (y − 4)2]/5

    }Thick contour at f (r) = 0.8.

    Richard Everson 10 / 24

  • Metaballs

    Richard Everson 11 / 24

    Fractals

    Fractals

    Objects that are self similar on a wide range of scales

    Self similarWhen a component part isappropriately magnified itappears identical to the whole.

    Koch curveSierpinski gasket

    Approximately self similarMany naturally occurring objectsare statistically self-similar overa range of scales

    Coast line of Great BritainCloudsAlveoli in lungs

    Richard Everson 13 / 24

    Generating fractals: Koch curve

    Initiator The initial shape

    Generator At each stage theinitiator is replace by a copy of thegenerator

    Length at each stage is:

    N = 1 L =(

    43

    )N = 2 L = (4/3)× 13 × 4 =

    (43

    )2N = 3 L =

    (43

    )3N L =

    (43

    )NlimN→∞ L(N) = ∞

    Richard Everson 14 / 24

    Dimension

    Line Dimension of a line is 1because if it is divided into N partseach looks like the original scaled

    down by N11

    Plane Divide a square into N: each

    looks like the original scaled by N12

    Koch curve Each of the 4 pieces ofthe Koch curve looks like theoriginal scaled down by a factor 3.Dimension d

    41/d = 3

    d = log(4)/ log(3) = 1.26...

    Fractals have non-integer dimension

    Richard Everson 15 / 24

  • Examples

    3D Sierpinski gaskets Julia set

    Richard Everson 16 / 24

    Fractal fern

    Generated by repeated affine transformations.

    Iterated function systems: Michael Barnsley “Fractals Everywhere”,Academic Press (1988).

    Richard Everson 17 / 24

    Recursive subdivision for meshes

    Divide generator in two and displace vertically by a random amount

    Divide triangular facet edges into two, forming 4 smaller facetsVertically displace the midpoints by random amountsRichard Everson 18 / 24

    Fractal terrain

    Naive methods tend to produce‘creases’; alleviated by usingoverlapping hexagonal grids.

    In real landscapes the statisticalproperties of hills and valleysdiffer. Choose displacementsfrom an asymmetric distributionso that small displacements aremore probable.

    Landscapes may have a manypolygons; problematic forrendering algorithms.

    Richard Everson 19 / 24

  • Fractal terrain

    Fractal terrain rendered with POV-Ray

    Generated by fracplanet

    See also terragen

    Richard Everson 20 / 24

    L-systems

    Lindenmayer systems

    Grammar to describe branching processes

    Alphabet { A, B, [, ], (, ) }Production

    A → AAB → A[B]AA(B)

    1 A

    2 AA

    3 AAAA

    1 B

    2 A[B]AA(B)

    3 AA[A[B]AA(B)]AAAA(A[B]AA(B))

    Associate [. . .] with a left branch

    Associate (. . .) with a right branch

    Richard Everson 22 / 24

    L-systems

    B

    B

    A

    A

    A

    B

    B

    B

    B

    B

    A

    A

    A

    A

    A

    A

    A

    A

    AA

    A

    A

    A[B]AA(B)

    AA[A[B]AA(B)]AAAA(A[B]AA(B))

    Richard Everson 23 / 24

    L-system trees

    Rich alphabets

    Symbols only become effective at later stages of production

    Randomised variations in geometric interpretation of symbols, e.g.branching angles, width of cylinders forming trunks.

    Richard Everson 24 / 24

    Constructive solid geometryMetaballsFractalsDimensionExamplesLandscape generation

    L-systems