1// Persistence Of Vision raytracer version 3.5 sample file.
2// File by Dan Farmer
3// Broken dowel, uses clipped heightfields and heightfield as a clipping
4// object to create the fractured end of the dowel.  Uses a Fractint
5// "plasma cloud" image for the heightfield.  (just about any size will do).
6//
7// -w320 -h240
8// -w800 -h600 +a0.3
9
10global_settings { assumed_gamma 2.2 }
11
12#include "colors.inc"
13#include "textures.inc"
14#include "shapes.inc"
15#include "stones.inc"
16
17camera {
18   location <0, 6, -6>
19   direction <0, 0, 2>
20   right <1.333, 0, 0>
21   look_at <0, 0, 0>
22}
23
24#declare Column_Texture = texture {
25   pigment {
26      DMFWood1                  // (or whatever its called now)
27      scale <0.75, 0.75, 1>     // smaller rings
28      rotate 89.85*x            // turn it so the rings are (almost) up
29   }
30
31   finish {
32      ambient 0.1
33      diffuse 0.55
34   }
35}
36
37// Note: using the HF_Image declaration gives an Exception 17. Why?
38#declare HF_Image = height_field { png "plasma2.png" }
39
40#declare HF_Translate = <-0.5, 0, -0.5>;
41#declare HF_Roughness = 2;
42#declare HF_Scale = <6, HF_Roughness, 6>;
43
44union {
45    // This first object is a heightfield clipped to a round disk shape
46    // and is used for the "end cap" for the cylinder object that follows.
47    height_field {
48       png "plasma2.png"
49       translate HF_Translate
50       scale HF_Scale
51
52       clipped_by { object { Cylinder_Y } }
53       texture { Column_Texture }
54    }
55
56    // This is essentially the inverse of the above shape; a cylinder that
57    // has been clipped by the same heightfield as used to create the cap
58    // above.  This yeilds a cylinder with a jaggy edge that mates with
59    // the clipped heightfield.  Note that this cylinder, while it starts
60    // life with an infinate length, will now be clipped on both the top
61    // and the bottom to the same length as the heightfield height.
62    object {
63        Cylinder_Y
64        clipped_by {
65            height_field {
66                png "plasma2.png"
67                translate HF_Translate
68                scale HF_Scale
69            }
70        }
71        texture { Column_Texture }
72    }
73    // Now we've gotta "glue" a disk to the underside of the cylinder
74    // so that the object can be made longer.  Overall object height
75    // will be HF_Roughness + the Y scale used below.
76    object {
77        object { Disk_Y translate -1*y }
78        texture { Column_Texture }
79        scale <1, 3, 1>
80    }
81}
82
83sphere { <0, 0, 0>, 100000
84   hollow on
85   pigment { Gray30 }
86   finish { ambient 0.75}
87}
88
89light_source { <10, 50, 1> color Gray30 }
90light_source { <60, 50, -100> color red 1 green 1 blue 1 }
91