home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_progs / graphics / raydance.lzh / demo_scripts.lha / tutorial4.art < prev    next >
Encoding:
Text File  |  1991-10-21  |  2.8 KB  |  105 lines

  1. !---------------------------------------------------------------
  2. !
  3. ! TUTORIAL4 - RayDance tutorial script #4.
  4. !
  5. ! This script demonstrates transparency.  A row of spheres is
  6. ! created with different values for ir (index of refraction).
  7. !
  8. ! Concepts include :
  9. !
  10. !  o Declaring PHONG surfaces with transparency.
  11. !
  12. !  o A diamond pattern ground plane
  13. !
  14. !---------------------------------------------------------------
  15.  
  16. ! Use a print statement to display descriptive text on the
  17. ! message window.
  18.  
  19. ? "TUTORIAL4 - This script defines a scene with one row of\n",
  20.   "spheres floating over a checkerboard.  ir will change\n",
  21.   "from 0.4 to 1.6 moving from left to right.  All spheres\n",
  22.   "are colored white to simulate clear glass\n";
  23.  
  24.  
  25. ! The camera will be positioned along the negative y axis
  26. ! looking at the origin.
  27.  
  28. CAMERA'POS = [0,-3500,500];
  29. CAMERA'TARGET = [0,0,200];
  30.  
  31.  
  32. ! Define colors for this scene
  33.  
  34. !                   rgb color value
  35.  
  36. WHITE  : COLOR ( RGB, [1,1,1] );
  37. BLUE   : COLOR ( RGB, [0,0,1] );
  38. YELLOW : COLOR ( RGB, [1,1,0] );
  39.  
  40.  
  41. ! Define surfaces for the spheres, with varying ir.  Glass has
  42. ! very little in the way of diffuse or ambient lighting and
  43. ! quite sharp specular hilites (a large n value).  It also has
  44. ! a large value for kr (refraction) and a smaller value for km
  45. ! (mirror reflection).  kr * kr + km MUST be less than 1.0.
  46. ! This avoids creation of a light amplifier inside the
  47. ! spheres.  Should this happen the light ray leaving a sphere
  48. ! could have more intensity than the sum of the light rays
  49. ! entering the sphere.
  50.  
  51. !                ka  kd  ks n   km kr ir  kb  flags
  52. SURF1 :
  53.   SURFACE(PHONG, .02,.02,.5,100,.1,.9,0.4,0.0,TRANSPARENT );
  54. SURF2 :
  55.   SURFACE(PHONG, .02,.02,.5,100,.1,.9,0.7,0.0,TRANSPARENT );
  56. SURF3 :
  57.   SURFACE(PHONG, .02,.02,.5,100,.1,.9,1.0,0.0,TRANSPARENT );
  58. SURF4 :
  59.   SURFACE(PHONG, .02,.02,.5,100,.1,.9,1.3,0.0,TRANSPARENT );
  60. SURF5 :
  61.   SURFACE(PHONG, .02,.02,.5,100,.1,.9,1.6,0.0,TRANSPARENT );
  62.  
  63. ! Define a surface for the ground (diamond pattern)
  64.  
  65. !                      ka kd ks n  km kr ir kb flags
  66. MATTE : SURFACE(PHONG, 1, 1, 0, 0, 0, 0, 0, 0, 0 );
  67.  
  68.  
  69. ! Create the row of spheres
  70.  
  71. SPHERE( [-1000,0,250], 225, WHITE, SURF1 );
  72. SPHERE( [ -500,0,250], 225, WHITE, SURF2 );
  73. SPHERE( [    0,0,250], 225, WHITE, SURF3 );
  74. SPHERE( [  500,0,250], 225, WHITE, SURF4 );
  75. SPHERE( [ 1000,0,250], 225, WHITE, SURF5 );
  76.  
  77.  
  78. ! Specify the ambient light.
  79.  
  80. AMBIENT( [0,0,0], [0.6,0.6,0.6], [0,0,1], 0, 0 );
  81.  
  82. ! Specify the STAR light.
  83.  
  84. STAR( [5000,-5000,4000], [1,.9,1], 300 );
  85.  
  86.  
  87. ! Set the background color to a dark, muddy brown
  88.  
  89. BACKGROUND( PLAIN, [0.1,0.05,0.05] );
  90.  
  91.  
  92. ! Make the ground plane.  This time we'll use a diamond pattern
  93.  
  94. GROUND( DIAMOND, 0, 400, BLUE, MATTE, YELLOW, MATTE );
  95.  
  96.  
  97. ! The scene has now been constructed, render it!
  98.  
  99. RENDER;
  100.  
  101.  
  102. ! All scripts must terminate with an END
  103.  
  104. END
  105.