26
In the name of God Computer Graphics

In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

Embed Size (px)

Citation preview

Page 1: In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

In the name of God

Computer Graphics

Page 2: In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

Shortcomings So Far

• The representations we have looked at so far have various failings:– Meshes are large, difficult to edit, require normal

approximations, …

– Parametric instancing has a limited domain of shapes

– CSG is difficult to render and limited in range of shapes

– Implicit models are difficult to control and render

– Production rules work in highly limited domains

Page 3: In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

Fractal• A curve or geometrical figure each part of which has the same

statistical character as the whole.

Page 4: In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

Fractal Surfaces

• Fractals are objects that show self similarity• Fractal in nature like landscape & coastline

– Mountains have hills on them that have rocks on them – Continents have gulfs that have harbors that have …

• The natural way of building fractal surfaces is subdivision– Start with coarse features, Subdivide to finer features– Different types of fractals come from different subdivision

schemes and different parameters to those schemes

Page 5: In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

Fractals• Infinite detail at every point

• Self similarity between parts and overall features of the object

• Model– Terrain, clouds water, trees, plants, feathers, fur,

patterns

• General equation P1=F(P0), P2 = F(P1), P3=F(P2)…– P3=F(F(F(P0)))

Page 6: In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

Self similar fractals

• Parts are scaled down versions of the entire object– use same scaling on subparts– use different scaling factors for subparts

• Statistically self-similar– Apply random variation to subparts

• Trees, shrubs, other vegetation

Page 7: In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

Fractal types

• Statistically self-affine – random variations

– terrain, water, clouds

• Invariant fractal sets– Nonlinear transformations

• Self squaring fractals– Julia-Fatou set

» Squaring function in complex space

– Mandelbrot set

» Squaring function in complex space

• Self-inverse fractals– Inversion procedures

Page 8: In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

Julia-Fatou set

Foley/vanDam Computer Graphics-Principles and Practices, 2nd edition

Julia-Fatou

Page 9: In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

Mandelbrot   set

Foley/vanDam Computer Graphics-Principles and Practices, 2nd edition

Page 10: In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

Constructing a deterministic self-similar fractal

• Initiator– Given geometric shape

• Generator– Pattern which replaces subparts of initiator

• Koch Curve

Initiator generator First iteration

Page 11: In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

Fractal dimension• D=fractal dimension

– Amount of variation in the structure– Measure of roughness or fragmentation of the object

• Small d-less jagged• Large d-more jagged

• Self similar objects– nsd=1 (Some books write this as ns-d=1)

• s=scaling factor• n number of subparts in subdivision• d=ln(n)/ln(1/s)

– [d=ln(n)/ln(s) however s is the number of segments versus how much the main segment was reduced

» I.e. line divided into 3 segments. Instead of saying the line is 1/3, say instead there are 3 segments. Notice that 1/(1/3) = 3]

– If there are different scaling factors• • Sk

d=1K=1

n

Page 12: In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

Figuring out scaling factors

• Dimension is a ratio of the (new size)/(old size)– Divide line into n identical

segments• n=s

– Divide lines on square into small squares by dividing each line into n identical segments

• n=s2 small squares

– Divide cube• Get n=s3 small cubes

• Koch’s snowflake– After division have 4 segments

• n=4 (new segments)

• s=3 (old segments)

• Fractal Dimension– D=ln4/ln3 = 1.262

– For your reference: Book method• n=4

– Number of new segments

• s=1/3 – segments reduced by 1/3

• d=ln4/ln(1/(1/3))

Page 13: In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

Sierpinski Fractal

• Divide each side by 2– Makes 4 triangles– We keep 3– Therefore n=3

• Get 3 new triangles from 1 old triangle

– s=2 (2 new segments from one old segment)

• Fractal dimension – D=ln(3)/ln(2) = 1.585

Page 14: In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

Cube Fractal Dimension

• Apply fractal algorithm– Divide each side by 3– Now push out the middle face of each cube– Now push out the center of the cube

