home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 1995 January / pcw-0195.iso / polyray / dat / texture / bumpfn1.pi < prev    next >
Text File  |  1994-12-31  |  1KB  |  62 lines

  1. // Thanks to Dan Farmer for inspiring this interesting normal modification
  2. // function.  Looks sorta like tiles, but (at least in this implementation)
  3. // has some odd shading errors.
  4. viewpoint {
  5.    from <0, 6, -8>
  6.    at <0, 0, -1>
  7.    up <0, 1, 0>
  8.    angle 40
  9.    resolution 160, 160
  10.    }
  11.  
  12. // Lights
  13. light white, <-20, 20,-20>
  14.  
  15. define bmpy_fn_x (x - floor(x))
  16. define bmpy_fn_x1 1 - bmpy_fn_x
  17. define bmpy_fn_y (y - floor(y))
  18. define bmpy_fn_y1 1 - bmpy_fn_y
  19. define bmpy_fn_z (z - floor(z))
  20. define bmpy_fn_z1 1 - bmpy_fn_z
  21.  
  22. define bmpy_sp_x bmpy_fn_x^3 + 3 * bmpy_fn_x * bmpy_fn_x1^2
  23. define bmpy_sp_y bmpy_fn_y^3 + 3 * bmpy_fn_y * bmpy_fn_y1^2
  24. define bmpy_sp_z bmpy_fn_z^3 + 3 * bmpy_fn_z * bmpy_fn_z1^2
  25.  
  26. define bmpy_test_fn <bmpy_sp_x, bmpy_sp_y, bmpy_sp_z>
  27.  
  28. define bmpy_test
  29. texture { 
  30.    special surface {
  31.       color white
  32.       normal N - 0.5 * bmpy_test_fn
  33.       specular 1
  34.       microfacet Cook 1
  35.       }
  36.    }
  37.  
  38. object {
  39.    sphere <0, 0, 0>, 1
  40.    bmpy_test { scale <0.5, 0.5, 0.5> }
  41.    // rotate <0, 160, 0>
  42.    }
  43.  
  44. object {
  45.    box <-1, -1, -1>, <1, 1, 1>
  46.    bmpy_test { scale <0.5, 0.5, 0.5> }
  47.    rotate <0, -20, 0>
  48.    translate <-2, 0, 3>
  49.    }
  50.  
  51. object {
  52.    disc <0, -1, 0>, <0, 1, 0>, 100
  53.    bmpy_test { scale <3, 3, 3> }
  54.    }
  55.  
  56. object {
  57.    object { cone <-2, -1, 0>, 0, <2, 0, 0>, 1 }
  58.    bmpy_test { scale <0.5, 0.5, 0.5> }
  59.    rotate <0, -20, 0>
  60.    translate <0, 0, -2>
  61.    }
  62.