File: hfclip.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 (90 lines) | stat: -rw-r--r-- 2,634 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
86
87
88
89
90
// Persistence Of Vision raytracer version 3.5 sample file.
// File by Dan Farmer
// Broken dowel, uses clipped heightfields and heightfield as a clipping
// object to create the fractured end of the dowel.  Uses a Fractint
// "plasma cloud" image for the heightfield.  (just about any size will do).
//
// -w320 -h240
// -w800 -h600 +a0.3

global_settings { assumed_gamma 2.2 }

#include "colors.inc"
#include "textures.inc"
#include "shapes.inc"
#include "stones.inc"

camera {
   location <0, 6, -6>
   direction <0, 0, 2>
   right <1.333, 0, 0>
   look_at <0, 0, 0>
}

#declare Column_Texture = texture {
   pigment {
      DMFWood1                  // (or whatever its called now)
      scale <0.75, 0.75, 1>     // smaller rings
      rotate 89.85*x            // turn it so the rings are (almost) up
   }

   finish {
      ambient 0.1
      diffuse 0.55
   }
}

// Note: using the HF_Image declaration gives an Exception 17. Why?
#declare HF_Image = height_field { png "plasma2.png" }

#declare HF_Translate = <-0.5, 0, -0.5>;
#declare HF_Roughness = 2;
#declare HF_Scale = <6, HF_Roughness, 6>;

union {
    // This first object is a heightfield clipped to a round disk shape
    // and is used for the "end cap" for the cylinder object that follows.
    height_field {
       png "plasma2.png"
       translate HF_Translate
       scale HF_Scale

       clipped_by { object { Cylinder_Y } }
       texture { Column_Texture }
    }

    // This is essentially the inverse of the above shape; a cylinder that
    // has been clipped by the same heightfield as used to create the cap
    // above.  This yeilds a cylinder with a jaggy edge that mates with
    // the clipped heightfield.  Note that this cylinder, while it starts
    // life with an infinate length, will now be clipped on both the top
    // and the bottom to the same length as the heightfield height.
    object {
        Cylinder_Y
        clipped_by {
            height_field {
                png "plasma2.png"
                translate HF_Translate
                scale HF_Scale
            }
        }
        texture { Column_Texture }
    }
    // Now we've gotta "glue" a disk to the underside of the cylinder
    // so that the object can be made longer.  Overall object height
    // will be HF_Roughness + the Y scale used below.
    object {
        object { Disk_Y translate -1*y }
        texture { Column_Texture }
        scale <1, 3, 1>
    }
}

sphere { <0, 0, 0>, 100000
   hollow on
   pigment { Gray30 }
   finish { ambient 0.75}
}

light_source { <10, 50, 1> color Gray30 }
light_source { <60, 50, -100> color red 1 green 1 blue 1 }