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 / tutorial2.art < prev    next >
Encoding:
Text File  |  1991-10-20  |  3.5 KB  |  124 lines

  1. !---------------------------------------------------------------
  2. !
  3. ! TUTORIAL2 - RayDance tutorial script #2.
  4. !
  5. ! This script demonstrates ka and kd (coefficients of ambient
  6. ! and diffuse reflection) on two rows of spheres.
  7. !
  8. ! Concepts include :
  9. !
  10. !  o Declaring PHONG surfaces with different ka and kd values.
  11. !    These will have a marked effect on the shadows of the
  12. !    spheres.
  13. !
  14. !---------------------------------------------------------------
  15.  
  16. ! Use a print statement to display descriptive text on the
  17. ! message window.
  18.  
  19.  
  20. ? "TUTORIAL2 - This script defines a scene with two rows of\n",
  21.   "spheres.  Each sphere will be the same color but will have\n",
  22.   "different ambient and diffuse reflection surface values\n",
  23.   "(ka and kd).  The top row will increase ka (ambient) from\n",
  24.   "left to right.  The bottom row will increase kd (diffuse)\n",
  25.   "from left to right.\n\n";
  26.  
  27.  
  28. ! The camera will be positioned along the negative y axis
  29. ! looking at the origin.
  30.  
  31. CAMERA'POS = [0,-3000,0];
  32. CAMERA'TARGET = [0,0,0];
  33.  
  34.  
  35. ! Define the color of the sphere
  36.  
  37. SPHERE_COLOR : COLOR ( RGB, [0.8,0.4,0] );  ! Lt orange
  38.  
  39.  
  40. ! Define surfaces for the spheres, no mirroring
  41.  
  42. !  Top row, varying ambient
  43. !
  44. !                ka  kd  ks  n   km  kr  ir  kb  flags
  45. TOP_1_SURF :
  46.   SURFACE(PHONG, 0.1,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0 );
  47. TOP_2_SURF :
  48.   SURFACE(PHONG, 0.4,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0 );
  49. TOP_3_SURF :
  50.   SURFACE(PHONG, 0.7,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0 );
  51. TOP_4_SURF :
  52.   SURFACE(PHONG, 1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0 );
  53.  
  54. !  Bottom row, varying diffuse
  55. !
  56. !                ka  kd  ks  n   km  kr  ir  kb  flags
  57. BOT_1_SURF :
  58.   SURFACE(PHONG, 1.0,0.1,0.0,0.0,0.0,0.0,0.0,0.0,0 );
  59. BOT_2_SURF :
  60.   SURFACE(PHONG, 1.0,0.4,0.0,0.0,0.0,0.0,0.0,0.0,0 );
  61. BOT_3_SURF :
  62.   SURFACE(PHONG, 1.0,0.7,0.0,0.0,0.0,0.0,0.0,0.0,0 );
  63. BOT_4_SURF :
  64.   SURFACE(PHONG, 1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0 );
  65.  
  66.  
  67. ! Create the top row of spheres
  68.  
  69. !         center     raidus   color       surface
  70.  
  71. SPHERE( [-750,0,300], 150, SPHERE_COLOR, TOP_1_SURF );
  72. SPHERE( [-250,0,300], 150, SPHERE_COLOR, TOP_2_SURF );
  73. SPHERE( [ 250,0,300], 150, SPHERE_COLOR, TOP_3_SURF );
  74. SPHERE( [ 750,0,300], 150, SPHERE_COLOR, TOP_4_SURF );
  75.  
  76.  
  77. ! Create the bottom row of spheres
  78.  
  79. SPHERE( [-750,0,-300], 150, SPHERE_COLOR, BOT_1_SURF );
  80. SPHERE( [-250,0,-300], 150, SPHERE_COLOR, BOT_2_SURF );
  81. SPHERE( [ 250,0,-300], 150, SPHERE_COLOR, BOT_3_SURF );
  82. SPHERE( [ 750,0,-300], 150, SPHERE_COLOR, BOT_4_SURF );
  83.  
  84.  
  85. ! Specify the ambient light.  This will provide illumination for
  86. ! the areas that are shadows from the star light source.
  87. ! Positioning of ambient lights is reserved for future
  88. ! expansion.  For now, set position to [0,0,0].  The intensity
  89. ! of ambient lights should range from [0,0,0] to [1,1,1].  We
  90. ! will use a muted white light. The ambient direction is UP, but
  91. ! since K1 and K2 are zero this light is non-directional making
  92. ! direction a place holder.  UP is toward the positive z-axis.
  93.  
  94. !        always 0's  color      direction k1(base) k2(range)
  95.  
  96. AMBIENT( [0,0,0], [0.6,0.6,0.6], [0,0,1],   0,      0 );
  97.  
  98.  
  99. ! Specify the STAR light.  Position it above, behind, and to the
  100. ! left of the camera.  Since the light of a star doesn't
  101. ! diminish with distance, good light values range from [0,0,0] to
  102. ! [1,1,1].  Make a slightly bluish star.
  103.  
  104. !       position          color   radius
  105.  
  106. STAR( [-5000,-5000,4000], [.9,.9,1], 300 );
  107.  
  108.  
  109. ! Set the background color to a dark, muddy brown.
  110.  
  111. !            type  rgb color value
  112.  
  113. BACKGROUND( PLAIN, [0.1,0.05,0.05] );
  114.  
  115.  
  116. ! The scene has now been constructed, render it!
  117.  
  118. RENDER;
  119.  
  120.  
  121. ! All scripts must terminate with an END.
  122.  
  123. END
  124.