An environment map is a model of the world as seen from a particular point of view over a viewing angle of 360 degrees. In Alias, environment maps may be used for two things. For reflection mapping, the environment map is used to store a model of the world around a particular point inside or near a surface. This map is then used to compute the color of a ray reflected by that surface. In this way, convincing reflection effects may be produced.
The syntax for using an environment map to do reflections is as follows. In the DEFINITION section use the following statement as part of a texture on a shader:
reflection = texture (procedure = name,
arg 1 = value 1,
arg 2 = value 2,
and so on ...);
The second application of environment maps is to create backgrounds. Since an environment map stores a complete view of the world in all directions, any particular view may be computed efficiently. This will only be accurate if the environment map was created around the current eye point. There are several reasons to do this.
First, the environment may be procedural in nature and this is the only way to see it. The "sky" procedure is a good example of this case. Secondly, a scene may be largely static but also very expensive to render. In that case a fast method for animating the camera direction without re-rendering the scene for every frame would be desirable. Moving objects could then be rendered over the top. The "Cube" procedure would be ideal for this approach. The syntax for creating a background from an environment map is as follows. In the ENVIRONMENT section use:
background = texture (procedure = name,
arg 1 = value 1,
arg 2 = value 2,
and so on ...);
An environment map exists in an environment space coordinate system. The default for all environments in Alias is to have the environment space aligned with world space. Certain applications require the ability to rotate the environment map relative to world space. In particular, an object, lights and camera may be fixed relative to each other and the environment map tumbled. The syntax for this is identical to the coordinate transformations used with solid textures.
For example, consider a surface that is a ball being rendered with reflection mapping. It needs to have a transformation associated with it.
In the DEFINITION section the transformation must first be declared.
transformation ball;
A subsequent shader will include a textured parameter with “transformation_name”
reflection = texture (procedure = Chrome,
transformation_name= ball),
In the MODEL section the statement
ball = current_transformation ( );
will appear.
If it is located at the base of the hierarchy then the reflection map will be unaffected since the default is for the environment map to be aligned with world space anyway. However, if the assignment of the “current_transformation” to “ball” appears within a hierarchy, the environment map will rotate with the hierarchy. So, if the assignment occurs just before a patch statement the environment map will rotate with the patch. If a non-proportional scale is applied, the environment map will be stretched and distorted.