home *** CD-ROM | disk | FTP | other *** search
- !---------------------------------------------------------------
- !
- ! TUTORIAL2 - RayDance tutorial script #2.
- !
- ! This script demonstrates ka and kd (coefficients of ambient
- ! and diffuse reflection) on two rows of spheres.
- !
- ! Concepts include :
- !
- ! o Declaring PHONG surfaces with different ka and kd values.
- ! These will have a marked effect on the shadows of the
- ! spheres.
- !
- !---------------------------------------------------------------
-
- ! Use a print statement to display descriptive text on the
- ! message window.
-
-
- ? "TUTORIAL2 - This script defines a scene with two rows of\n",
- "spheres. Each sphere will be the same color but will have\n",
- "different ambient and diffuse reflection surface values\n",
- "(ka and kd). The top row will increase ka (ambient) from\n",
- "left to right. The bottom row will increase kd (diffuse)\n",
- "from left to right.\n\n";
-
-
- ! The camera will be positioned along the negative y axis
- ! looking at the origin.
-
- CAMERA'POS = [0,-3000,0];
- CAMERA'TARGET = [0,0,0];
-
-
- ! Define the color of the sphere
-
- SPHERE_COLOR : COLOR ( RGB, [0.8,0.4,0] ); ! Lt orange
-
-
- ! Define surfaces for the spheres, no mirroring
-
- ! Top row, varying ambient
- !
- ! ka kd ks n km kr ir kb flags
- TOP_1_SURF :
- SURFACE(PHONG, 0.1,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0 );
- TOP_2_SURF :
- SURFACE(PHONG, 0.4,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0 );
- TOP_3_SURF :
- SURFACE(PHONG, 0.7,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0 );
- TOP_4_SURF :
- SURFACE(PHONG, 1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0 );
-
- ! Bottom row, varying diffuse
- !
- ! ka kd ks n km kr ir kb flags
- BOT_1_SURF :
- SURFACE(PHONG, 1.0,0.1,0.0,0.0,0.0,0.0,0.0,0.0,0 );
- BOT_2_SURF :
- SURFACE(PHONG, 1.0,0.4,0.0,0.0,0.0,0.0,0.0,0.0,0 );
- BOT_3_SURF :
- SURFACE(PHONG, 1.0,0.7,0.0,0.0,0.0,0.0,0.0,0.0,0 );
- BOT_4_SURF :
- SURFACE(PHONG, 1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0 );
-
-
- ! Create the top row of spheres
-
- ! center raidus color surface
-
- SPHERE( [-750,0,300], 150, SPHERE_COLOR, TOP_1_SURF );
- SPHERE( [-250,0,300], 150, SPHERE_COLOR, TOP_2_SURF );
- SPHERE( [ 250,0,300], 150, SPHERE_COLOR, TOP_3_SURF );
- SPHERE( [ 750,0,300], 150, SPHERE_COLOR, TOP_4_SURF );
-
-
- ! Create the bottom row of spheres
-
- SPHERE( [-750,0,-300], 150, SPHERE_COLOR, BOT_1_SURF );
- SPHERE( [-250,0,-300], 150, SPHERE_COLOR, BOT_2_SURF );
- SPHERE( [ 250,0,-300], 150, SPHERE_COLOR, BOT_3_SURF );
- SPHERE( [ 750,0,-300], 150, SPHERE_COLOR, BOT_4_SURF );
-
-
- ! Specify the ambient light. This will provide illumination for
- ! the areas that are shadows from the star light source.
- ! Positioning of ambient lights is reserved for future
- ! expansion. For now, set position to [0,0,0]. The intensity
- ! of ambient lights should range from [0,0,0] to [1,1,1]. We
- ! will use a muted white light. The ambient direction is UP, but
- ! since K1 and K2 are zero this light is non-directional making
- ! direction a place holder. UP is toward the positive z-axis.
-
- ! always 0's color direction k1(base) k2(range)
-
- AMBIENT( [0,0,0], [0.6,0.6,0.6], [0,0,1], 0, 0 );
-
-
- ! Specify the STAR light. Position it above, behind, and to the
- ! left of the camera. Since the light of a star doesn't
- ! diminish with distance, good light values range from [0,0,0] to
- ! [1,1,1]. Make a slightly bluish star.
-
- ! position color radius
-
- STAR( [-5000,-5000,4000], [.9,.9,1], 300 );
-
-
- ! Set the background color to a dark, muddy brown.
-
- ! type rgb color value
-
- BACKGROUND( PLAIN, [0.1,0.05,0.05] );
-
-
- ! The scene has now been constructed, render it!
-
- RENDER;
-
-
- ! All scripts must terminate with an END.
-
- END
-