!---------------------------------------------------------------
!
! TUTORIAL4 - RayDance tutorial script #4.
!
! This script demonstrates transparency.  A row of spheres is
! created with different values for ir (index of refraction).
!
! Concepts include :
!
!  o Declaring PHONG surfaces with transparency.
!
!  o A diamond pattern ground plane
!
!---------------------------------------------------------------

! Use a print statement to display descriptive text on the
! message window.

? "TUTORIAL4 - This script defines a scene with one row of\n",
  "spheres floating over a checkerboard.  ir will change\n",
  "from 0.4 to 1.6 moving from left to right.  All spheres\n",
  "are colored white to simulate clear glass\n";


! The camera will be positioned along the negative y axis
! looking at the origin.

CAMERA'POS = [0,-3500,500];
CAMERA'TARGET = [0,0,200];


! Define colors for this scene

!                   rgb color value

WHITE  : COLOR ( RGB, [1,1,1] );
BLUE   : COLOR ( RGB, [0,0,1] );
YELLOW : COLOR ( RGB, [1,1,0] );


! Define surfaces for the spheres, with varying ir.  Glass has
! very little in the way of diffuse or ambient lighting and
! quite sharp specular hilites (a large n value).  It also has
! a large value for kr (refraction) and a smaller value for km
! (mirror reflection).  kr * kr + km MUST be less than 1.0.
! This avoids creation of a light amplifier inside the
! spheres.  Should this happen the light ray leaving a sphere
! could have more intensity than the sum of the light rays
! entering the sphere.

!                ka  kd  ks n   km kr ir  kb  flags
SURF1 :
  SURFACE(PHONG, .02,.02,.5,100,.1,.9,0.4,0.0,TRANSPARENT );
SURF2 :
  SURFACE(PHONG, .02,.02,.5,100,.1,.9,0.7,0.0,TRANSPARENT );
SURF3 :
  SURFACE(PHONG, .02,.02,.5,100,.1,.9,1.0,0.0,TRANSPARENT );
SURF4 :
  SURFACE(PHONG, .02,.02,.5,100,.1,.9,1.3,0.0,TRANSPARENT );
SURF5 :
  SURFACE(PHONG, .02,.02,.5,100,.1,.9,1.6,0.0,TRANSPARENT );

! Define a surface for the ground (diamond pattern)

!                      ka kd ks n  km kr ir kb flags
MATTE : SURFACE(PHONG, 1, 1, 0, 0, 0, 0, 0, 0, 0 );


! Create the row of spheres

SPHERE( [-1000,0,250], 225, WHITE, SURF1 );
SPHERE( [ -500,0,250], 225, WHITE, SURF2 );
SPHERE( [    0,0,250], 225, WHITE, SURF3 );
SPHERE( [  500,0,250], 225, WHITE, SURF4 );
SPHERE( [ 1000,0,250], 225, WHITE, SURF5 );


! Specify the ambient light.

AMBIENT( [0,0,0], [0.6,0.6,0.6], [0,0,1], 0, 0 );

! Specify the STAR light.

STAR( [5000,-5000,4000], [1,.9,1], 300 );


! Set the background color to a dark, muddy brown

BACKGROUND( PLAIN, [0.1,0.05,0.05] );


! Make the ground plane.  This time we'll use a diamond pattern

GROUND( DIAMOND, 0, 400, BLUE, MATTE, YELLOW, MATTE );


! The scene has now been constructed, render it!

RENDER;


! All scripts must terminate with an END

END
