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

  1. //
  2. // Demonstration of a summed texture - a different primary color is given
  3. // to each of the three blob components by positioning a texture at the
  4. // same place as the component and having the texture fade off with distance.
  5. //
  6. viewpoint {
  7.    from <0,0,-5>
  8.    at <0,0,0>
  9.    up <0,1,0>
  10.    angle 30
  11.    resolution 160,160
  12.    aspect 1
  13.    }
  14.  
  15. include "../colors.inc"
  16. background SkyBlue
  17. light 0.6 * white, <-15,30,-25>
  18. light 0.6 * white, < 15,30,-25>
  19.  
  20. // Positions of the blob components
  21. define blob_pos1 <0.75, 0, 0>
  22. define blob_pos2 rotate(blob_pos1, <0, 0, 1>, 120)
  23. define blob_pos3 rotate(blob_pos1, <0, 0, 1>, 240)
  24.  
  25. define blob_dist_fn1 min(1, (1 - ((P - blob_pos1).(P - blob_pos1))/2)^2)
  26. define blob_dist_fn2 min(1, (1 - ((P - blob_pos2).(P - blob_pos2))/2)^2)
  27. define blob_dist_fn3 min(1, (1 - ((P - blob_pos3).(P - blob_pos3))/2)^2)
  28.  
  29. define blobtx
  30. texture {
  31.    summed 0.8*blob_dist_fn1, shiny_red,
  32.       0.8*blob_dist_fn2, shiny_green,
  33.       0.8*blob_dist_fn3, shiny_blue
  34.    }
  35.  
  36. object {
  37.    blob 0.6:
  38.       sphere blob_pos1, 1, 1,
  39.       sphere blob_pos2, 1, 1,
  40.       sphere blob_pos3, 1, 1
  41.    blobtx
  42.    rotate <0,30,0>
  43.    }
  44.