File: sombrero.pov

package info (click to toggle)
povray 1%3A3.6.1-12
  • links: PTS
  • area: non-free
  • in suites: lenny, squeeze
  • size: 31,084 kB
  • ctags: 20,310
  • sloc: ansic: 110,032; cpp: 86,573; sh: 13,595; pascal: 5,942; asm: 2,994; makefile: 1,753; ada: 1,637
file content (85 lines) | stat: -rw-r--r-- 2,265 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// Persistence Of Vision raytracer version 3.5 sample file.
// File: Sombrero.POV
// Vers: 3
// Desc: Create the famous Sinusoidal rippled surface,
//       using a 3-D sheet of spheres.
//       Shows off the use of the while loop for creating a surface,
//       and for smoothly changing colors.
// Date: 10/1/95
// Auth: Eduard Schwan
//
// -w320 -h240
// -w800 -h600 +a0.3


global_settings { assumed_gamma 1.0 }

// ------------------------------------------------------------------
// Look down at an angle at our creation
camera
{
  location  <0,1.5,-2>
  direction 1*z
  look_at   <0,-0.2,0>
}


// ------------------------------------------------------------------
// Simple background for a simple scene
background { color rgb <0.9, 0.8, 0.7> }


// ------------------------------------------------------------------
// A light source
light_source { <20, 20, -10> colour 1 }


// ------------------------------------------------------------------
// create a simple shape to use as a dot
#declare BasicShape = sphere {  0, 1 }


// ------------------------------------------------------------------
// Set up the loop variables:
// the Xc & Zc variables will go from -1.0 to +1.0
// in NumIterations loops.
#declare NumIterations = 8; // try 6 to 16
#declare Increment     = 1.0/(NumIterations*2);


// ------------------------------------------------------------------
// Create a surface built from our basic shape
// Zc goes from -1 to +1
#declare Zc = -1.0;
#while (Zc<=1.0)
  union
  {

  // Xc goes from -1 to +1
  #declare Xc = -1.0;
  #while (Xc<=1.0)
    // precalculate height, since it is used several places below
    #declare YHeight = sin(sqrt(Xc*Xc+Zc*Zc)*6.28*2);
    object
    {
      BasicShape scale Increment
      translate <Xc, YHeight/4, Zc>
      texture
      {
        // colors change across the object, and also go from black
        // in the valleys to full saturation at the peaks
        pigment { color rgb <Xc/2+1, 1-Zc/2, YHeight/2+1>*YHeight }
        finish { ambient 0.2 specular 0.5 roughness 0.05 reflection 0.2 }
      }
    }
    // manually increment our counter inside the loop
    #declare Xc=Xc+Increment;
  #end
  }

  // manually increment our counters inside the loop
  #declare Zc=Zc+Increment;

#end