Cube
 
 
 

The procedure “Cube” is an environment map defined by six faces of a cube. These faces are just square texture images in the form of pix files. Each file corresponds to a perspective view with a field of view of 90 degrees with a view direction along the positive and negative x, y, z axes. These images can be painted or digitized. However, the real application of cubic reflection maps is using rendered images. It is possible to construct an environment map about a particular point in a scene merely by using a few lines of SDL.

For the origin point 0.0 0.0 0.0 use the following statements:

In the DEFINITION section:

	startframe = 1;
	endframe = 6;
	
	triple camera_view(0.0, 0.0, 0.0);

In the MODEL section use:

if (	frame == 1.0 ) camera_view = (1.0, 0.0, 0.0);
else if	(frame == 2.0 ) camera_view = (-1.0, 0.0, 0.0);
else if	(frame == 3.0 ) camera_view = (0.0, 1.0, 0.0);
else if	(frame == 4.0 ) camera_view = (0.0, -1.0, 0.0);
else if	(frame == 5.0 ) camera_view = (0.0, 0.0, -1.0);
else if	(frame == 6.0 ) camera_view = (0.0, 0.0, -1.0);
camera (eye = (0,0,0), view = camera_view, fov = 90,
	viewport = (0.0, 255.0, 0.0, 255.0),
	aspect = (1.0)
);

For further information on creating cubic environment maps, please refer to the Cubic Environment Tutorial.

“Cube” is an environment texture.

Cubic environment maps are very fast to reference so they are the preferred method for animation sequences. The same scene may render 3 or 4 times faster using a cubic reflection map in place of the Sky procedure. It is possible to use other environment maps to create cubic environment maps merely by rendering them as backgrounds. It is, of course, not worth doing if the environment such as Sky varies every frame. However, if the environment is static for many frames, the speed savings will be considerable.

Cubic environment maps have the advantage that they may be blurred by an arbitrarily large amount without any additional cost. When generating a background from an environment map the amount of blurring required to prevent aliasing increases with the field of view. In practice, with 5122 texture images and a field of view less than 90 degrees this will result in very little required blurring. For reflection mapped surfaces, however, the amount of blurring will depend upon the surface curvature and the distance from the eye point. Currently, this is not computed automatically. However, the variable "bluroffset" will allow the user to defocus the reflections by a desired amount. In fact, soft focus reflections can be used to simulate less than perfectly polished surfaces.

Argument Name Absolute Range Useful Range Default Description
top     no default Pix file name for top image
bottom     no default Pix file name for bottom image
right     no default Pix file name for right image
left     no default Pix file name for left image
front     no default Pix file name for front image
back     no default Pix file name for back image

In y-up systems, these are relative to the view down the z-axis; in z-up systems, they are relative to the view down the y-axis.