1 / 59

Simulation and Animation

Simulation and Animation. Fractals. Fractals and fractal landscapes. Fractals : „Die fraktale Geometrie der Natur“, B. Mandelbrot, Birkhäuser „The Science of Fractal Images“, H.-O. Peitgen , D.Saupe , Springer Verlag Fractal landscapes :

Télécharger la présentation

Simulation and Animation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Simulation and Animation Fractals

  2. Fractals and fractal landscapes Fractals: • „Die fraktale Geometrie der Natur“, B. Mandelbrot, Birkhäuser • „The Science ofFractal Images“, H.-O. Peitgen, D.Saupe, Springer Verlag Fractallandscapes: • „Texturing and Modeling, A Procedural Approach“ , D. Ebert et al. AP Professional, Cambridge – available in ourlibrary • www.wizardnet.com/musgrave/ • www.javaworld.com/javaworld/jw-08-1998/jw-08-step.html

  3. Fractals and fractal landscapes Fractalshapes in nature:

  4. How to generate fractal landscapes

  5. Midpoint Displacement • Random MidpointDisplacement • Interpolation anddisplacement • Decreasingrandomdisplacements in eachiteration

  6. Midpoint Displacement • Random displacements Di (i: subdivisionlevel) • Dihas normal distribution E[Di]=0 • Di = N(0,i2) = iN(0,1) • Standard deviation i • Variance(Di) = i2 =(i-1 1/2H)2  Xi+1(t) and 1/2H Xi(2t) arestatisticallyself-similar

  7. Midpoint Displacement • Terrain generation • Interpolatenewvaluesfromadjacentvalues • Add randomdisplacement • Values areinfluencedbyadjacentsquares • Creasesareintroducedbyearlyiterations New points Old points

  8. Midpoint Displacement • Terrain generation – the Diamond Square algorithm http://62.65.146.182/java/fractal/fract.htm http://users.bestweb.net/~hogdog/fractal.htm

  9. Midpoint Displacement Successiverefinements in 2D

  10. Fractals • Whatis a fractal • Well, many different fractalsexist

  11. Fractals • Fractal = abbreviationfor „Fractional Dimension“ • Anycurveorsurfacethatisindependentofscale–itlooksthe same over all rangesofscale • Ifblownup in scale, anypartappearsidenticaltothewhole • „Exact“ Self-Similarity (DeterministicFractals) • Iterationsof a scalingprocess Sierpinski-Triangle Koch-Curve

  12. Fractals Fractals • „Statistical“ Self-Similarity (StochasticFractals) • Ifblownup in scale, anypartappearsstatisticallysimilartothewhole

  13. Fractals • Fractionaldimension • Measureforthe„roughness“of a curve/surface • E.g. a roughcurvemay cover thesurfaceitisdefined on • Somewherebetweendimension N and N+1 • Characterizestheincreaseofmeasuredlengthbetweengivenpointsasscaledecreases • L: numberofself-similarpieces • s: lengthofthepieces (in units)

  14. Fractals • Fractional dimension • Example: The Koch-Curve • It fills more space than a line (D=1) but less space than a Euclidean area of the plane (D=2)

  15. Fractal generation processes • Pick a startingpoint (x0,y0). • Choose an indexiwitha givenprobabilityp • Computethenextpointasfollows: xn+1= aixn+ biyn+ eiyn+1= cixn+ diyn+ fi • Plot thenewpointandgotostep 2 i a b c d e f p 0 0.00.0 0.0 0.16 0.0 0.0 0.10 1 0.2 -0.26 0.23 0.22 0.0 1.6 0.08 2 -0.15 0.28 0.26 0.24 0.0 0.44 0.08 3 0.750.04 -0.04 0.85 0.0 1.60 0.74

  16. Fractal generation processes • IteratedFunction Systems • Repeatedtransformationof simple patterns on smallerandsmallerscales (bymeansof affine transformations) • Select transformation (fromsetofpossibletransformations) randomlywithcertainprobablity Example: Fern i a b c d e f p 0 0.0 0.0 0.0 0.16 0.0 0.0 0.10 1 0.2 -0.26 0.23 0.22 0.0 1.6 0.08 2 -0.15 0.28 0.26 0.24 0.0 0.44 0.08 3 0.75 0.04 -0.04 0.85 0.0 1.60 0.74

  17. Fractal generation processes • Mandelbrot Set • Evaluaterecursivelyforinitalpoints c in complex plane • Color points in the plane correspondingto rate ofdivergence

  18. Fractal generation processes • Julia Sets • Forfixed c, pointszion thecomplexplane forwhichdoesnot tendtoinfinity • Ormoregeneral: • zn+1 = f(zn) • E.g.: zn+1 = c sin(zn) zn+1 = c exp(zn)

  19. Fractal generation processes StochasticFractals

  20. Fractal generation processes • Stochastic Fractals • Simulation of Fractal Brownian motion (FBm) • Probability as a tool for modelling • Modelling of (dynamic) natural phenomena • Terrains, clouds, water etc. • Modelling and rendering of solid textures • Marble, wood etc. • Procedural shaders

  21. Stochastic fractals • Brownian Motion • Discovered 1827 by botanist R. Brown • Behavior of pollen in water • Describes the movement of small particles of solid matter in liquid • Mathematical examination by Einstein and Wiener • Dynamics of molecular collisions • Pollen particles being hit by water molecules • Used by Mandelbrot for the modelling of natural phenomena

  22. Stochasticfractals • Brownian Motion - a littlestatistics • Continuousrandom variable X • Probabilitydistributionfunction F(x) = P(Xx) • Probabilitydensityfunction f(x)  0 • Expectation E[X]: • VarianceVar[X] = E[(X-E[X])2]

  23. Stochasticfractals • Brownianmotion – a littlestatistics • Example: Gaussian Distribution N(,2)

  24. Stochasticfractals • Brownianmotion – „Random Walk Process“ • Brownianmotionis a stochastic (random) process • Describesthemovementof a particleover time t X(t+t) = X(t) + v · t · N(0,1) • X: particleposition • v: speedofparticle • N(0,1): normal distributedrandom variable

  25. Stochastic fractals • Brownianmotion – properties • The increments X(t2)-X(t1) haveGaussiandistribution E[X(t2) – X(t1)] = 0 • Var[X(t2) – X(t1)]  |t2-t1| • Continuous but nowheredifferentiable • Increments X(t+h)-X(t) areindependentof t • Brownianmotionisstationary

  26. Stochastic fractals • Brownianmotion • IfX(t0)=0  X(t) and X(rt)/r0.5arestatisticallyequivalent • Brownianmotion – morethannoise!

  27. Stochastic fractals • White noise (1/f0-noise) • Completelyuncorrelatedfrom sample to sample • Independent ofthepast • Flat spectrum – all frequencieswiththe same amountofenergy • Simulatedbythepseudo-randomgenerator

  28. Stochastic fractals • 1/f-noise • Itiscorrelatedfrom sample to sample • Lowerfrequenciescontributemost • Oftenfound in nature (clouds, water, growthprocesses) • E.g. Kolmogorovsspectrum • Complexgenerationprocess • See nextchapter

  29. Stochastic fractals • Brownianmotion • Itistheintegrationofwhitenoise – also called 1/f2-noise • More correlatedthanwhitenoiseand 1/f-noise • Correlated (constraint) random walk

  30. Stochastic fractals • FractalBrownianmotion (FBm) • Extension ofBrownianmotion • Var[X(t2) – X(t1)]  |t2-t1|2H • H: Hurst exponent • X(t), 1/rH X(rt) arestatisticallyself-similarwithrespectto H • 0  H  1 determinestheroughnessofthestructure

  31. Stochasticfractals • FractalBrownianmotion (FBm) H = 0.5: incrementsare not correlated • Brownianmotion H > 0.5: incrementshave positive correlation • Increasingly smoother curves H < 0.5: incrementshave negative correlation Increasinglyroughercurves

  32. Stochastic fractals • FractalBrownianmotion - 1/f-noise • Fractaldimension D = d+1-H = d + (3-)/2 • d: topologicaldimension • Curves: d=1: D = 2-H =(5-)/2 • Surfaces: d=2: D = 3-H =(7-)/2 • Volumes: d=3: D = 4-H =(9-)/2

  33. Stochastic fractals • FBm  = 1 D = 2  = 1.5 D = 1.75  = 2 (Bm) D = 1.5  = 2.5 D = 1.25  = 3 D = 1

  34. Stochastic fractals • Generation processes for (multi-dimensional) FBm • Midpoint displacement • „Sum of sawtooth waves of successively doubled and scaled frequencies“ • Rescale-and-Add • „Sum of band-limited random basis functions with scaled frequencies“ • Fourier domain synthesis • „Sum of sine-waves with random phase and scaled frequencies“ Citations from K. Musgraves PhD thesis

  35. Rescale-and-Add • Noise synthesis by point evaluation • Summation of scaled and dilated noise functions

  36. Rescale-and-Add Add weighted noiseoctaves to simulate 1/f-noise weights 1/20 1/21 1/22 1/23 1/24 1/25  =

  37. Rescale-and-Add Another method to simulate 1/f-noise Generate noisy copies on-the-fly from a base random field 1/24 1/23 1/22 = • • • 1/21 1/20

  38. Rescale-and-Add • Noise synthesisbypointevaluation • Summation ofscaledanddilatednoisefunctions • S: noisefunction • N(0,1) distributedrandomnumbersgiven on „integer lattice“ • Band-limited, smooth, continuous • r: lacunarity: averagesizeofgaps (typically r=2) • Addingnoiseoctavesatdecreasingfrequency but increasingamplitude

  39. Rescale-and-Add • Implementation of the Noise() function • Lattice noise • N(0,1) variables at grid points (lattice noise) • Multi-dimensional interpolation (value noise) • bi/tri-linearly • Spline-interpolation • Gradient noise • Compute pseudorandom gradients at grid points • Uniformly distributed over the unit circle (sphere in 3D) • For point p and each adjacent grid point compute • fraction = p – int[p] • gradient[int[p]] · fraction (is a scalar product) • Linearly interpolate results at p • Interpolation weights are 1- fraction

  40. Gradient Noise • Given an input point • For each of its neighboring grid points: • Pick a "pseudo-random" gradient vector • Compute linear function (dot product) • Take weighted sum, using thease curves + + + =

  41. Rescale-and-Add • Implementation of Noise() function • Memory optimization • Storing values at each grid point too expensive • Use hash table or permutation array • PermTab[N] = 5,1,28,43,11,... // permutation of first N-1 integers • NoiseTab[N] = 0.1, 0.7, ... // N N(0,1) random values • 2D example: Noise((int)x, (int)y) = NoiseTab[PermTab[(x+PermTab[y]) % N]]

  42. Rescale-and-Add • Localparametervariation • Fractaldimension D = d+1-H • Anisotropicfractaldimension in spaceandtime • Oftencalledmultifractals (heterogeneousfractals)

  43. Application of noise • Random surface texture • Color = white * noise(point)

  44. Application of noise • Colored noise • Color = Colormap (noise(k*point)) • k controls the feature size - the larger k is, the smaller the feature

  45. Application of noise • Classical Turbulence function(note similarity to Rescale-and-Add method) function turbulence(p) t = 0 scale = 1 while (scale > pixelsize) t += abs(Noise(p/scale)*scale) scale /= 2 return t

  46. Application of noise Simulating marble effects function marble(p) x = p[1] + rurbulence(p) return marble_color(sin(x))

  47. Application of noise Using turbulence to modulate sphere radius

  48. Fourier Domain Synthesis • Fourier transform • Two different approachestodescribe a function • Spatialdomain vs. frequencydomain • Every reasonablefunction f canberepresentedas a superpositionofharmonic (sin/cos) functions • Output is an imaginarynumber S(t)=R(t)+iI(t)=S(t)ei(t) • S(t) : amplitude • (t) : phaseangle

  49. Fourier Domain Synthesis • Fourier transform • Superposition of harmonic functions

  50. Fourier Domain Synthesis • The discrete Fourier transform of images • The sampled Fourier transform contains frequencies needed to represent the domain

More Related