Grafika Komputer dan Visualisasi Disusun oleh : Silvester Dian Handy Permana, S.T., M.T.I. Fakultas Telematika, Universitas Trilogi Pertemuan 12 : Realisme.

Slides:



Advertisements
Similar presentations
1 Line replacement approach Koch Star (Snowflake) Area replacement approach Sierpenski Triangle Iterated Function System approach Heighway Dragon CSE
Advertisements

40S Applied Math Mr. Knight – Killarney School Slide 1 Unit: Sequences Lesson: SEQ-L3 Drawing Fractal Patterns Drawing Fractal Patterns Learning Outcome.
ATEC Procedural Animation Introduction to Procedural Methods in 3D Computer Animation Dr. Midori Kitagawa.
Play the Chaos Game Learn to Create Your Own Fractals.
Complex Dynamics and Crazy Mathematics Dynamics of three very different families of complex functions: 1.Polynomials (z 2 + c) 2. Entire maps ( exp(z))
FIELD DAY TOK: Mathematics and Imagination
Chaos, Communication and Consciousness Module PH19510 Lecture 15 Fractals.
Fractals everywhere ST PAUL’S GEOMETRY MASTERCLASS II.
FRACTALS. WHAT ARE FRACTALS? Fractals are geometric figures, just like rectangles, circles, and squares, but fractals have special properties that those.
So far we’ve done… Dynamics and chaos Thermodynamics, statistical mechanics, entropy, information Computation, Turing machines, halting problem Evolution,
L systems (Aristid Lindenmayer)
Chapter 9: Recursive Methods and Fractals E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
Fractals Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University of New.
Simulating Trees with Fractals and L-Systems Eric M. Upchurch CS 579.
Course Website: Computer Graphics 11: 3D Object Representations – Octrees & Fractals.
The Wonderful World of Fractals
CS 4731: Computer Graphics Lecture 5: Fractals Emmanuel Agu.
CS39N The Beauty and Joy of Computing Lecture #11 Recursion III It has been a challenge to power electronic components implanted within a body.
CS4395: Computer Graphics 1 Fractals Mohan Sridharan Based on slides created by Edward Angel.
College of Computer and Information Science, Northeastern UniversityAugust 12, CS G140 Graduate Computer Graphics Prof. Harriet Fell Spring 2007.
Approaches To Infinity. Fractals Self Similarity – They appear the same at every scale, no matter how much enlarged.
Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 9.7 Non-Euclidean Geometry and Fractal Geometry.
Bruce Wayne Fractals. What is a Fractal? According to Benoit Mandelbrot … “A fractal is by definition is a set for which the Hausdorff-Besicovitch dimension.
"Clouds are not spheres, mountains are not cones, coastlines are not circles, and bark is not smooth, nor does lightning travel in a straight line."(Mandelbrot,
Mandelbrot Set the Who Is Mandelbrot?  Benoit Mandelbrot –Mandelbrot was born in Poland in He studied mathematics in France under Gaston Julia.
Amgad Hussein, Maria Tokarska, Edward Grinko, Dimitar Atassanov, Megan Varghese, Emilio Asperti.
Chapter 9: Geometry.
Computing & Information Sciences Kansas State University Lecture 37 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 37 of 42 Monday, 28 April.
Structured Chaos: Using Mata and Stata to Draw Fractals
1 Excursions in Modern Mathematics Sixth Edition Peter Tannenbaum.
Fractals. Similar Figures Same shape Corresponding angles are congruent Corresponding sides are proportional.
RECURSION Recursion Towers of Hanoi To Recurse or to Loop? Fractals Do something!
Introduction Introduction: Mandelbrot Set. Fractal Geometry ~*Beautiful Mathematics*~ FRACTAL GEOMETRY Ms. Luxton.
4/15/04© University of Wisconsin, CS559 Spring 2004 Last Time More modeling: –Hierarchical modeling –Instancing and Parametric Instancing –Constructive.
Chaos Theory and the Financial Markets Why Do Fractals Matter ?
CS 376 Introduction to Computer Graphics 04 / 30 / 2007 Last Lecture :( Instructor: Michael Eckmann.
L-Systems and Procedural Plants CSE 3541 Matt Boggus.
College of Computer and Information Science, Northeastern UniversityOctober 13, CS U540 Computer Graphics Prof. Harriet Fell Spring 2007 Lecture.
Ch 9 Infinity page 1CSC 367 Fractals (9.2) Self similar curves appear identical at every level of detail often created by recursively drawing lines.
Examining the World of Fractals. Myles Akeem Singleton Central Illinois Chapter National BDPA Technology Conference 2006 Los-Angeles, CA.
Introduction to TouchDevelop
Fractals smooth surfaces and regular shapes - Euclidean-geometry methods -object shapes were described with equations natural objects - have irregular.
Subdivision Schemes Basic idea: Start with something coarse, and refine it into smaller pieces for rendering –We have seen how subdivision may be used.
Strategies and Rubrics for Teaching Chaos and Complex Systems Theories as Elaborating, Self-Organizing, and Fractionating Evolutionary Systems Fichter,
David Chan TCM and what can you do with it in class?
{ Fractals, iterations and the Sierpinski Triangle an iterative approach Central Arizona College Science Night at San Tan Campus.
Koch Curve How to draw a Koch curve.. Start with a line segment (STAGE 0) *Divide the line into thirds *In the middle third produce an equilateral triangle.
Section 6.1 Images Viewing a Gallery of Fractals. Look for patterns.
ATEC Procedural Animation Introduction to Procedural Methods in 3D Computer Animation Dr. Midori Kitagawa.
Fractals Ed Angel Professor Emeritus of Computer Science
 Introduction  Definition of a fractal  Special fractals: * The Mandelbrot set * The Koch snowflake * Sierpiński triangle  Fractals in nature  Conclusion.
Fractals. What do we mean by dimension? Consider what happens when you divide a line segment in two on a figure. How many smaller versions do you get?
Fractals Cassi Blum.
Fractal Art. What is Fractal Art? A fractal is a geometric shape that has self similarity, that is it can be split into pieces that are approximate reduced.
Functions. functions: a collection of lines of code with a name that one can call. Functions can have inputs and outputs.
Creating a Hat Curve Fractal Objectives: 1.To create a Hat Curve fractal on Geometer’s Sketchpad using iteration. 2.To find the length of the Hat Curve.
A Primer on Chaos and Fractals Bruce Kessler Western Kentucky University as a prelude to Arcadia at Lipscomb University.
1 What did we learn before?. 2 line and segment generation.
Grammars, L-Systems Jim Whitehead UC Santa Cruz School of Engineering courses.soe.ucsc.edu/courses/cmps265/Spring14/01 23 Apr 2014.
Fractals and L-Systems
Iterative Mathematics
Iterative Mathematics
Tuesday, January 22, 2013 Agenda: TISK & 2 MM Review HW answers
Fractals Project Natalie Rowe.
ATCM 3310 Procedural Animation
Including Complex Dynamics in Complex Analysis Courses
Exercise (1) What does function chai draw? def chai(size):
S.K.H. Bishop Mok Sau Tseng Secondary School
The Wonderful World of Fractals
The Mystery of the Fractal
Presentation transcript:

Grafika Komputer dan Visualisasi Disusun oleh : Silvester Dian Handy Permana, S.T., M.T.I. Fakultas Telematika, Universitas Trilogi Pertemuan 12 : Realisme Virtual

This Week Pendekatan – Fraktal dan Kesamaan Diri – Sistem Fungsi Iteratif (Iterative Function Systems) – Sistem Lindenmayer – Kurva – Citra alami (pohon, landscapes, dll) – Kompresi Fraktal – Set Mandelbrot dan set Julia – Fractal Landscapes

Introduction What is a Fractal? – A fractal is an image with self-similar properties produced by recursive or iterative algorithmic means. “anything which has a substantial measure of exact or statistical self-similarity” – Mandelbrot coined the term from the latin fractus meaning “fragmented” or “irregular”

Introduction Why use fractals in Computer Graphics? Most real world objects are inherently smooth. Most real world objects cannot be represented by simple prisms and ellipsoids. Most real world objects cannot best be described by fixed mathematical curves (e.g. sin, cos etc..)

Introduction Although curves can represent natural phenomena they can become very complex e.g. Trees, Mountains, Water, Clouds etc... Clouds are not spheres, coastlines are not circles, bark is not smooth, nor does lightning travel in straight lines. -Mandelbrot

Introduction Fractals are useful for representing natural shapes such as trees, coastlines, mountains, terrain and clouds. Magnification of these things review smaller self-similar copies of the entire image.

Branches are self-similar Roots are self-similar

Fractal Curve Refinement The Koch Snowflake Very complex curves can be fashioned recursively by repeatedly refining the curve. Koch Curve: subdivide each segment of Kn into three equal parts, and replace the middle part with a bump in the shape of an equilateral triangle.

Fractal Curve Refinement //dir - turtle angle //len - length of line segment //n - number of iterations void drawKoch(double dir, double len,int n) { double dirRad = * dir; // in radians if(n == 0) cvs.forward(len,1); else{ n--;// reduce the order len /= 3;// and the length drawKoch(dir, len, n); dir += 60; putarKe(dir); drawKoch(dir, len, n); dir -= 120; putarKe(dir); drawKoch(dir, len, n); dir += 60; putarKe(dir); drawKoch(dir, len, n); }

Lindenmayer Systems An L-System works by giving the turtle a string sequence where each symbol in the sequence gives turtle instructions. ‘F’ -> go forward 1 step ‘+’ -> turn right by x degrees ‘-’ -> turn left by x degrees where x is set and predetermined.

Lindenmayer Systems The string F+F-F means go forward turn right, go forward, turn left and go forward.

Lindenmayer Systems L-Systems are produced based on a production rule. This rule is iteratively applied to the string. e.g. F -> “F+F” means that all ‘F’s in the string should be replaced with “F+F” therefore, F+F-F becomes: F+F+F+F-F+F

L-Systems Starting with: F+F+F+F and the production rule: F -> F+F-F-FF+F+F-F After one iteration the following string would result F+F-F-FF+F+F-F + F+F-F-FF+F+F-F + F+F-F- FF+F+F-F + F+F-F-FF+F+F-F

L-Systems After 2 iterations the string would be: F+ F-F-FF+ F+ F-F+ F+ F-F-FF+ F+ F-F-F+ F-F-FF+ F+ F-F-F+ F-F-FF+ F+ F-FF+ F-F-FF+ F+ F-F+ F+ F-F-FF+ F+ F-F+ F+ F- F-FF+ F+ F-F-F+ F-F-FF+ F+ F-F+ F+ F-F-FF+ F+ F-F+ F+ F-F- FF+ F+ F-F-F+ F-F-FF+ F+ F-F-F+ F-F-FF+ F+ F-FF+ F-F-FF+ F+ F-F+ F+ F-F-FF+ F+ F-F+ F+ F-F-FF+ F+ F-F-F+ F-F-FF+ F+ F-F+ F+ F-F-FF+ F+ F-F+ F+ F-F-FF+ F+ F-F-F+ F-F-FF+ F+ F-F-F+ F-F-FF+ F+ F-FF+ F-F-FF+ F+ F-F+ F+ F-F-FF+ F+ F-F+ F+ F-F-FF+ F+ F-F-F+ F-F-FF+ F+ F-F+ F+ F-F-FF+ F+ F- F+ F+ F-F-FF+ F+ F-F-F+ F-F-FF+ F+ F-F-F+ F-F-FF+ F+ F- FF+ F-F-FF+ F+ F-F+ F+ F-F-FF+ F+ F-F+ F+ F-F-FF+ F+ F-F- F+ F-F-FF+ F+ F-F

L-Systems produceString(char *rule, int iterations) { FILE *ifp, *ofp; for(int i = 0; i < iterations; i++) { if( (ifp = fopen("ldata.txt","r")) == NULL || (ofp = fopen("ltemp.txt","w")) == NULL ) exit(-1); //cannot open files int ch; while((ch = fgetc(ifp)) != -1) { switch(ch) { case 'F': fprintf(ofp,"%s",rule); break; default: fprintf(ofp,"%c",ch); break; } fclose(ifp); fclose(ofp); remove("ldata.txt"); rename("ltemp.txt", "ldata.txt"); }

L-Systems drawString(int len, float angle) { FILE *ifp; if( (ifp = fopen("ldata.txt","r")) == NULL ) exit(-1); //cannot open files int ch; while( (ch = fgetc(ifp)) != -1) { switch(ch) { case 'F': terusKe(len, 1); break; case '+': putarKe(-angle); break; case '-': putarKe(angle); break; }

Programming L-Systems void myDisplay(void) { cvs.clearScreen(); glLineWidth(3); pindahKe(-50.0,0.0); produceString("F-F++F-F", 3); drawString(20,60); glFlush(); }

L-Systems Programming L- Systems – The more iterations you do, the bigger the curve will get.. – Therefore you need to modify the length of the sides depending on the number of iterations. 1 iteration 3 iterations

L-Systems There is a limit to the number of shapes that can be drawn with just and ‘F’ directive. L-Systems need to be restricted to just F, you can use however many replacement letters and strings you like.

L-Systems For example, F, X and Y: F -> ‘F’ X -> ‘X+YF+’ Y -> ‘-FX-Y’ atom = “X” (starting string) But the turtle only draws with F – This of course is no rule, you could make X and Y draw as well… it is up to you!!!

L-Systems The Dragon Curve F -> ‘F’ X -> ‘X+YF+’ Y -> ‘-FX-Y’ atom = “X” 12 iterations

L-Systems Koch Island F -> ‘F+F-F-FF+F+F-F’ X -> ‘’ Y -> ‘’ atom = “F+F+F+F” 5 iterations

L-Systems If you look at a tree you will notice that it is made up of smaller copies of itself. e.g. A tree branch is just a smaller version of a tree. Being self-similar doesn’t mean each smaller version has to be EXACTLY the same.

L-Systems Lets look at a tree F F F F F -> F+F-F But that can’t be right?

L-Systems Lets look at a tree F F F F F -> F+F-F start here return here

L-Systems Lets look at a tree F F F F F -> F[+F]-F start here return here

L-Systems Lets look at a tree F -> F[+F][-F] push the turtle locationpop the turtle location

L-Systems Lets look at a tree F -> F[+F][-F] atom “F”

L-Systems Lets look at a tree F -> FF-[-F+F+F]+[+F-F-F] atom “F”

L-Systems Lets look at a tree Some L-System trees can look a little ‘calculated’, therefore random angles and lengths can be introduced. This is the same tree (above) and below with random lengths and angles.

L-Systems …or you can modify the thickness or length of the branch (lines) depending on the level at which it appears in the tree.

Affine Transformations For example, take these: original image (1x1) What will it look like after the transformations??

Affine Transformations For example, take these:

Affine Transformations

An my personal favourite: Affine Transformations: T {a,b,c,d,e,f} T1 {0,0,0,0,0.16,0} T2 {0.2,-0.26,0,0.23,0.22,1.6} T3 {-0.15,0.28,0,0.26,0.24,0.44} T4 {0.75,0.04,0,-0.04,0.85,1.6}

Affine Transformations An my personal favourite:

Affine Transformations An my personal favourite:

Affine Transformations An my personal favourite:

Iterative Function Systems An iterative function system (IFS) takes a set of affine transformations and transforms a point through them based on a random selection of the transformation. An IFS is a collection of N affine transformations T i, for I = 1,2,…,N

Iterative Function Systems Generating an IFS – Chaos Game select a random point do { select a random transformation run point through transformation plot new point set old point to new point }while (!bored)

Iterative Function Systems Generating an IFS – Chaos Game select a random point do { select a random transformation run point through transformation plot new point set old point to new point }while (!bored)

Iterative Function Systems The idea: All points on the attractor (final image) are reachable by applying a long sequence of affine transformations. The random selection of transformations is invoked to ensure the system is “fully exercised”

Fractal Compression Looking for self-similar sections of an image and using them to reconstruct the whole image. Affine Mappings are used to reconstruct the image.

Fractal Compression

The Mandelbrot Set Julia and Mandelbrot sets arise from iteration theory. Iteration Theory: – What happens when a function is iterated endlessly? Mandelbrot used computer graphics to perform essential experiments.

The Mandelbrot Set The Mandelbrot set uses the IFS: f(z) = z 2 + c – where c is some constant. The system produces each “output” by squaring its “input” and adding c. The ORBIT of the input determines how a value is plotted.

The Mandelbrot Set An orbit is the set of values “output” as the function is iterated. For example: f(z) = z with starting value 0 the sequence of output is: 2, 6, 38, 1 446, , … This orbit is said to be infinite as its values are approaching infinity (called a infinite orbit).

The Mandelbrot Set A finite orbit is one where the output values settle down around a single value. For example: f(z) = z with starting value 0 the sequence of output is: 0, -1, 0, -1, 0, -1 These values cycles endlessly and are considered finite!

The Mandelbrot Set Definition: The Mandelbrot set, M, is the set of all complex numbers, c, that produce a finite orbit of 0. This means that with a starting value of 0, which values for c (using complex numbers) produce finite sequences of outputs.

The Mandelbrot Set The first few values would be: 0, c, c 2 +c, (c 2 +c)+c, … where c = x + yi A plot of the values for c reveals the Mandelbrot set.

The Mandelbrot Set If you plot the orbits for values of c inside the set you will see the orbits forming. For points with c outside the set, the plots reveal lines going off into infinity. -mandelbrot_orbit.exe

Julia Sets Julia sets are extremely complicated sets of points in the complex plane. There is a different Julia set for each value of c. One version is the Filled Julia Set: – the set of all starting points whose orbits are finite.

Julia Sets c = i

Julia Sets c = i

Julia Sets c = i

Julia Sets c = i

Fractal Landscapes

Divide and Perturb

Fractal Landscape

Fractal Landscapes Brownian Motion – divide and lift – randomly cut a line in two, randomly lift that point, then smooth surrounding area.

Fractal Landscapes Step One: Randomly select a spot on a mesh and raise height by a random amount.

Fractal Landscapes Step Two: Slope from tip of adjusted height to edge of map.

Fractal Landscapes Step Three: Do this for all edges of the map.

Fractal Landscapes Step Four: Smooth sharp ridges by raising surrounding surface to an even slope.

Fractal Landscapes Step Five: Do this for all four ridges.

Fractal Landscapes Step Six: Perform the lifting and smooth procedure as many times as you like.

Fractal Landscapes Step Seven: Now decide on a maximum height and chop the highest peaks off. You can also do this for low points to create areas for water.

Fractal Landscapes Step Eight: Smooth peak caps by averaging the height with the neighbouring vertices.

Fractal Landscapes Step Eight: Colour as you see fit.

QA