• What is the fractal dimension?– Well we have 20 cubes, where we used to have 1

• n=20

– We have divided each side by 3• s=3

– Fractal dimension ln(20)/ln(3) = 2.727

Page 15: In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

Particle Systems• System is defined by a collection of particles that evolve

over time• Def. subatomic constituent of physical world e.g. electron, photon,

neutron– Particles have fluid-like properties(no fixed shape, gas like)

• Flowing, billowing, splashing, expanding, imploding(collapse), exploding

– Basic particle can be any shape• Sphere, box, ellipsoid, etc

– Apply probabilistic rules to particles• generate new particles• Change attributes according to age

– What color is particle when detected?– What shape is particle when detected?– Transparancy over time?

• Particles die (disappear from system)• Movement

– Deterministic or stochastic laws of motion(Kinematically, forces such as gravity)

Page 16: In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

Particle Systems modeling• Model

– Fire, fog, smoke, fireworks, trees, grass, waterfall, water spray.

• Grass– Model clumps by setting up trajectory paths for

particles

• Waterfall– Particles fall from fixed elevation

• Splash to ground– Eg. drop, hit rock, finish in pool

– Drop, go to bottom of pool, float back up.

Page 17: In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

Physically based modeling• Non-rigid object

– Rope, cloth, soft rubber ball

• Describe behavior in terms of external and internal forces– Approximate the object with network of point nodes connected by flexible connection

• Example springs with spring constant k

– Homogeneous object

• Hooke’s Law– Fs=-k x

• x=displacement, Fs = restoring force on spring

• Could model with elastic material– Minimize strain energy

kk

kk

Page 18: In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

Fractal Terrain (1)

• Start with a coarse mesh– Vertices on this mesh won’t move, so they can be used to

set mountain peaks and valleys– Also defines the boundary– Mesh must not have dangling edges or vertices

• Every edge and every vertex must be part of a face

• Also define an “up” direction• Then repeatedly:

– Add new vertices at the midpoint of each edge, and randomly push them up or down

– Split each face into four

Page 19: In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

Fractal Terrain Example

A mountainside

Page 20: In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

Fractal Terrain Details

• There are options for choosing where to move the new vertices– Uniform random offset

– Normally distributed offset – small motions more likely

– Procedural rule – eg Perlin noise

• Scaling the offset of new points according to the subdivision level is essential– For the subdivision to converge to a smooth surface, the offset

must be reduced for each level

• Colors are frequently chosen based on “altitude”

Page 21: In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

Fractal Terrains

http://members.aol.com/maksoy/vistfrac/sunset.htm

Page 22: In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

Terrain, clouds generated using procedural textures and Perlin noisehttp://www.planetside.co.uk/ -- tool is called Terragen

Page 23: In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

Terrain, clouds generated using procedural textures and Perlin noisehttp://www.planetside.co.uk/ -- tool is called Terragen

Page 24: In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

Subdivision Operations

• Split an edge, create a new vertex and two new edges– Each edge must be split exactly once– Need to know endpoints of edge to create

new vertex

• Split a face, creating new edges and new faces based on the old edges and the old and new vertices– Require knowledge of which new edges to

use– Require knowledge of new vertex locations

Page 25: In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

Fractal Terrain Algorithm

• The hard part is keeping track of all the indices and other data• Same algorithm works for subdividing sphere

Split_One_Level(struct Mesh terrain)Copy old verticesfor all edges

Create and store new vertexCreate and store new edges

for all facesCreate new edges interior to faceCreate new faces

Replace old vertices, edges and faces

Page 26: In the name of God Computer Graphics. Shortcomings So Far The representations we have looked at so far have various failings: –Meshes are large, difficult

Data Structure Issues

• We must represent a polygon mesh so that the subdivision operations are easy to perform

• Questions influencing the data structures:– What information about faces, edges and

vertices must we have, and how do we get at it?– Should we store edges explicitly?– Should faces know about their edges?