home *** CD-ROM | disk | FTP | other *** search
- // Persistence of Vision Raytracer
- { Dan Farmer
- 1001 e. 80th St. #102
- Bloomington, mn 55425
-
- Wine glass with red wine, marbled checkerboard behind it.
-
- This data file is for use with pv-Trace and is file
- is released to the public domain and may be used or altered by
- anyone as desired.
- }
-
- #include "colors.dat"
- #include "shapes.dat"
- #include "textures.dat"
-
- // A viewpoint somewhat up, to the right, and back 75 units
- view_point
- location <50.0 55.0 -75.0>
- direction <0.0 0.0 2.0>
- up <0.0 1.0 0.0>
- right <1.33333 0.0 0.0>
- look_at <-10.0 18.0 0.0> { Let's look to our left a little, and down }
- end_view_point
-
- object { Light source #1, backliting, slightly to the right }
- sphere <0.0 0.0 0.0> 2.0 end_sphere
- translate <10.0 50.0 50.0>
- colour White
- texture
- ambient 1.0 diffuse 0.0
- colour White
- end_texture
- light_source
- end_object
-
- object { Light source #2, above, behind, and to the left of the viewer }
- sphere <0.0 0.0 0.0> 2.0 end_sphere
- translate <-35.0 30.0 -150.0>
- colour White
- texture
- ambient 1.0 diffuse 0.0
- colour White
- end_texture
- light_source
- end_object
-
- // This is not necessarily the _best_ glass, just the best for my purpose
- // this time. I also use Glass2 in this file, but I didn't want the
- // "Shine" in the default glass texture for the top of the wineglass;
- // it interfered with the color of the wine.
- ##declare MyGlass = texture
- color red 1.0 green 1.0 blue 1.0 alpha 1.0
- ambient 0.0
- diffuse 0.0
- reflection 0.1
- refraction 1.0
- ior 1.33
- phong 0.3
- phongsize 90
- transmit 0.0
- end_texture
-
- // Define the color and texture for the wine in the glass
- #declare Wine = color red 1.0 alpha 0.85
- #declare Liquid = texture
- reflection 0.05
- refraction 1.0
- ior 1.2
- end_texture
-
- // This will be used for glass beads on the stem of the glass
- // I used Quadric spheres so the whole composite could be scaled.
- // Procedural (regular) SPHERES cannot be scaled unevenly.
- #declare Bead = object
- quadric QSphere scale <1.65 0.65 1.65> end_quadric
- color red 1.0 blue 1.0
- texture Glass2 end_texture
- end_object
-
-
- // The next shape declared is a thin torus that will be used to give
- // the rim of the glass a beaded edge.
- {
- Torus generated using Truman's Torus Generator 1.0 (c) 1991 Truman Brown
- Torus specs:
- Major radius: 0.975000 Minor radius: 0.025000
- Outer radius: 1.000000 Inner radius: 0.950000
- }
- #declare Rim = object
- quartic
- < 1.000000 0.000000 0.000000 0.000000 2.000000
- 0.000000 0.000000 2.000000 0.000000 -1.902500
- 0.000000 0.000000 0.000000 0.000000 0.000000
- 0.000000 0.000000 0.000000 0.000000 0.000000
- 1.000000 0.000000 0.000000 2.000000 0.000000
- 1.900000 0.000000 0.000000 0.000000 0.000000
- 1.000000 0.000000 -1.902500 0.000000 0.902500 >
- end_quartic
- clipped_by plane <0.0 -1.0 0.0> 0.0 end_plane end_clip
- scale <15.0 10.0 15.0>
- translate <0.0 24.0 0.0>
- color red 1.0
- texture Gold_Texture end_texture
- end_object
-
- // The top of the glass. Remember, a cone is infinite in both directions.
- // The clipping shape and the intersection with a plane "chops" off the
- // portion that I want to use. This cone is pointed downwards.
- #declare Top = object
- intersection
- plane <0.0 1.0 0.0> 1.0 end_plane
- quadric Cone_Y end_quadric
- quadric Cone_Y scale <0.97 1.0 0.97> inverse end_quadric
- end_intersection
- clipped_by
- plane <0.0 1.0 0.0> 0.0 inverse end_plane
- end_clip
- scale <15.0 10.0 15.0>
- translate <0.0 14.0 0.0>
- color green 1.0
- texture MyGlass end_texture
- end_object
-
- // A cylinder, also "cut" by two planes to keep it from running off into
- // infinity.
- #declare Stem = object
- quadric Cylinder_Y end_quadric
- clipped_by
- plane <0.0 1.0 0.0> -1.0 inverse end_plane
- plane <0.0 1.0 0.0> 1.0 end_plane
- end_clip
- scale <1.0 12.0 1.0>
- translate <0.0 6.0 0.0>
- color blue 1.0
- texture Glass2 end_texture
- end_object
-
- // Another cone segment, this one pointed upwards, and scaled quite flat.
- #declare Base = object
- quadric Cone_Y end_quadric
- clipped_by
- plane <0.0 1.0 0.0> 0.0 end_plane
- plane <0.0 1.0 0.0> -1.0 inverse end_plane
- end_clip
- translate <0.0 1.0 0.0> { This actually puts the base of the cone on y=0}
- scale <12.0 3.25 12.0>
- translate <0.0 0.0 0.0> {Does nothing: just for clarity }
- color red 1.0 green 1.0
- texture Glass2 end_texture
- end_object
-
- // The wine in the glass is actually another cone nested inside of the
- // top of the glass. If it weren't for a temporary bug in the PV program
- // that I'm writing this with, I'd try for some gentle ripples on the
- // top intersecting plane.
- #declare Wine = object
- intersection
- plane <0.0 1.0 0.0> 0.9
- end_plane
- quadric Cone_Y scale <0.95 1.0 0.95> end_quadric
- end_intersection
- clipped_by
- plane <0.0 1.0 0.0> 0.0 inverse
- end_plane
- end_clip
- scale <14.9 10.0 14.9>
- translate <0.0 14.0 0.0>
- color White
- texture Liquid
- color Wine
- end_texture
- end_object
-
- // The nice blue ground plane
- object
- plane <0.0 1.0 0.0> -0.0 end_plane
- color DimGray
-
- // The 0.2 is a random dithering value.
- // Gives it that nice blue speckled texture.
- texture 0.2 color RichBlue end_texture
-
- end_object
-
- // This is four cylinder segments that will be used to frame the
- // checkerboard. I gave them a nice, soft silvery texture, much like
- // brushed aluminum.
- #declare Frame = object
- union
-
- intersection X_Disk { Front rounded edge }
- scale <240.0 4.5 4.5>
- translate<-120.0 0.0 -120.0>
- end_intersection
- intersection Z_Disk { Left rounded edge }
- scale <4.5 4.5 240.0>
- translate <-120.0 0.0 -120.0>
- end_intersection
-
- // Actually, these next two don't show, so I'm going to comment
- // out to speed up the rendering somewhat. If you should change
- // the viewpoint, you may need to put these back in.
- {*********
- intersection X_Disk { Rear rounded edge }
- scale <240.0 4.5 4.5>
- translate<-120.0 0.0 +120.0>
- end_intersection
- intersection Z_Disk { Right rounded edge }
- scale <4.5 4.5 240.0>
- translate <+120.0 0.0 -120.0>
- end_intersection
- **********}
- end_union
- color red 1.0
- texture Silver_Texture end_texture
- end_object
-
- // You guessed it... the checkerboard. What's a raytracing without one?
- #declare ChessBoard = object
- intersection Cube
- scale <120.0 4.0 120.0>
- end_intersection
- color Cyan
-
- // This texture could be done as well with the Checker_Texture texture
- // This came to mind easier at the time, that's all.
-
- texture White_Marble scale <20.0 1.0 20.0> reflection 0.12 end_texture
- texture checker color Black color White alpha 1.0
- scale <30.0 4.001 30.0>
- reflection 0.12
- end_texture
-
- end_object
-
- // And here, we put all of the wine glass parts together into a composite.
- // We could simply construct and display it here, instead of declaring it
- // as a named object, but this will make it much easier to either move it
- // later, or to copy it to another location.
- #declare WineGlass = composite
- object Rim end_object { The torus beaded rim }
- object Wine end_object { The liquid in the glass }
- object Top end_object { The top of the glass }
-
- // Four glass bumps on the stem
- object Bead translate <0.0 14.5 0.0> end_object
- object Bead translate <0.0 10.0 0.0> end_object
- object Bead translate <0.0 7.0 0.0> end_object
- object Bead translate <0.0 3.0 0.0> end_object
-
- object Stem end_object { Obviously, the stem of the glass }
- object Base end_object { and the foot of the glass }
- bounded_by { Enclose it in a bounding shape for efficiency }
- intersection Y_Disk
- scale <15.5 25.0 15.5>
- end_intersection
- end_bound
- scale <1.0 1.50 1.0> { I decided it needed to be taller }
- end_composite
-
- // Now we're ready to place the objects in the scene...
-
- // The checkerboard
- composite
- object Frame end_object { The outside... }
- object ChessBoard end_object { and the inside }
- translate <0.0 4.0 145.0>
- end_composite
-
- // And the wineglass.
- composite WineGlass end_composite
-
- {End of file }
-