#########################################
# School Daze
# By Michael J. Hammel March 1997
#########################################

# First we setup the output file 
Display "school.tif" "file" "rgb"

# Set the gamma correction
# Exposure 1 2.4

# Then set the x & y resolution of the image and the pixel aspect
# ratio (1 = square pixels)
Format 800 600 1
# Format 640 480 1
# Format 320 240 1

# We now setup the camera (projection type and field of view)
Projection "perspective" "fov" 45

# Move the world 11.5 units away from the camera and position it
# so the view is to the left of the camera and down from the cameras
# point of view.
Translate -5 -1.5 11.5
Rotate 33.15 0 1 0
Rotate -13.6 1 0 0

# Ambient light - the soft light on all objects
LightSource "ambientlight" 5 "intensity" 0.03 "lightcolor" [1 1 1]

# Fill lights - these brighten the scene without casting shadows.
# We use fill lights instead of ambient light because ambient light
# reduces the realism in the picture.  The color of the light
# is generally the same as sun, which makes the room look like its 
# being lit by the sun.

# 
# Fill light for floor objects and partial back wall
#
TransformBegin
	Rotate -17.55 0 1 0
	Rotate 56.75 1 0 0
	LightSource "distantlight" 5 "intensity" 0.395 
		"lightcolor" [.8275 .8275 .735]
TransformEnd

# 
# Fill light toward back wall
#
TransformBegin
	Rotate -27.55 0 1 0
	LightSource "distantlight" 5 "intensity" 0.785 
		"lightcolor" [.8275 .8275 .7]
TransformEnd

# 
# Fill lights toward left wall
#
TransformBegin
	Rotate -88.5 0 1 0
	LightSource "distantlight" 5 "intensity" 0.515 
		"lightcolor" [.8275 .8275 .7]
TransformEnd

# 
# Fill light toward ceiling
#
TransformBegin
	Rotate -62.5 1 0 0
	LightSource "distantlight" 5 "intensity" 0.935 
		"lightcolor" [.9275 .9275 .8]
TransformEnd


# Our first (and only) frame....
FrameBegin 1

WorldBegin

	#========================================================== 
	# The Sun outside the window, which is actually five lights.
	# The first is the bright, main light.  The others provide
	# a way of reducing the harsh edges of the first light.  There are
	# better ways to do this (arealights, for example) but I don't
	# know how to use those just yet.
	#========================================================== 
	TransformBegin

		# The sun cast shadows
		Attribute "light" "shadows" "on" 

		# Put the light in the same coordinates as the left wall
		Translate -4.5 2.895 2.0

		LightSource "pointlight" 3 
 			"intensity" 451.0 "lightcolor" [1 0.8975 0.675]

		# A secondary light adds some color
		TransformBegin
			Translate .2 0 .2 
			LightSource "pointlight" 1 
				"intensity" 97.75 "lightcolor" [.915 0.6 0.6]
		TransformEnd

		Attribute "light" "shadows" "off" 

	TransformEnd

	#
	# Overhead lights.  These cast shadows too.
	#
	Attribute "light" "shadows" "on" 
	ReadArchive "overhead-lights-1.rib"
	Attribute "light" "shadows" "off" 
	ReadArchive "overhead-lights-2.rib"
	Attribute "light" "shadows" "on" 
	ReadArchive "overhead-lights-3.rib" 
	Attribute "light" "shadows" "off" 
	ReadArchive "overhead-lights-4.rib" 

	#========================================================== 
	# The outside world 
	#========================================================== 
	ReadArchive "skysphere.rib"

	#==========================================================
	# The description of the School Room.
	#==========================================================

	# The Back Wall.  This is a light blue color with a stucco finish.
	# These textures are also from Guido Quaroni's collection.
	ReadArchive "backwall.rib"

	# The Left Wall.  Same as the Back Wall, except with a window frame
	# cut out of it.
	ReadArchive "leftwall.rib"

	# The School Room Floor.
	# Again, the texture is from Guido Quaroni's collection.
	# This one happens to be one of the shaders provided in the RenderMan
	# Companion text.
	ReadArchive "floor.rib"
	ReadArchive "baseboard1.rib"
	ReadArchive "baseboard2.rib"

	# The School Room Ceiling.
	ReadArchive "ceiling.rib"

	# Bookcase 1 is the one against window
	# Bookcase 2 is the one against the back wall by the chalkboard
	ReadArchive "bookcase1.rib"
	ReadArchive "bookcase2.rib"

	# Place some student chairs in the room
	ReadArchive "chairs.rib"

	# The Clock
	ReadArchive "clock.rib"

WorldEnd

FrameEnd
