home *** CD-ROM | disk | FTP | other *** search
- !---------------------------------------------------------------
- !
- ! Tutorial1 - This script creates a minimal scene
- !
- ! Concepts include :
- !
- ! o Using the print statement ( ? <msg> ) to provide
- ! user-visible messages on the MessageWindow.
- !
- ! o Declaring RGB colors.
- !
- ! o Declaring PHONG surfaces
- !
- ! o Declaring a SPHERE
- !
- ! o Setting up a checkerboard ground pattern
- !
- ! o Camera placement
- !
- ! o Using ambient and star light sources
- !
- !---------------------------------------------------------------
-
- ! Starting a script with a print statement that gives a quick
- ! description of the scene rendered by a script is a good idea.
- ! Be sure that each string to be printed starts and ends with
- ! double quote characters. A new line on the message window
- ! is started with the newline sequence, \n (backslash n).
- ! Individual strings are seperated by commas.
-
- ? "TUTORIAL1 - This script defines a scene with a single\n",
- "sphere hovering over a checkerboard.\n";
-
- ! The camera will be positioned over the negative y axis looking
- ! at a point over the origin where our sphere will be
- ! positioned.
-
- CAMERA'POS = [0,-1300,400];
- CAMERA'TARGET = [0,0,300];
-
-
- ! Define the color of the sphere
-
- SPHERE_COLOR : COLOR ( RGB, [0.8,0.4,0] ); ! Lt orange
-
- ! Define the colors of the checker board
-
- BLUE : COLOR ( RGB, [0,0,1] );
- YELLOW : COLOR ( RGB, [1,1,0] );
-
-
- ! Define the surface of the sphere. We will use a phong
- ! surface. We want to be illuminated by ambient as well as
- ! diffuse light plus a specular hilite. The sphere will also
- ! have a bit of mirror reflection.
-
- ! ka kd ks n km kr ir kb flags
- SPHERE_SURF :
- SURFACE(PHONG, 1.0,1.0,0.5,50.0,0.3,0.0,0.0,0.0,0 );
-
- ! The ground will be a matte surface, no specular hilites or
- ! mirror reflections.
-
- ! ka kd ks n km kr ir kb flags
- MATTE :
- SURFACE(PHONG, 1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0 );
-
-
- ! Now we need to create our sphere. Let's have it hovering over
- ! the world coordinate origin at a height of 300 units. Its
- ! radius will be 200 units.
-
- ! center radius color surface
-
- SPHERE( [0,0,300], 200, SPHERE_COLOR, SPHERE_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
- ! right 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 yellowish star.
-
- ! position color radius
-
- STAR( [5000,-5000,4000], [1,1,.9], 300 );
-
-
- ! Create the checkerboard. This will be at elevation 0 (on z
- ! axis). Checkerboard squares will be 300 x 300.
-
- ! type ht size color surf color surf
-
- GROUND( CHECKERBOARD, 0, 300, BLUE, MATTE, YELLOW, MATTE );
-
-
- ! Set the background color to a dark, muddy red.
-
- ! type rgb color value
-
- BACKGROUND( PLAIN, [0.2,0.05,0.05] );
-
-
- ! The scene has now been constructed, render it!
-
- RENDER;
-
-
- ! All scripts must terminate with an END.
-
- END
-