12.07.2015 Views

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

348 chapter 13yxFigure 13.13 After the addition of Perlin noise, the random scatterplot on the leftbecomes the clusters on the right.4. Obtain the height b via linear interpolation between u and v.5. Obtain s y as a linear interpolation between a and b.6. The vector c so obtained is now the two components of the noise at (x, y).Perlin’s original C code to accomplish this mapping (along with other goodies)is found in [Perlin]. It takes as input the plot of random points (r 2i ,r 2i+1 ) on theleft in Figure 13.13 (which is the same as Figure 5.1) and by adding coherent noiseproduces the image on the right in Figure 13.13. The changes we made from theoriginal program are (1) including an int before the variables p[], start, i, and j, and(2) adding # include and the line srand(time(NULL)); at the beginning ofmethod init( ) in order to obtain different random numbers each time the programruns. The main method of the C program we used is below. The program outputsa data file that we visualized with OpenDX to produce the image montania.tiff onthe right in Figure 13.13.13.10.1 Including Ray TracingRay tracing is a technique that renders an image of a scene by simulating the wayrays of light actually travel [Pov-Ray]. To avoid tracing rays that do not contributeto the final image, ray-tracing programs start at the viewer, trace rays backwardonto the scene, and then back again onto the light sources. You can vary the locationof the viewer and light sources and the properties of the objects being viewed, aswell as atmospheric conditions such as fog, haze, and fire.As an example of what can be done, on the left in Figure 13.14 we show the outputfrom the ray-tracing program Pov-Ray [Pov-Ray], using as input the coherentrandom noise on the right in Figure 13.13. The program options we used are givenin Listing 13.3 and are seen to include commands to color the islands, to include−101<strong>COPYRIGHT</strong> <strong>2008</strong>, PRINCET O N UNIVE R S I T Y P R E S SEVALUATION COPY ONLY. NOT FOR USE IN COURSES.ALLpup_06.04 — <strong>2008</strong>/2/15 — Page 348

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!