home *** CD-ROM | disk | FTP | other *** search
- // "Porcupot" a Polyray 1.6 scene file based on the "Utah Teapot"
- // By Douglas Otwell
- //----------------------------------------------------------------------------
- // In Porcupot, I use a displacement function that looks like spikes to
- // give the teapot a porcupine or blowfish surface. Like Crocpot,
- // the displacement follows the surface using the local coordinate (u - v)
- // ability of the bezier patches.
- //----------------------------------------------------------------------------
-
- // point these to the standard Polyray include files
- include "../colors.inc"
- include "../texture.inc"
-
- viewpoint {
- from <0, 4, -5.5>
- at <0.25, 1, 0>
- up <0, 1, 0>
- angle 53
- resolution 640, 480
- aspect 1.33333
- }
-
- background SkyBlue
- light <-10, 10, -5>
- light <10, 10, -10>
-
- //----------------------------------------------------------------------------
- // Spine_texture maps the color map to distance from the origin,
- // creating layers of color like an onion.
- // These colors and the color map below were designed with Lutz Kretzschmar's
- // program CMAPPER.
- //----------------------------------------------------------------------------
- define cream <0.925, 0.871, 0.776>
- define brown <0.341, 0.216, 0.000>
-
- define spine_texture texture {
- noise surface {
- color white
- position_fn position_spherical
- lookup_fn lookup_sawtooth
- octaves 3
- turbulence 1.5
- ambient 0.3
- diffuse 0.6
- specular 0.8
- microfacet Reitz 10
- color_map(
- [0.000, 0.150, cream, brown]
- [0.150, 0.248, brown, black]
- [0.248, 0.301, black, brown]
- [0.301, 0.407, brown, cream]
- [0.407, 0.549, cream, cream]
- [0.549, 0.646, cream, brown]
- [0.646, 0.664, brown, black]
- [0.664, 0.717, black, brown]
- [0.717, 0.876, brown, cream]
- [0.876, 1.001, cream, cream])
- }
- }
- define cream_texture texture {
- surface {
- color cream
- specular 0.8
- ambient 0.3
- diffuse 0.6
- microfacet Reitz 10
- }
- }
-
- define rim_texture spine_texture
- define body1_texture spine_texture
- define body2_texture spine_texture
- define spout_texture cream_texture
- define handle_texture cream_texture
- define lid1_texture cream_texture
- define lid2_texture spine_texture
- define bottom_texture spine_texture
-
- //----------------------------------------------------------------------------
- // This function is probably overkill. Basically it's a parabola (x^2),
- // shifted to the right a bit, and then rotated around the y axis (by
- // replacing x with sqrt(x^2 +z^2).) The conditional expression is used
- // to clip off the outside. (A simple cone function would have been easier,
- // faster, and probably indistinguishable.)
- // To follow the surface, I used the u and v coordinates of the bezier,
- // using sawtooths to get the frequency of spikes I wanted across the bezier
- // (The "2*new_v-1" business remaps the domain of my function, from -1 to 1,
- // to the values of u and v, which range from 0 to 1.)
- //----------------------------------------------------------------------------
-
- define new_u sawtooth(4*u)
- define new_v sawtooth(8*v)
-
- define spine_fn ((2*new_v-1)^2 + (2*new_u-1)^2 < 0.25
- ? 4 * N * (sqrt((2*new_v-1)^2 + (2*new_u-1)^2) - 0.5)^2
- : 0)
-
- define rim_fn 0
- define body1_fn spine_fn
- define body2_fn spine_fn
- define lid1_fn 0
- define lid2_fn spine_fn * 0.5
- define spout_fn 0
- define handle_fn 0
- define bottom_fn spine_fn
-
- define u_res 8
- define v_res 8
-
- include "mypot.inc"
-
- teapot
-
-
-